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