1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
|
# 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.
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)
mv $@ $@.real
cp test.d/mds-server $@
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.
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 $@ $<
|