From eb499eb8ecf74a6c461f8ce3ee4fa482ed2a3c16 Mon Sep 17 00:00:00 2001 From: Mattias Andrée Date: Mon, 28 Jul 2014 21:38:18 +0200 Subject: move mk files into mk dir MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Mattias Andrée --- mk/build.mk | 60 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 60 insertions(+) create mode 100644 mk/build.mk (limited to 'mk/build.mk') diff --git a/mk/build.mk b/mk/build.mk new file mode 100644 index 0000000..e8bbd0e --- /dev/null +++ b/mk/build.mk @@ -0,0 +1,60 @@ +# Copying and distribution of this file, with or without modification, +# are permitted in any medium without royalty provided the copyright +# notice and this notice are preserved. This file is offered as-is, +# without any warranty. + + +.PHONY: libraries +libraries: bin/libmdsserver.so + +.PHONY: servers +servers: $(foreach S,$(SERVERS),bin/$(S)) + + +# Link large servers. + +bin/mds-server: $(OBJ_mds-server) obj/mds-base.o bin/libmdsserver.so + mkdir -p $(shell dirname $@) + $(CC) $(C_FLAGS) -o $@ $(LDS) $(LDS_mds-server) $(OBJ_mds-server) obj/mds-base.o +ifeq ($(DEBUG),y) + mv $@ $@.real + cp test.d/mds-server $@ +endif + + +bin/mds-registry: $(OBJ_mds-registry) obj/mds-base.o bin/libmdsserver.so + mkdir -p $(shell dirname $@) + $(CC) $(C_FLAGS) -o $@ $(LDS) $(LDS_mds-registry) $(OBJ_mds-registry) obj/mds-base.o + + +# Link small servers. + +bin/%: obj/%.o obj/mds-base.o bin/libmdsserver.so + mkdir -p $(shell dirname $@) + $(CC) $(C_FLAGS) -o $@ $(LDS) $(LDS_$*) $< obj/mds-base.o + + +# Link kernel. + +bin/mds: obj/mds.o bin/libmdsserver.so + mkdir -p $(shell dirname $@) + $(CC) $(C_FLAGS) -o $@ $(LDS) $(LDS_mds) $< + + +# Build object files for kernel/servers. + +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 $@ $< + + +# Build libmdsserver. + +bin/libmdsserver.so: $(foreach O,$(LIBOBJ),obj/libmdsserver/$(O).o) + mkdir -p $(shell dirname $@) + $(CC) $(C_FLAGS) -shared -o $@ $^ + +obj/libmdsserver/%.o: src/libmdsserver/%.c src/libmdsserver/*.h + mkdir -p $(shell dirname $@) + $(CC) $(C_FLAGS) -fPIC -c -o $@ $< + -- cgit v1.2.3-70-g09d2