1 | # -------------------------------------------------------------------------------- |
---|
2 | # see README for "Howto add a new library" |
---|
3 | |
---|
4 | # automatically handles all subdirectories |
---|
5 | ARCHS:=$(shell find . -maxdepth 1 -type d)# find all direct sub-directories |
---|
6 | ARCHS:=$(sort $(filter-out . .svn,$(subst ./,,$(ARCHS))))# remove prefix './' and get rid of '.' and '.svn' |
---|
7 | ARCHS:=$(shell echo $(ARCHS) | perl -pn -e 's/([A-Za-z0-9_]+)/\1\/\1/g;')# replace not possible $(patsubst %,%/%,$(ARCHS)) |
---|
8 | |
---|
9 | # when you attempt to remove a subdir of SL, make will fail on targets 'depends', 'clean' and 'proto' |
---|
10 | # next line manually excludes the removed subdir (which is still present in WC until commit) |
---|
11 | ARCHS:=$(subst ROOTED_TREE/ROOTED_TREE,,$(ARCHS)) |
---|
12 | |
---|
13 | ARCHS:=$(ARCHS:%=%.dummy) |
---|
14 | |
---|
15 | # -------------------------------------------------------------------------------- |
---|
16 | # warnings in this subtree? |
---|
17 | |
---|
18 | RAISE_WARNINGS=1# raise warnings in this subtree? |
---|
19 | |
---|
20 | ifeq ($(RAISE_WARNINGS),0) |
---|
21 | cflags:=$(cflags:-W -Wall=-w) |
---|
22 | $(warning Warning: All compiler warnings were disabled in subtree SL. Doing so is not recommended!) |
---|
23 | endif |
---|
24 | |
---|
25 | include $(ARBHOME)/SOURCE_TOOLS/export2sub |
---|
26 | |
---|
27 | # -------------------------------------------------------------------------------- |
---|
28 | |
---|
29 | nosuchtarget: |
---|
30 | false |
---|
31 | |
---|
32 | depends: $(ARCHS:.dummy=.depend) |
---|
33 | |
---|
34 | clean: $(ARCHS:.dummy=.clean) |
---|
35 | |
---|
36 | proto: TREEDISP/TREEDISP.proto \ |
---|
37 | INSDEL/INSDEL.proto \ |
---|
38 | |
---|
39 | %.depend: |
---|
40 | @cp -p $(@D)/Makefile $(@D)/Makefile.old # save old Makefile |
---|
41 | @$(MAKE) -C $(@D) -r depends |
---|
42 | @grep "^# DO NOT DELETE" $(@D)/Makefile >/dev/null # check whether sub Makefile has dependencies |
---|
43 | @cat $(@D)/Makefile \ |
---|
44 | | ../SOURCE_TOOLS/fix_depends.pl "(from SL)" \ |
---|
45 | >$(@D)/Makefile.2 |
---|
46 | @mv $(@D)/Makefile.old $(@D)/Makefile # restore old Makefile |
---|
47 | @$(ARBHOME)/SOURCE_TOOLS/mv_if_diff $(@D)/Makefile.2 $(@D)/Makefile # update Makefile if changed |
---|
48 | |
---|
49 | %.dummy: |
---|
50 | @(($(MAKE) -C $(@D) -r \ |
---|
51 | "ARB = yes" \ |
---|
52 | "MAIN = $(@F:.dummy=.a)" \ |
---|
53 | "cflags = $(cflags) -DIN_ARB_$(@D:/=)" \ |
---|
54 | >$(@D).log 2>&1 && (cat $(@D).log;rm $(@D).log)) || (cat $(@D).log;rm $(@D).log;false)) |
---|
55 | |
---|
56 | # the logging through files is done to avoid that the output of parallel calls gets mixed up (make -j..) |
---|
57 | |
---|
58 | %.clean: |
---|
59 | @$(MAKE) -C $(@D) \ |
---|
60 | clean |
---|
61 | |
---|
62 | %.proto: |
---|
63 | @$(MAKE) -C $(@D) \ |
---|
64 | proto |
---|
65 | |
---|
66 | |
---|
67 | # DO NOT DELETE |
---|
68 | |
---|
69 | # Do not add dependencies manually - use 'make depend' in $ARBHOME |
---|
70 | # For formatting issues see SOURCE_TOOLS/fix_depends.pl (from main) |
---|