From d9ab548a6cd684827afc5e8f8555c4b2a35d2aa6 Mon Sep 17 00:00:00 2001 From: Mattias Andrée Date: Tue, 12 Aug 2014 16:00:08 +0200 Subject: make it possible to compile the servers without compiling libmdsserver if you already have libmdsserver installed MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Mattias Andrée --- mk/build.mk | 29 +++++++++++++++++++++++++++++ mk/config.mk | 4 ++++ 2 files changed, 33 insertions(+) diff --git a/mk/build.mk b/mk/build.mk index 364e23e..7e2f8ac 100644 --- a/mk/build.mk +++ b/mk/build.mk @@ -13,7 +13,11 @@ servers: $(foreach S,$(SERVERS),bin/$(S)) # Link large servers. +ifneq ($(LIBMDSSERVER_IS_INSTALLED),y) bin/mds-server: $(OBJ_mds-server) obj/mds-base.o src/mds-server/*.h bin/libmdsserver.so +else +bin/mds-server: $(OBJ_mds-server) obj/mds-base.o src/mds-server/*.h +endif mkdir -p $(shell dirname $@) $(CC) $(C_FLAGS) -o $@ $(LDS) $(LDS_mds-server) $(OBJ_mds-server) obj/mds-base.o ifeq ($(DEBUG),y) @@ -22,31 +26,56 @@ ifeq ($(DEBUG),y) endif +ifneq ($(LIBMDSSERVER_IS_INSTALLED),y) bin/mds-registry: $(OBJ_mds-registry) obj/mds-base.o src/mds-registry/*.h bin/libmdsserver.so +else +bin/mds-registry: $(OBJ_mds-registry) obj/mds-base.o src/mds-registry/*.h +endif + mkdir -p $(shell dirname $@) + $(CC) $(C_FLAGS) -o $@ $(LDS) $(LDS_mds-registry) $(OBJ_mds-registry) obj/mds-base.o mkdir -p $(shell dirname $@) $(CC) $(C_FLAGS) -o $@ $(LDS) $(LDS_mds-registry) $(OBJ_mds-registry) obj/mds-base.o # Link small servers. +ifneq ($(LIBMDSSERVER_IS_INSTALLED),y) bin/%: obj/%.o obj/mds-base.o bin/libmdsserver.so +else +bin/%: obj/%.o obj/mds-base.o +endif + mkdir -p $(shell dirname $@) + $(CC) $(C_FLAGS) -o $@ $(LDS) $(LDS_$*) $< obj/mds-base.o mkdir -p $(shell dirname $@) $(CC) $(C_FLAGS) -o $@ $(LDS) $(LDS_$*) $< obj/mds-base.o # Link kernel. +ifneq ($(LIBMDSSERVER_IS_INSTALLED),y) bin/mds: obj/mds.o bin/libmdsserver.so +else +bin/mds: obj/mds.o +endif + mkdir -p $(shell dirname $@) + $(CC) $(C_FLAGS) -o $@ $(LDS) $(LDS_mds) $< mkdir -p $(shell dirname $@) $(CC) $(C_FLAGS) -o $@ $(LDS) $(LDS_mds) $< # Build object files for kernel/servers. +ifneq ($(LIBMDSSERVER_IS_INSTALLED),y) obj/%.o: src/%.c $(shell dirname src/%)/*.h src/mds-base.h src/libmdsserver/*.h mkdir -p $(shell dirname $@) $(CC) $(C_FLAGS) -Isrc -c -o $@ $< +else +obj/%.o: src/%.c $(shell dirname src/%)/*.h src/mds-base.h + mkdir -p $(shell dirname $@) + $(CC) $(C_FLAGS) -c -o $@ $< +endif + # Build libmdsserver. diff --git a/mk/config.mk b/mk/config.mk index 25e50b8..f33f469 100644 --- a/mk/config.mk +++ b/mk/config.mk @@ -53,7 +53,11 @@ WARN = -Wall -Wextra -pedantic -Wdouble-promotion -Wformat=2 -Winit-self \ STD = gnu99 # Libraries linking flags. +ifneq ($(LIBMDSSERVER_IS_INSTALLED),y) LDS = -pthread -Lbin -lmdsserver -lrt +else +LDS = -pthread -lmdsserver -lrt +endif # C compiler debug flags. DEBUG_FLAGS = -- cgit v1.2.3-70-g09d2