Commit 679f6a73 authored by Jeroen Vreeken's avatar Jeroen Vreeken
Browse files

use libtool for archives

parent 704f084d
......@@ -6,53 +6,76 @@ CFLAGS= -Wall -O3 \
-I../common/utils \
-I../common/trace \
-Idt_azimuth -Idt_elevation -Iec -Ishell -Ilog
LDFLAGS= -lpthread -lrt -lm -ldl -Wl,-E -L../common/lib
LDFLAGS= -lpthread -lrt -lm -ldl -Wl,-E -L../common/lib -L./lib
CFLAGS_SIM=-DUSE_AZ_SIM -DUSE_EL_SIM
ARCHIVES= \
dt_azimuth/dt_azimuth.a \
dt_elevation/dt_elevation.a \
controller/controller.a \
log/log.a \
ec/ec.a \
shell/shell.a
dt_ctrl_sim_LDFLAGS=`controller/block_list.sh dt_azimuth/dt_azimuth.a dt_elevation/dt_elevation.a controller/controller.a`
dt_ctrl_LDFLAGS=$(dt_ctrl_sim_LDFLAGS) `controller/block_list.sh ec/ec.a`
dt_ctrl_sim_LDFLAGS=`controller/block_list.sh lib/*.a` \
-lcontroller -lethercat -llog -lshell -ldt_azimuth -ldt_elevation
dt_ctrl_LDFLAGS=$(dt_ctrl_sim_LDFLAGS)
all: dt_ctrl dt_ctrl_sim \
trace_list trace_view \
test
test \
controller
dt_ctrl: lib/libcontroller.la lib/libethercat.la lib/libdt_azimuth.la lib/libdt_elevation.la
dt_ctrl_sim: lib/libcontroller.la lib/libdt_azimuth.la lib/libdt_elevation.la
lib/libethercat.la: lib/libcontroller.la
lib/libdt_azimuth.la: lib/libcontroller.la
lib/libdt_elevation.la: lib/libcontroller.la
dt_ctrl: dt_ctrl.o $(ARCHIVES)
dt_ctrl: dt_ctrl.o
dt_ctrl_sim: dt_ctrl_sim.o $(ARCHIVES)
dt_ctrl_sim: dt_ctrl_sim.o
dt_ctrl_sim.o: dt_ctrl.c
@echo "COMPILE: dt_ctrl.c (OUTPUT: dt_ctrl_sim.o)"
@$(CC) $(CFLAGS) $(CFLAGS_SIM) dt_ctrl.c -c -o dt_ctrl_sim.o
trace_list_LDFLAGS= -ltrace
trace_list: trace_list.o $(ARCHIVES)
trace_list: trace_list.o
trace_view_LDFLAGS= -ltrace
trace_view: trace_view.o $(ARCHIVES)
%.a:
@echo " SUBDIR: $(@D)"
@$(MAKE) -C $(@D)
ec/ec.a: log/log.a shell/shell.a
trace_view: trace_view.o
test:
@echo " SUBDIR: $@"
@$(MAKE) -C test
lib/libcontroller.la: lib/libshell.la
lib/libcontroller.la:
@echo " SUBDIR: $@"
@$(MAKE) -C controller
lib/libdt_azimuth.la:
@echo " SUBDIR: $@"
@$(MAKE) -C dt_azimuth
lib/libdt_elevation.la:
@echo " SUBDIR: $@"
@$(MAKE) -C dt_elevation
lib/libethercat.la: lib/liblog.la lib/libshell.la
lib/libethercat.la:
@echo " SUBDIR: $@"
@$(MAKE) -C ec
lib/libshell.la:
@echo " SUBDIR: $@"
@$(MAKE) -C shell
lib/liblog.la:
@echo " SUBDIR: $@"
@$(MAKE) -C log
.PHONY: test
clean:
rm -f *.o *.d
rm -f *.o *.d *.a *.la *.lo lib/*
rm -f dt_az dt_az_ctrl \
command_shell \
trace_list trace_view \
......
......@@ -14,7 +14,7 @@ LIBTOOL=libtool
%: %.o
@echo " LD $@"
@${LIBTOOL} --quiet --mode=link --tag=CC $(LINK.o) $^ $(LOADLIBS) $(LDLIBS) $($@_LDFLAGS) -o $@
@${LIBTOOL} --quiet --mode=link --tag=CC $(LINK.o) $(filter %.o,$^) $(LOADLIBS) $(LDLIBS) $($@_LDFLAGS) -o $@
%.lo: %.c
@echo "LT CC $<"
......
......@@ -55,17 +55,17 @@ CONTROLLERSRCS= \
SRCS= $(CONTROLLERSRCS) $(BLOCKSRCS)
BLOCKS=$(BLOCKSRCS:.c=.o)
BLOCKS=$(BLOCKSRCS:.c=.lo)
CONTROLLER= $(CONTROLLERSRCS:.c=.o)
CONTROLLER= $(CONTROLLERSRCS:.c=.lo)
all: il2cdir $(BLOCKS) $(CONTROLLER) controllerlib
all: il2cdir libcontroller.la_install
controller_load_parser.tab.o: controller_load_parser.yy.c
controller_load_parser.tab.lo: controller_load_parser.yy.c
controller_load.o: controller_load_parser.tab.h controller_load_parser.yy.h
controller_load.lo: controller_load_parser.tab.h controller_load_parser.yy.h
il2cdir:
@echo " SUBDIR: $@"
......@@ -73,10 +73,15 @@ il2cdir:
.PHONY: il2cdir
controllerlib: controller.a($(BLOCKS) $(CONTROLLER))
libcontroller.la_LDFLAGS=-rpath ${CURDIR}/../lib -lshell
libcontroller.la: $(BLOCKS) $(CONTROLLER)
libcontroller.la_install: libcontroller.la
@echo "CP $^ to libdir"
@${LIBTOOL} --quiet --mode=install install libcontroller.la ${CURDIR}/../lib
clean:
rm -rf *.o *.a *.yy.* *.tab.* *.d
rm -rf *.o *.a *.yy.* *.tab.* *.d *.lo *.la libs
@$(MAKE) -C il2c clean
include ../build.mk
......@@ -2,15 +2,20 @@
CFLAGS= -Wall -O3 -I../controller -I../ec -I../log -I../utils
ARCHSRCS= dt_az_safety.c dt_az_stoeber_sim.c
ARCHOBJS=$(ARCHSRCS:.c=.o)
ARCHOBJS=$(ARCHSRCS:.c=.lo)
all: $(ARCHOBJS) dt_azimuth
all: libdt_azimuth.la_install
dt_azimuth: dt_azimuth.a($(ARCHOBJS))
libdt_azimuth.la_LDFLAGS=-rpath ${CURDIR}/../lib -lcontroller -L../lib
libdt_azimuth.la: $(ARCHOBJS)
libdt_azimuth.la_install: libdt_azimuth.la
@echo "CP $^ to libdir"
@${LIBTOOL} --quiet --mode=install install libdt_azimuth.la ${CURDIR}/../lib
clean:
rm -rf *.o *.a *.d
rm -rf *.o *.a *.d *.lo *.la libs
SRCS=$(ARCHSRCS)
......
......@@ -2,9 +2,18 @@
CFLAGS= -Wall -I../controller -I../ec -I../log -I../utils -g
SRCS= dt_el_safety.c dt_el_stoeber_r_sim.c dt_el_stoeber_l_sim.c
OBJS=$(SRCS:.c=.o)
all: $(OBJS) dt_elevation
ARCHOBJS=$(SRCS:.c=.lo)
all: libdt_elevation.la_install
libdt_elevation.la_LDFLAGS=-rpath ${CURDIR}/../lib -lcontroller -L../lib
libdt_elevation.la: $(ARCHOBJS)
libdt_elevation.la_install: libdt_elevation.la
@echo "CP $^ to libdir"
@${LIBTOOL} --quiet --mode=install install libdt_elevation.la ${CURDIR}/../lib
dt_elevation: dt_elevation.a($(OBJS))
......
CFLAGS= -Wall -O3 \
-I. -I.. -I../log -I../controller
LDFLAGS= -lpthread -lrt -ldl -lm
LDFLAGS= -lpthread -lrt -ldl -lm -L../lib
LIBSRCS= ec.c esc.c canopen.c ec_stoeber.c block_ec.c
LIBOBJS= $(LIBSRCS:.c=.o)
LIBOBJS= $(LIBSRCS:.c=.lo)
BLOCKSRCS= \
block_beckhoff_el1xxx.c \
......@@ -16,21 +16,29 @@ BLOCKSRCS= \
block_beckhoff_el5101.c \
block_stoeber.c
BLOCKS=$(BLOCKSRCS:.c=.o)
BLOCKS=$(BLOCKSRCS:.c=.lo)
SRCS=$(BLOCKSRCS) $(LIBSRCS)
all: $(LIBOBJS) $(BLOCKS) ec_test.o eclib ec_enum ec_el_test
all: ec_test.o libethercat.la_install ec_enum ec_el_test
eclib: ec.a($(LIBOBJS) $(BLOCKS))
libethercat.la_LDFLAGS=-rpath ${CURDIR}/../lib -lcontroller
libethercat.la: $(LIBOBJS) $(BLOCKS)
ec_enum: ec_enum.o ec.a ../log/log.a ../controller/controller.a
libethercat.la_install: libethercat.la
@echo "CP $^ to libdir"
@${LIBTOOL} --quiet --mode=install install libethercat.la ${CURDIR}/../lib
ec_enum: libethercat.la_install
ec_enum_LDFLAGS=-lethercat -llog
ec_enum: ec_enum.o
ec_enum.o: esc_id.h
ec_el_test_LDFLAGS:= `../controller/block_list.sh ec.a ../controller/controller.a` -Wl,-E
ec_el_test: ec_el_test.o ec.a ../controller/controller.a ../log/log.a ../shell/shell.a
ec_el_test_LDFLAGS:= `../controller/block_list.sh ../lib/lib*.a` -Wl,-E -lcontroller -lethercat -llog -lshell
ec_el_test: ec_el_test.o
clean:
rm -rf *.o *.a *.d ec_enum ec_el_test
rm -rf *.o *.a *.la *.lo .libs *.d ec_enum ec_el_test
include ../build.mk
CFLAGS= -Wall -O3
ARCHSRCS = log.c
ARCHOBJS = $(ARCHSRCS:.c=.o)
ARCHOBJS = $(ARCHSRCS:.c=.lo)
SRCS=$(ARCHSRCS)
all: $(ARCHOBJS) loglib
all: $(ARCHOBJS) liblog.la_install
liblog.la_LDFLAGS=-rpath ${CURDIR}/../lib
liblog.la: $(ARCHOBJS)
loglib: log.a($(ARCHOBJS))
liblog.la_install: liblog.la
@echo "CP $^ to libdir"
@${LIBTOOL} --quiet --mode=install install liblog.la ${CURDIR}/../lib
clean:
rm -rf *.o *.a *.d
rm -rf *.o *.a *.d *.lo *.la libs
include ../build.mk
CFLAGS= -Wall -O3
SRCS= shell.c
ARCHOBJS = $(SRCS:.c=.o)
ARCHOBJS = $(SRCS:.c=.lo)
all: $(ARCHOBJS) shelllib
all: libshell.la_install
shelllib: shell.a($(ARCHOBJS))
libshell.la_LDFLAGS=-rpath ${CURDIR}/../lib -lcontroller
libshell.la: $(ARCHOBJS)
libshell.la_install: libshell.la
@echo "CP $^ to libdir"
@${LIBTOOL} --quiet --mode=install install libshell.la ${CURDIR}/../lib
clean:
rm -rf *.o *.a *.d
rm -rf *.o *.a *.d *.lo *.la libs
include ../build.mk
CFLAGS= -Wall -g \
-I../controller -I../utils -I../dt_azimuth -I../dt_elevation -I../ec
LDFLAGS= -lpthread -lrt -lm -ldl
LDFLAGS= -lpthread -lrt -lm -ldl -lcontroller -lethercat -llog -L../lib
all: spg_test iir_test
spg_test: spg_test.o ../controller/controller.a ../ec/ec.a ../log/log.a
spg_test: spg_test.o
iir_test: iir_test.o ../controller/controller.a ../ec/ec.a ../log/log.a
iir_test: iir_test.o
SRCS=spg_test.c iir_test.c
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment