rules.mk

Thu, 17 Jul 2003 19:11:30 +0200

author
tuomov
date
Thu, 17 Jul 2003 19:11:30 +0200
changeset 54
2795b5fb21df
parent 51
2d95d77aa954
child 82
895f6304179d
permissions
-rw-r--r--

trunk: changeset 58
Cleaned up system.mk

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

mercurial