source: branches/stable/SL/Makefile

Last change on this file was 13625, checked in by westram, 9 years ago
  • Property svn:eol-style set to native
  • Property svn:keywords set to Author Date Id Revision
File size: 2.2 KB
Line 
1# --------------------------------------------------------------------------------
2# see README for "Howto add a new library"
3
4# automatically handles all subdirectories
5ARCHS:=$(shell find . -maxdepth 1 -type d)# find all direct sub-directories
6ARCHS:=$(sort $(filter-out . .svn,$(subst ./,,$(ARCHS))))# remove prefix './' and get rid of '.' and '.svn'
7ARCHS:=$(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)
11ARCHS:=$(subst ROOTED_TREE/ROOTED_TREE,,$(ARCHS))
12
13ARCHS:=$(ARCHS:%=%.dummy)
14
15# --------------------------------------------------------------------------------
16# warnings in this subtree?
17
18RAISE_WARNINGS=1
19
20ifeq ($(RAISE_WARNINGS),0)
21cflags:=$(cflags:-W -Wall=-w)
22endif
23
24include $(ARBHOME)/SOURCE_TOOLS/export2sub
25
26# --------------------------------------------------------------------------------
27
28nosuchtarget:
29        false
30
31depends: $(ARCHS:.dummy=.depend)
32
33clean: $(ARCHS:.dummy=.clean)
34
35proto:  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)
Note: See TracBrowser for help on using the repository browser.