1 # GLOBAL Makefile for all packages
3 # DO NOT EDIT -- Automatically generated by Adam's configuration system!!!
6 IGNORE_OBJDIR_TARGETS := up update diff
9 include $(L4DIR)/mk/Makeconf
11 BID_STATE_FILE = $(OBJ_BASE)/pkg/BUILD.state
14 ALL_SUBDIRS = $(shell find -L . -maxdepth 1 -type d ! -name .svn -printf %P' ')
17 ALL_SUBDIRS := $(shell echo $(S) | tr ':,' ' ')
21 BROKEN_SUBDIRS = $(patsubst %/broken, %, \
22 $(wildcard $(addsuffix /broken,$(ALL_SUBDIRS))))
23 # the obsolete packages
24 OBSOLETE_SUBDIRS = $(patsubst %/obsolete, %, \
25 $(wildcard $(addsuffix /obsolete,$(ALL_SUBDIRS))))
26 # and the packages we are supposed to build
27 BUILD_SUBDIRS = $(filter-out $(BROKEN_SUBDIRS) $(OBSOLETE_SUBDIRS), \
30 # force that every package to be built has a Control and Makefile
31 ifneq ($(addsuffix /Makefile,$(BUILD_SUBDIRS)),$(wildcard $(addsuffix /Makefile,$(BUILD_SUBDIRS))))
32 $(error Missing Makefile files: $(filter-out $(wildcard $(addsuffix /Makefile,$(BUILD_SUBDIRS))), $(addsuffix /Makefile,$(BUILD_SUBDIRS))))
35 ifneq ($(addsuffix /Control,$(BUILD_SUBDIRS)),$(wildcard $(addsuffix /Control,$(BUILD_SUBDIRS))))
36 $(error Missing Control files: $(filter-out $(wildcard $(addsuffix /Control,$(BUILD_SUBDIRS))), $(addsuffix /Control,$(BUILD_SUBDIRS))))
42 # We start with cont-checking, as this requires special treatment
43 ifeq ($(filter cont,$(MAKECMDGOALS)),)
46 # default make action is "all" - build all packages
48 # We build all l4env headers (idl+includes), then all l4env libs, then the
49 # l4env servers and examples. Then we build the other headers
50 # (idl+includes), the other libs, the other servers and examples. We use
51 # dependencies for this, witch might allow parallel build processes.
54 all:: $(BUILD_SUBDIRS)
56 examples: $(filter-out examples,$(BUILD_SUBDIRS))
60 -include $(BID_STATE_FILE)
62 $(VERBOSE)$(RM) $(BID_STATE_FILE)
63 BID_SAFE_STATE= @echo 'BID_STATE_DONE+=$@'>>$(BID_STATE_FILE)
65 .PHONY: all BID_cont_reset cont bin lib headers idl include doc ptest
68 DOC_MESSAGE =echo "=== Creating documentation for package \"$(1)\" ==="
69 PKG_MESSAGE =echo "=== Building package \"$(basename $@)\" ==="
70 INST_MESSAGE =echo "=== Installing Package \"$(1)\" ==="
71 PURGE_INC_MESSAGE =echo "=== Purging pending links in $(L4DIR)/include ==="
72 PURGE_LIB_MESSAGE =echo "=== Purging pending links in $(L4DIR)/lib ==="
73 UPDATE_MESSAGE =echo -e $(EMPHSTART)"=== Updating \"$(1)\" ==="$(EMPHSTOP)
74 DIFF_MESSAGE =echo -e $(EMPHSTART)"=== Diffing \"$(1)\" ==="$(EMPHSTOP)
75 PTEST_MESSAGE =echo "=== Testing Package \"$(1)\" ==="
78 ALIASES_DIRS = $(L4DIR)/mk/aliases.d \
79 $(wildcard $(OBJ_BASE)/aliases.d)
81 PKGDEPS_CMD = $(L4DIR)/mk/pkgdeps \
82 -P $(OBJ_BASE)/pc $(addprefix -A ,$(ALIASES_DIRS))
86 $(VERBOSE)mkdir -p $(OBJ_BASE)/pc
88 # deps on disappearing aliases.d-files are not handled...
89 $(OBJ_BASE)/pkg/.Package.deps: $(L4DIR)/mk/pkgdeps \
90 $(if $(filter update up,$(MAKECMDGOALS)),Makefile) \
91 $(wildcard $(foreach d,$(ALIASES_DIRS),$(d)/*)) \
93 $(wildcard $(foreach d,$(BUILD_SUBDIRS),$(d)/Control))
94 $(VERBOSE)mkdir -p $(dir $@)
95 $(VERBOSE)if $(PKGDEPS_CMD) \
96 generate $(L4DIR)/pkg > $@.tmp; then \
97 mv $@.tmp $@; else $(RM) $@.tmp; exit 1; fi
99 include $(OBJ_BASE)/pkg/.Package.deps
102 $(BUILD_SUBDIRS):%:%/Makefile BID_cont_reset
104 $(VERBOSE)PWD=$(PWD)/$(basename $@) $(MAKE) -C $(basename $@) all
105 $(VERBOSE)$(BID_SAFE_STATE)
108 $(VERBOSE)set -e; for i in $(BUILD_SUBDIRS); do \
109 $(call INST_MESSAGE,$(BID_DOLLARQUOTE)$$i); \
110 PWD=$(PWD)/$$i $(MAKE) -C $$i $@; \
114 $(VERBOSE)set -e; for i in $(BUILD_SUBDIRS); do \
115 if [ -e $(PWD)/$$i/doc ]; then \
116 $(call DOC_MESSAGE,$(BID_DOLLARQUOTE)$$i); \
117 PWD=$(PWD)/$$i $(MAKE) -C $$i $@; \
121 # Check package dependencies.
122 # CHECK_PKGS: if undefined, check all packages,
123 # otherwise gives a list of space separated packages to check
124 # CHECK_FULL: if set rebuild for every new package check
125 # (ccache recommended when using this flag)
128 $(RM) -r $(filter-out $(OBJ_BASE)/pkg/Makefile, \
129 $(wildcard $(OBJ_BASE)/pkg/*)); \
130 for checkpkg in $(filter-out $(CHECK_GOOD),$(if $(CHECK_PKGS),$(CHECK_PKGS),$(BUILD_SUBDIRS))); do \
131 echo ==========================================================; \
132 echo "Deleting all pkgs in build-dir"; \
133 $(RM) -r $(OBJ_BASE)/lib $(OBJ_BASE)/bin $(OBJ_BASE)/include \
135 $(if $(CHECK_FULL),$(RM) -r $(OBJ_BASE)/pkg;,) \
137 echo ----------------------------------------------------------; \
138 echo "Trying standalone build of '$$checkpkg'"; \
139 echo $(MAKE) O=$(OBJ_BASE) --no-print-directory $$checkpkg; \
140 $(MAKE) O=$(OBJ_BASE) --no-print-directory $$checkpkg \
141 || (echo "Failed package: $$checkpkg"; \
142 echo "Good package(s): CHECK_GOOD=\"$(CHECK_GOOD) $$PKGDONE\"";\
144 PKGDONE="$$PKGDONE $$checkpkg"; \
146 echo "Packages tested: $(CHECK_GOOD) $$PKGDONE"
148 depgraph: depsrcgraph depobjgraph
149 depsrcgraph: $(PKGDIR_OBJ)/depsrc.svg $(PKGDIR_OBJ)/depsrc.ps $(PKGDIR_OBJ)/depsrc.reduced.svg $(PKGDIR_OBJ)/depsrc.reduced.ps
150 depobjgraph: $(PKGDIR_OBJ)/depobj.svg $(PKGDIR_OBJ)/depobj.ps $(PKGDIR_OBJ)/depobj.reduced.svg $(PKGDIR_OBJ)/depobj.reduced.ps
154 $(VERBOSE)dot -Tps -o $@ $<
158 $(VERBOSE)dot -Tsvg -o $@ $<
162 $(VERBOSE)tred $< > $@
164 $(PKGDIR_OBJ)/depsrc.dot: FORCE
166 $(VERBOSE)$(PKGDEPS_CMD) dot $(L4DIR)/pkg > $@
168 $(PKGDIR_OBJ)/depobj.dot: FORCE
170 $(VERBOSE)$(L4DIR)/tool/bin/pkgdepsobj $(L4DIR_ABS) $(OBJ_BASE) $@
174 for d in $(BUILD_SUBDIRS); do \
175 if [ -n "$$(find $$d -type d -name $@)" ]; then \
176 $(call PTEST_MESSAGE,$(BID_DOLLARQUOTE)$$d); \
177 PWD=$(PWD)/$$d $(MAKE) -C $$d $@; \
187 .PHONY: TAGS tags depsrcgraph depobjgraph depgraph depcheck
188 .PHONY: $(foreach ext, .bin .lib .include .idl .headers,addsuffix $(ext), $(BUILD_SUBDIRS))
190 clean cleanall:: BID_cont_reset
192 $(VERBOSE)$(RM) $(UPDATE_LOG)
193 $(VERBOSE)for i in $(BUILD_SUBDIRS) $(OBSOLETE_SUBDIRS); do \
194 echo "=== Cleaning in package \"$$i\" ==="; \
195 if [ -r $$i/Makefile ] ; then PWD=$(PWD)/$$i $(MAKE) -C $$i $@; fi ; \
197 $(VERBOSE)$(MAKE) rm-old-links
200 $(VERBOSE)rm -i `find . -name "*~"` `find . -name "#*#"`
203 @$(PURGE_INC_MESSAGE)
204 $(VERBOSE)test ! -d $(L4DIR)/include || \
205 find $(L4DIR)/include -type l -a ! -xtype f -a ! -xtype d \
206 -exec rm $(if $(VERBOSE),,-v) '{}' ';'
207 @$(PURGE_LIB_MESSAGE)
208 $(VERBOSE)test ! -d $(L4DIR)/lib || \
209 find $(L4DIR)/lib -type l -a ! -xtype f -a ! -xtype d \
210 -exec rm $(if $(VERBOSE),,-v) '{}' ';'
213 # Update Makefile on update.
214 ifneq ($(filter update up,$(MAKECMDGOALS)),)
217 $(SVN) up $@ 2>&1 | tee -a $(UPDATE_LOG)
220 UPDATE_LOG = $(call absfilename, $(L4DIR)/pkg/update.log)
223 $(VERBOSE)$(RM) $(UPDATE_LOG)
225 update up: update.log
226 $(VERBOSE)$(call UPDATE_MESSAGE,Packages)
228 $(SVN) update $(ALL_SUBDIRS) 2>&1 | tee -a $(UPDATE_LOG)
232 .PHONY: install clean cleanall kernels
236 @echo $(BUILD_SUBDIRS)
237 @echo obsolete: $(OBSOLETE_SUBDIRS)
238 @echo broken: $(BROKEN_SUBDIRS)
241 @echo "Specify one of the following targets:"
242 @echo "all - build the packages neither broken nor obsolete"
243 @echo " Use make S=dir1:dir2:..: to build those directories"
244 @echo "cont - after correcting errors, continue where \"make all\" failed"
245 @echo "<pkgname> - Build package and all its dependencies"
246 # @echo "doc - build documentation (not build per default)"
247 @echo "install - install the packages, use only after making all!"
249 @echo "clean - clean the packages"
250 @echo "cleanall - clean the packages pedanticly"
251 @echo "del-backup - remove temporary file in this tree"
252 @echo "print-subdirs - print the SUBDIRS which are subject to build"
253 @echo "BID_cont_reset - reset the state used by the \"cont\" target"
254 @echo 'rm-old-links - remove invalid symlinks in $$(L4DIR)/lib, $$(L4DIR)/include'
255 @echo "update - update the packages currently checked out"
256 @echo "help - this help"
258 #####################
259 # cont handling: "cont" is in the target list
261 -include $(BID_STATE_FILE)
263 $(VERBOSE)$(MAKE) $(addprefix -o ,BID_cont_reset $(BID_STATE_DONE)) \
264 $(filter-out cont,$(MAKECMDGOALS))
266 # eat up the other targets