aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--mk/build.mk29
-rw-r--r--mk/config.mk4
2 files changed, 33 insertions, 0 deletions
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 =