Commit b397f626 authored by Scott Vokes's avatar Scott Vokes
Browse files

Update integration of internal static libraries, build process in Makefile

parent 11493002
Loading
Loading
Loading
Loading
+27 −8
Original line number Diff line number Diff line
@@ -70,15 +70,18 @@ makedirs:

all: default test system_tests test_internals run examples

clean: makedirs
	rm -rf ./bin/**
	rm -f $(OUT_DIR)/*.o *.core *.log
clean: makedirs update_git_submodules
	rm -rf ./bin/**/*
	rm -f $(OUT_DIR)/*.o $(OUT_DIR)/*.a *.core *.log
	bundle exec rake clobber
	git submodule update --init
	-./vendor/kinetic-simulator/stopSimulator.sh &> /dev/null;
	cd ${SOCKET99} && make clean
	cd ${LIB_DIR}/threadpool && make clean
	cd ${LIB_DIR}/bus && make clean

update_git_submodules:
	git submodule update --init

TAGS: ${C_SRC} Makefile
	@find . -name "*.[ch]" | grep -v vendor | grep -v build | xargs etags

@@ -131,13 +134,29 @@ JAVA_BIN = $(JAVA_HOME)/bin/java

.PHONY: test

${SOCKET99}/libsocket99.a:
	cd ${SOCKET99} && make libsocket99.a

test_internals: ${SOCKET99}/libsocket99.a
test_internals: internal_libs
	cd ${LIB_DIR}/threadpool && make test
	cd ${LIB_DIR}/bus && make test

#-------------------------------------------------------------------------------
# Internal Libraries
#-------------------------------------------------------------------------------

internal_libs: ${OUT_DIR}/libsocket99.a ${OUT_DIR}/libthreadpool.a ${OUT_DIR}/libbus.a

${OUT_DIR}/libsocket99.a: ${SOCKET99}/*.[ch]
	cd ${SOCKET99} && make all
	cp ${SOCKET99}/libsocket99.a $@

${OUT_DIR}/libthreadpool.a: ${LIB_DIR}/threadpool/*.[ch]
	cd ${LIB_DIR}/threadpool && make all
	cp ${LIB_DIR}/threadpool/libthreadpool.a $@

${OUT_DIR}/libbus.a: ${OUT_DIR}/libsocket99.a ${OUT_DIR}/libthreadpool.a ${LIB_DIR}/bus/*.[ch]
	cd ${LIB_DIR}/bus && make all
	cp ${LIB_DIR}/bus/libbus.a $@


#-------------------------------------------------------------------------------
# Static and Dynamic Library Build Support
#-------------------------------------------------------------------------------
+12 −10
Original line number Diff line number Diff line
SOCKET99_PATH=		../../../vendor/socket99
THREADPOOL_PATH=	../threadpool
LIB_PATH=		../../../obj

OPT=		-O3
LIB_INC =	-I${SOCKET99_PATH} -I${THREADPOOL_PATH}
CFLAGS +=	-std=c99 ${OPT} -Wall -g ${LIB_INC}
LDFLAGS +=	-L. -L${SOCKET99_PATH} -lsocket99 -L${THREADPOOL_PATH} -lthreadpool
LDFLAGS +=	-L. -lsocket99 -L${LIB_PATH} -lthreadpool

BUS_OBJS = \
	bus.o \
	casq.o \
	listener.o \
	sender.o \
	util.o \
@@ -17,7 +19,7 @@ ECHOSRV_OBJS = \
	echosrv.o \
	util.o \

all: bus.png libcasq.a test_casq test_yacht echosrv bus_example
all: bus.png test_casq test_yacht echosrv bus_example libbus.a

test: test_casq test_yacht
	./test_casq
@@ -26,20 +28,20 @@ test: test_casq test_yacht
%.png: %.dot
	dot -Tpng -o $@ $^

libcasq.a: casq.o
libbus.a: ${BUS_OBJS}
	ar -rcs $@ $^

test_casq: libcasq.a test_casq.o casq.o
	${CC} -o $@ ${LDFLAGS} $^
test_casq: test_casq.o casq.o
	${CC} -o $@ $^ ${LDFLAGS}

test_yacht: test_yacht.o yacht.o
	${CC} -o $@ ${LDFLAGS} $^
	${CC} -o $@ $^ ${LDFLAGS}

echosrv: libcasq.a ${ECHOSRV_OBJS}
	${CC} -o $@ ${LDFLAGS} $^
echosrv: ${ECHOSRV_OBJS}
	${CC} -o $@ $^ ${LDFLAGS}

bus_example: libcasq.a ${BUS_OBJS} bus_example.o
	${CC} -o $@ ${LDFLAGS} $^
bus_example: bus_example.o libbus.a
	${CC} -o $@ $^ ${LDFLAGS} -lbus

clean:
	rm -f *.a *.o test_casq echosrv bus_example