Thu, 17 Jul 2003 19:11:30 +0200
trunk: changeset 58
Cleaned up system.mk
6 | 1 | ## |
2 | ## Some make rules | |
3 | ## | |
4 | ||
5 | ###################################### | |
6 | ||
51 | 7 | ifdef MODULE |
8 | ifneq ($(STATIC_MODULES),1) | |
9 | TARGETS := $(TARGETS) $(MODULE).so | |
10 | else | |
11 | TARGETS := $(TARGETS) $(MODULE).a | |
12 | endif | |
13 | endif | |
14 | ||
15 | ||
6 | 16 | ifdef SUBDIRS |
17 | ||
18 | all: subdirs $(TARGETS) | |
19 | ||
20 | clean: subdirs-clean _clean | |
21 | ||
51 | 22 | realclean: subdirs-realclean _clean _realclean |
6 | 23 | |
24 | depend: subdirs-depend _depend | |
25 | ||
26 | else | |
27 | ||
28 | all: $(TARGETS) | |
29 | ||
30 | clean: _clean | |
31 | ||
51 | 32 | realclean: _clean _realclean |
6 | 33 | |
34 | depend: _depend | |
35 | ||
36 | endif | |
37 | ||
38 | ifdef INSTALL_SUBDIRS | |
39 | ||
40 | install: subdirs-install _install | |
41 | ||
42 | else | |
43 | ||
44 | install: _install | |
45 | ||
46 | endif | |
47 | ||
48 | ###################################### | |
49 | ||
51 | 50 | OBJS=$(subst .c,.o,$(SOURCES)) |
51 | ||
52 | ifdef MAKE_EXPORTS | |
53 | ||
54 | TO_CLEAN := $(TO_CLEAN) exports.c | |
55 | ||
56 | OBJS := $(OBJS) exports.o | |
57 | ||
58 | exports.c: $(SOURCES) | |
59 | $(PERL) $(TOPDIR)/mkexports.pl $(MAKE_EXPORTS) exports.c $(SOURCES) | |
60 | ||
61 | endif | |
62 | ||
63 | ifdef MODULE | |
64 | ||
65 | ifneq ($(STATIC_MODULES),1) | |
66 | ||
67 | $(MODULE).so: $(OBJS) $(EXT_OBJS) | |
68 | $(CC) $(CFLAGS) $(LDFLAGS) $(MODULE_LDFLAGS) $(OBJS) $(EXT_OBJS) -o $@ | |
69 | ||
70 | module_install: | |
71 | $(INSTALLDIR) $(MODULEDIR) | |
72 | $(INSTALL) -m $(BIN_MODE) $(MODULE).so $(MODULEDIR) | |
73 | # $(STRIP) $(MODULEDIR)/$(MODULE).so | |
74 | ||
75 | else | |
76 | ||
77 | $(MODULE).a: $(OBJS) | |
78 | $(AR) $(ARFLAGS) $@ $+ | |
79 | $(RANLIB) $@ | |
80 | ||
81 | module_install: | |
82 | ||
83 | endif | |
84 | ||
85 | .c.o: | |
86 | $(CC) $(CFLAGS) $(MODULE_CFLAGS) -c $< -o $@ | |
87 | ||
88 | else | |
89 | ||
6 | 90 | .c.o: |
9 | 91 | $(CC) $(CFLAGS) -c $< -o $@ |
6 | 92 | |
51 | 93 | endif |
6 | 94 | |
29 | 95 | _clean: |
51 | 96 | rm -f core $(DEPEND_FILE) $(OBJS) $(TO_CLEAN) |
6 | 97 | |
51 | 98 | _realclean: |
99 | rm -f $(TARGETS) $(TO_REALCLEAN) | |
6 | 100 | |
51 | 101 | |
102 | ifdef SOURCES | |
103 | _depend: | |
104 | $(MAKE_DEPEND) $(SOURCES) | |
29 | 105 | else |
106 | _depend: | |
107 | ||
108 | endif | |
109 | ||
6 | 110 | ###################################### |
111 | ||
112 | subdirs: | |
9 | 113 | set -e; for i in $(SUBDIRS); do $(MAKE) -C $$i; done |
6 | 114 | |
115 | subdirs-depend: | |
9 | 116 | set -e; for i in $(SUBDIRS); do $(MAKE) -C $$i depend; done |
6 | 117 | |
118 | subdirs-clean: | |
9 | 119 | set -e; for i in $(SUBDIRS); do $(MAKE) -C $$i clean; done |
6 | 120 | |
121 | subdirs-realclean: | |
9 | 122 | set -e; for i in $(SUBDIRS); do $(MAKE) -C $$i realclean; done |
6 | 123 | |
124 | subdirs-install: | |
9 | 125 | set -e; for i in $(INSTALL_SUBDIRS); do $(MAKE) -C $$i install; done |
6 | 126 | |
127 | ###################################### | |
128 | ||
129 | ifeq ($(DEPEND_FILE),$(wildcard $(DEPEND_FILE))) | |
130 | include $(DEPEND_FILE) | |
131 | endif |