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 | ARCHS:=$(ARCHS:%=%.dummy) |
---|
9 | |
---|
10 | # -------------------------------------------------------------------------------- |
---|
11 | # warnings in this subtree? |
---|
12 | |
---|
13 | RAISE_WARNINGS=1 |
---|
14 | |
---|
15 | ifeq ($(RAISE_WARNINGS),0) |
---|
16 | cflags:=$(cflags:-W -Wall=-w) |
---|
17 | endif |
---|
18 | |
---|
19 | include $(ARBHOME)/SOURCE_TOOLS/export2sub |
---|
20 | |
---|
21 | # -------------------------------------------------------------------------------- |
---|
22 | |
---|
23 | nosuchtarget: |
---|
24 | false |
---|
25 | |
---|
26 | depends: $(ARCHS:.dummy=.depend) |
---|
27 | |
---|
28 | clean: $(ARCHS:.dummy=.clean) |
---|
29 | |
---|
30 | proto: TREEDISP/TREEDISP.proto \ |
---|
31 | INSDEL/INSDEL.proto \ |
---|
32 | |
---|
33 | %.depend: |
---|
34 | @cp -p $(@D)/Makefile $(@D)/Makefile.old # save old Makefile |
---|
35 | @$(MAKE) -C $(@D) -r depends |
---|
36 | @grep "^# DO NOT DELETE" $(@D)/Makefile >/dev/null # check whether sub Makefile has dependencies |
---|
37 | @cat $(@D)/Makefile \ |
---|
38 | | ../SOURCE_TOOLS/fix_depends.pl "(from SL)" \ |
---|
39 | >$(@D)/Makefile.2 |
---|
40 | @mv $(@D)/Makefile.old $(@D)/Makefile # restore old Makefile |
---|
41 | @$(ARBHOME)/SOURCE_TOOLS/mv_if_diff $(@D)/Makefile.2 $(@D)/Makefile # update Makefile if changed |
---|
42 | |
---|
43 | %.dummy: |
---|
44 | @(($(MAKE) -C $(@D) -r \ |
---|
45 | "ARB = yes" \ |
---|
46 | "MAIN = $(@F:.dummy=.a)" \ |
---|
47 | "cflags = $(cflags) -DIN_ARB_$(@D:/=)" \ |
---|
48 | >$(@D).log 2>&1 && (cat $(@D).log;rm $(@D).log)) || (cat $(@D).log;rm $(@D).log;false)) |
---|
49 | |
---|
50 | # the logging through files is done to avoid that the output of parallel calls gets mixed up (make -j..) |
---|
51 | |
---|
52 | %.clean: |
---|
53 | @$(MAKE) -C $(@D) \ |
---|
54 | clean |
---|
55 | |
---|
56 | %.proto: |
---|
57 | @$(MAKE) -C $(@D) \ |
---|
58 | proto |
---|
59 | |
---|
60 | |
---|
61 | # DO NOT DELETE |
---|
62 | |
---|
63 | # Do not add dependencies manually - use 'make depend' in $ARBHOME |
---|
64 | # For formatting issues see SOURCE_TOOLS/fix_depends.pl (from main) |
---|