|
1 ## |
|
2 ## Some make rules |
|
3 ## |
|
4 |
|
5 DEPEND_FILE=.depend |
|
6 |
|
7 ###################################### |
|
8 |
|
9 ifdef SUBDIRS |
|
10 |
|
11 all: subdirs $(TARGETS) |
|
12 |
|
13 clean: subdirs-clean _clean |
|
14 |
|
15 realclean: subdirs-realclean _realclean |
|
16 |
|
17 depend: subdirs-depend _depend |
|
18 |
|
19 else |
|
20 |
|
21 all: $(TARGETS) |
|
22 |
|
23 clean: _clean |
|
24 |
|
25 realclean: _realclean |
|
26 |
|
27 depend: _depend |
|
28 |
|
29 endif |
|
30 |
|
31 ifdef INSTALL_SUBDIRS |
|
32 |
|
33 install: subdirs-install _install |
|
34 |
|
35 else |
|
36 |
|
37 install: _install |
|
38 |
|
39 endif |
|
40 |
|
41 ###################################### |
|
42 |
|
43 .c.o: |
|
44 $(CC) $(CC_FLAGS) -c $< -o $@ |
|
45 |
|
46 _clean: |
|
47 rm -f core $(OBJS) $(DEPEND_FILE) |
|
48 |
|
49 _realclean: _clean |
|
50 rm -f $(TARGETS) |
|
51 |
|
52 _depend: |
|
53 $(CC) -M $(CC_FLAGS) *.c > $(DEPEND_FILE) |
|
54 |
|
55 ###################################### |
|
56 |
|
57 subdirs: |
|
58 set -e; for i in $$(SUBDIRS); do $(MAKE) -C $$i; done |
|
59 |
|
60 subdirs-depend: |
|
61 set -e; for i in $$(SUBDIRS); do $(MAKE) -C $$i depend; done |
|
62 |
|
63 subdirs-clean: |
|
64 set -e; for i in $$(SUBDIRS); do $(MAKE) -C $$i clean; done |
|
65 |
|
66 subdirs-realclean: |
|
67 set -e; for i in $$(SUBDIRS); do $(MAKE) -C $$i realclean; done |
|
68 |
|
69 subdirs-install: |
|
70 set -e; for i in $$(INSTALL_SUBDIRS); do $(MAKE) -C $$i install; done |
|
71 |
|
72 ###################################### |
|
73 |
|
74 ifeq ($(DEPEND_FILE),$(wildcard $(DEPEND_FILE))) |
|
75 include $(DEPEND_FILE) |
|
76 endif |