Commit 704f084d authored by Jeroen Vreeken's avatar Jeroen Vreeken
Browse files

use libtool for common libs

parent 1cee7e77
......@@ -8,3 +8,6 @@
*.yy.c
*.yy.h
*.log
*.lo
*.la
.libs
......@@ -6,28 +6,38 @@ ARFLAGS= -r
# make sure libs from /usr/local/lib are found
VPATH= /lib64 /usr/lib64 /usr/local/lib64 /lib /usr/lib /usr/local/lib
LIBTOOL=libtool
%.o : %.c
@echo " CC $<"
@echo " CC $<"
@$(CC) -MD $(CFLAGS) -c $<
%: %.o
@echo " LD $@"
@$(LINK.o) $^ $(LOADLIBES) $(LDLIBS) $($@_LDFLAGS) -o $@
@echo " LD $@"
@${LIBTOOL} --quiet --mode=link --tag=CC $(LINK.o) $^ $(LOADLIBS) $(LDLIBS) $($@_LDFLAGS) -o $@
%.lo: %.c
@echo "LT CC $<"
@${LIBTOOL} --quiet --mode=compile --tag=CC $(CC) -MD $(CFLAGS) -c $<
%.la:
@echo "LIBTOOL $@"
@${LIBTOOL} --quiet --mode=link gcc $^ -o $@ $(LDFLAGS) $($@_LDFLAGS) -static-libtool-libs
(%): %
@echo " AR $< in $@"
@$(AR) $(ARFLAGS) $@ $<
@echo " AR $^ in $@"
@$(AR) $(ARFLAGS) $@ $^
%.tab.c %.tab.h: %.y
@echo "BISON $<"
@echo "BISON $<"
@bison -d $<
%.yy.h: %.l %.tab.h
@echo " FLEX $<"
@echo " FLEX $<"
@flex --header-file=$*.yy.h $<
%.yy.c: %.l %.tab.h
@echo " FLEX $<"
@echo " FLEX $<"
@flex -o $@ $<
# il2c: instruction list 2 c 'compiler'
......
CFLAGS+= -Wall -O3 -I../utils/
LDFLAGS+= -L../lib
OBJS= trace.o
SRCS= $(OBJS:.o=.c) trace_dump.c trace_dumpdiff.c trace_fft.c
LOBJS= trace.lo
SRCS= trace_dump.c trace_dumpdiff.c trace_fft.c
all: $(OBJS) trace.a trace_dump trace_dumpdiff trace_fft
all: libs bins
trace.a: trace.a($(OBJS))
libs: libtrace.la
trace_dump: trace_dump.o trace.a ../utils/utils.a
libs_install: libtrace.la_install
trace_dumpdiff: trace_dumpdiff.o trace.a ../utils/utils.a
bins: libs libs_install trace_dump trace_dumpdiff trace_fft
trace_fft_LDFLAGS= -lm
trace_fft: trace_fft.o -lfftw3 trace.a ../utils/utils.a
libtrace.la_LDFLAGS= -lutils -lm -rpath ${PWD}/../lib
libtrace.la: trace.lo
libtrace.la_install: libtrace.la
@echo "CP $^ to libdir"
@${LIBTOOL} --quiet --mode=install install libtrace.la ${PWD}/../lib
trace_dump_LDFLAGS= -ltrace -lutils
trace_dump: trace_dump.o
trace_dumpdiff_LDFLAGS= -ltrace -lutils
trace_dumpdiff: trace_dumpdiff.o
trace_fft_LDFLAGS= -lm -lutils -ltrace
trace_fft: trace_fft.o -lfftw3
clean:
rm -rf *.o *.a *.d trace_dump trace_dumpdiff trace_fft
rm -rf *.o *.a *.d *.lo *.la .libs trace_dump trace_dumpdiff trace_fft
include ../build.mk
......@@ -6,16 +6,21 @@ CFLAGS+=`pkg-config --cflags glib-2.0`
LDFLAGS+=`pkg-config --libs glib-2.0`
UTILSRCS= tcp_connect.c tcp_listen.c config.c weather.c dt_model.c location.c dt_host.c
UTILOBJS= $(UTILSRCS:.c=.o)
LIBUTILOBJS= $(UTILSRCS:.c=.lo)
all: $(UTILOBJS) utils weather_test
all: $(LIBUTILOBJS) weather_test libutils.la libutils.la_install
utils: utils.a($(UTILOBJS))
libutils.la_LDFLAGS= -lm -rpath ${PWD}/../lib
libutils.la: $(LIBUTILOBJS)
libutils.la_install: libutils.la
@echo "CP $^ to libdir"
@${LIBTOOL} --quiet --mode=install install libutils.la ${PWD}/../lib
weather_test: weather_test.o weather.o tcp_connect.o
clean:
rm -rf *.o *.a *.d weather_test
rm -rf *.o *.a *.la *.lo .libs *.d weather_test
SRCS= $(UTILSRCS) weather_test.c
......
......@@ -6,28 +6,38 @@ ARFLAGS= -r
# make sure libs from /usr/local/lib are found
VPATH= /lib64 /usr/lib64 /usr/local/lib64 /lib /usr/lib /usr/local/lib
LIBTOOL=libtool
%.o : %.c
@echo " CC $<"
@echo " CC $<"
@$(CC) -MD $(CFLAGS) -c $<
%: %.o
@echo " LD $@"
@$(LINK.o) $^ $(LOADLIBES) $(LDLIBS) $($@_LDFLAGS) -o $@
@echo " LD $@"
@${LIBTOOL} --quiet --mode=link --tag=CC $(LINK.o) $^ $(LOADLIBS) $(LDLIBS) $($@_LDFLAGS) -o $@
%.lo: %.c
@echo "LT CC $<"
@${LIBTOOL} --quiet --mode=compile --tag=CC $(CC) -MD $(CFLAGS) -c $<
%.la:
@echo "LIBTOOL $@"
@${LIBTOOL} --quiet --mode=link gcc $^ -o $@ $(LDFLAGS) $($@_LDFLAGS) -static-libtool-libs
(%): %
@echo " AR $< in $@"
@$(AR) $(ARFLAGS) $@ $<
@echo " AR $^ in $@"
@$(AR) $(ARFLAGS) $@ $^
%.tab.c %.tab.h: %.y
@echo "BISON $<"
@echo "BISON $<"
@bison -d $<
%.yy.h: %.l %.tab.h
@echo " FLEX $<"
@echo " FLEX $<"
@flex --header-file=$*.yy.h $<
%.yy.c: %.l %.tab.h
@echo " FLEX $<"
@echo " FLEX $<"
@flex -o $@ $<
# il2c: instruction list 2 c 'compiler'
......
include ../build.mk
CFLAGS= -Wall -g -I../../common/utils -I../controller -Iaalib -Ipredictlib -I../../common/trace -I../../common/include -I../../libnova-0.13.0/src
ARCHIVES= ../../common/utils/utils.a aalib/aalib.a predictlib/predictlib.a ../../common/trace/trace.a
LIBNOVA=../../libnova-0.13.0/src/.libs/libnova.a
LDFLAGS+=`pkg-config --libs glib-2.0`
ARCHIVES= aalib/aalib.a predictlib/predictlib.a
LDFLAGS+= -L../../common/lib/ -L../../libnova-0.13.0/src/.libs/ -lutils -ltrace -static
all: aalib predictlib\
setpoint.o console_easycomm console_joystick command_shell \
......@@ -37,9 +36,9 @@ spg_log_parser: spg_log_parser.o $(ARCHIVES)
console_moontracker: console_moontracker.o setpoint.o $(ARCHIVES) -lm -lpthread
console_j2000tracker: console_j2000tracker.o setpoint.o $(ARCHIVES) $(LIBNOVA) -lpthread -lm
console_j2000tracker: console_j2000tracker.o setpoint.o $(ARCHIVES) -lnova -lpthread -lm
console_j2000tracer: console_j2000tracer.o $(ARCHIVES) $(LIBNOVA) -lm
console_j2000tracer: console_j2000tracer.o $(ARCHIVES) -lnova -lm
console_j2000_indi: console_j2000_indi.o $(ARCHIVES) -lindi -lindidriver -lm
......@@ -70,7 +69,7 @@ log_proxy: log_proxy.o $(ARCHIVES)
spg_auth: spg_auth.o setpoint.o $(ARCHIVES)
console_sattracker: console_sattracker.o setpoint.o $(ARCHIVES) -lpthread $(LIBNOVA) -lm
console_sattracker: console_sattracker.o setpoint.o $(ARCHIVES) -lpthread -lnova -lm
command.cgi: command.cgi.o $(ARCHIVES)
......
......@@ -6,7 +6,7 @@ CFLAGS= -Wall -O3 \
-I../common/utils \
-I../common/trace \
-Idt_azimuth -Idt_elevation -Iec -Ishell -Ilog
LDFLAGS= -lpthread -lrt -lm -ldl -Wl,-E
LDFLAGS= -lpthread -lrt -lm -ldl -Wl,-E -L../common/lib
CFLAGS_SIM=-DUSE_AZ_SIM -DUSE_EL_SIM
ARCHIVES= \
......@@ -15,10 +15,8 @@ ARCHIVES= \
controller/controller.a \
log/log.a \
ec/ec.a \
shell/shell.a \
../common/trace/trace.a \
../common/utils/utils.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`
......@@ -34,8 +32,10 @@ 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_view_LDFLAGS= -ltrace
trace_view: trace_view.o $(ARCHIVES)
%.a:
......
......@@ -6,28 +6,38 @@ ARFLAGS= -r
# make sure libs from /usr/local/lib are found
VPATH= /lib64 /usr/lib64 /usr/local/lib64 /lib /usr/lib /usr/local/lib
LIBTOOL=libtool
%.o : %.c
@echo " CC $<"
@echo " CC $<"
@$(CC) -MD $(CFLAGS) -c $<
%: %.o
@echo " LD $@"
@$(LINK.o) $^ $(LOADLIBES) $(LDLIBS) $($@_LDFLAGS) -o $@
@echo " LD $@"
@${LIBTOOL} --quiet --mode=link --tag=CC $(LINK.o) $^ $(LOADLIBS) $(LDLIBS) $($@_LDFLAGS) -o $@
(%): %
@echo " AR $< in $@"
@$(AR) $(ARFLAGS) $@ $<
%.lo: %.c
@echo "LT CC $<"
@${LIBTOOL} --quiet --mode=compile --tag=CC $(CC) -MD $(CFLAGS) -c $<
%.yy.h: %.l %.tab.h
@echo " FLEX $<"
@flex --header-file=$*.yy.h $<
%.la:
@echo "LIBTOOL $@"
@${LIBTOOL} --quiet --mode=link gcc $^ -o $@ $(LDFLAGS) $($@_LDFLAGS) -static-libtool-libs
(%): %
@echo " AR $^ in $@"
@$(AR) $(ARFLAGS) $@ $^
%.tab.c %.tab.h: %.y
@echo "BISON $<"
@echo "BISON $<"
@bison -d $<
%.yy.h: %.l %.tab.h
@echo " FLEX $<"
@flex --header-file=$*.yy.h $<
%.yy.c: %.l %.tab.h
@echo " FLEX $<"
@echo " FLEX $<"
@flex -o $@ $<
# il2c: instruction list 2 c 'compiler'
......
Supports Markdown
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