1 # GLOBAL Makefile for all packages
3 # DO NOT EDIT -- Automatically generated by Adam's configuration system!!!
6 IGNORE_OBJDIR_TARGETS := up update
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 PTEST_MESSAGE =echo "=== Testing Package \"$(1)\" ==="
77 ALIASES_DIRS = $(L4DIR)/mk/aliases.d \
78 $(wildcard $(OBJ_BASE)/aliases.d)
80 PKGDEPS_CMD = $(L4DIR)/mk/pkgdeps \
81 -P $(OBJ_BASE)/pc $(addprefix -A ,$(ALIASES_DIRS))
85 $(VERBOSE)mkdir -p $(OBJ_BASE)/pc
87 # deps on disappearing aliases.d-files are not handled...
88 $(OBJ_BASE)/pkg/.Package.deps: $(L4DIR)/mk/pkgdeps Makefile \
89 $(wildcard $(foreach d,$(ALIASES_DIRS),$(d)/*)) \
91 $(wildcard $(foreach d,$(BUILD_SUBDIRS),$(d)/Control))
92 $(VERBOSE)mkdir -p $(dir $@)
93 $(VERBOSE)if $(PKGDEPS_CMD) \
94 generate $(L4DIR)/pkg > $@.tmp; then \
95 mv $@.tmp $@; else $(RM) $@.tmp; exit 1; fi
97 include $(OBJ_BASE)/pkg/.Package.deps
100 $(BUILD_SUBDIRS):%:%/Makefile BID_cont_reset
102 $(VERBOSE)PWD=$(PWD)/$(basename $@) $(MAKE) -C $(basename $@) all
103 $(VERBOSE)$(BID_SAFE_STATE)
106 $(VERBOSE)set -e; for i in $(BUILD_SUBDIRS); do \
107 $(call INST_MESSAGE,$(BID_DOLLARQUOTE)$$i); \
108 PWD=$(PWD)/$$i $(MAKE) -C $$i $@; \
112 $(VERBOSE)set -e; for i in $(BUILD_SUBDIRS); do \
113 if [ -e $(PWD)/$$i/doc ]; then \
114 $(call DOC_MESSAGE,$(BID_DOLLARQUOTE)$$i); \
115 PWD=$(PWD)/$$i $(MAKE) -C $$i $@; \
119 # Check package dependencies.
120 # CHECK_PKGS: if undefined, check all packages,
121 # otherwise gives a list of space separated packages to check
122 # CHECK_FULL: if set rebuild for every new package check
123 # (ccache recommended when using this flag)
126 $(RM) -r $(OBJ_BASE)/pkg; \
127 for checkpkg in $(filter-out $(CHECK_GOOD),$(if $(CHECK_PKGS),$(CHECK_PKGS),$(BUILD_SUBDIRS))); do \
128 echo ==========================================================; \
129 echo "Deleting all pkgs in build-dir"; \
130 $(RM) -r $(OBJ_BASE)/lib $(OBJ_BASE)/bin $(OBJ_BASE)/include \
132 $(if $(CHECK_FULL),$(RM) -r $(OBJ_BASE)/pkg;,) \
134 echo ----------------------------------------------------------; \
135 echo "Trying standalone build of '$$checkpkg'"; \
136 echo $(MAKE) O=$(OBJ_BASE) --no-print-directory $$checkpkg; \
137 $(MAKE) O=$(OBJ_BASE) --no-print-directory $$checkpkg \
138 || (echo "Failed package: $$checkpkg"; \
139 echo "Good package(s): CHECK_GOOD=\"$(CHECK_GOOD) $$PKGDONE\"";\
141 PKGDONE="$$PKGDONE $$checkpkg"; \
143 echo "Packages tested: $(CHECK_GOOD) $$PKGDONE"
145 depgraph: depsrcgraph depobjgraph
146 depsrcgraph: $(PKGDIR_OBJ)/depsrc.svg $(PKGDIR_OBJ)/depsrc.ps $(PKGDIR_OBJ)/depsrc.reduced.svg $(PKGDIR_OBJ)/depsrc.reduced.ps
147 depobjgraph: $(PKGDIR_OBJ)/depobj.svg $(PKGDIR_OBJ)/depobj.ps $(PKGDIR_OBJ)/depobj.reduced.svg $(PKGDIR_OBJ)/depobj.reduced.ps
151 $(VERBOSE)dot -Tps -o $@ $<
155 $(VERBOSE)dot -Tsvg -o $@ $<
159 $(VERBOSE)tred $< > $@
161 $(PKGDIR_OBJ)/depsrc.dot: FORCE
163 $(VERBOSE)$(PKGDEPS_CMD) dot $(L4DIR)/pkg > $@
165 $(PKGDIR_OBJ)/depobj.dot: FORCE
167 $(VERBOSE)$(L4DIR)/tool/bin/pkgdepsobj $(L4DIR_ABS) $(OBJ_BASE) $@
171 for d in $(BUILD_SUBDIRS); do \
172 if [ -n "$$(find $$d -type d -name $@)" ]; then \
173 $(call PTEST_MESSAGE,$(BID_DOLLARQUOTE)$$d); \
174 PWD=$(PWD)/$$d $(MAKE) -C $$d $@; \
184 .PHONY: TAGS tags depsrcgraph depobjgraph depgraph
185 .PHONY: $(foreach ext, .bin .lib .include .idl .headers,addsuffix $(ext), $(BUILD_SUBDIRS))
187 clean cleanall:: BID_cont_reset
189 $(VERBOSE)$(RM) $(UPDATE_LOG)
190 $(VERBOSE)for i in $(BUILD_SUBDIRS) $(OBSOLETE_SUBDIRS); do \
191 echo "=== Cleaning in package \"$$i\" ==="; \
192 if [ -r $$i/Makefile ] ; then PWD=$(PWD)/$$i $(MAKE) -C $$i $@; fi ; \
194 $(VERBOSE)$(MAKE) rm-old-links
197 $(VERBOSE)rm -i `find . -name "*~"` `find . -name "#*#"`
200 @$(PURGE_INC_MESSAGE)
201 $(VERBOSE)test ! -d $(L4DIR)/include || \
202 find $(L4DIR)/include -type l -a ! -xtype f -a ! -xtype d \
203 -exec rm $(if $(VERBOSE),,-v) '{}' ';'
204 @$(PURGE_LIB_MESSAGE)
205 $(VERBOSE)test ! -d $(L4DIR)/lib || \
206 find $(L4DIR)/lib -type l -a ! -xtype f -a ! -xtype d \
207 -exec rm $(if $(VERBOSE),,-v) '{}' ';'
210 # Update Makefile on update.
211 ifneq ($(filter update up,$(MAKECMDGOALS)),)
214 $(SVN) up $@ 2>&1 | tee -a $(UPDATE_LOG)
217 UPDATE_LOG = $(call absfilename, $(L4DIR)/pkg/update.log)
220 $(VERBOSE)$(RM) $(UPDATE_LOG)
222 update up: update.log
223 $(VERBOSE)$(call UPDATE_MESSAGE,Packages)
225 $(SVN) update $(sort $(patsubst %/.svn,%,$(wildcard $(addsuffix /.svn,$(ALL_SUBDIRS))))) 2>&1 | tee -a $(UPDATE_LOG)
227 #dice_update: update.log
228 # $(VERBOSE)if [ -d $(DICE_SRCDIR) ] ; then \
229 # $(call UPDATE_MESSAGE,$(DICE_SRCDIR)); \
230 # cd $(DICE_SRCDIR) && $(SVN) update 2>&1 | tee -a $(UPDATE_LOG); \
233 tools_update: update.log
234 $(VERBOSE)if [ -d $(L4DIR)/tool/gen_dopecode ]; then \
235 $(call UPDATE_MESSAGE,l4/tool/gen_dopecode); \
237 $(SVN) update tool/gen_dopecode 2>&1 | tee -a $(UPDATE_LOG); \
239 @$(call UPDATE_MESSAGE,l4/tool/gendep)
240 $(VERBOSE)cd $(L4DIR) && \
241 $(SVN) update tool/gendep 2>&1 | tee -a $(UPDATE_LOG)
242 @$(call UPDATE_MESSAGE,l4/tool/bin)
243 $(VERBOSE)cd $(L4DIR) && \
244 $(SVN) update tool/bin 2>&1 | tee -a $(UPDATE_LOG)
246 l4conf_update: update.log
247 @$(call UPDATE_MESSAGE,l4/Make{confs/files})
249 $(SVN) update Makefile 2>&1 | tee -a $(UPDATE_LOG)
250 @$(call UPDATE_MESSAGE,l4/mk/)
251 $(VERBOSE)cd ../mk && \
252 $(SVN) update 2>&1 | tee -a $(UPDATE_LOG)
255 @for i in $(BUILD_SUBDIRS); do \
256 if [ -f $$i/server/src/Makefile ]; then \
257 echo "=== Building \"$$i\" relocatable ==="; \
258 PWD=$(PWD)/$$i/server/src $(MAKE) -C $$i/server/src reloc;\
260 echo "( Package \"$$i\" has no server/src dir )"; \
265 @for i in $(BUILD_SUBDIRS); do \
266 if [ -f $$i/server/Makefile ]; then \
267 echo "=== Re-linking \"$$i\" server ==="; \
268 PWD=$(PWD)/$$i/server $(MAKE) -C $$i/server relink; \
270 echo "( Package \"$$i\" has no server dir )"; \
272 if [ -f $$i/examples/Makefile ]; then \
273 echo "=== Re-linking \"$$i\" examples ==="; \
274 PWD=$(PWD)/$$i/examples $(MAKE) -C $$i/examples relink; \
276 echo "( Package \"$$i\" has no examples dir )"; \
282 .PHONY: install clean cleanall kernels
286 $(VERBOSE)$(ECHO) "Packages using l4_utcb():"
287 $(VERBOSE)for p in $(BUILD_SUBDIRS); do \
288 x=$$(find $$p ! -path '*/.svn/*' -type f | xargs grep -w l4_utcb); \
289 if [ -n "$$x" ]; then \
296 @echo $(BUILD_SUBDIRS)
297 @echo obsolete: $(OBSOLETE_SUBDIRS)
298 @echo broken: $(BROKEN_SUBDIRS)
301 @echo "Specify one of the following targets:"
302 @echo "all - build the packages neither broken nor obsolete"
303 @echo "cont - after correcting errors, continue where \"make all\" failed"
304 @echo "doc - build documentation (not build per default)"
305 @echo "install - install the packages, use only after making all!"
307 @echo "clean - clean the packages"
308 @echo "cleanall - clean the packages pedanticly"
309 @echo "del-backup - remove temporary file in this tree"
310 # @echo "l4conf_update - cvsupdate the diverse Makeconf.* in the L4DIR"
311 @echo "print-subdirs - print the SUBDIRS which are subject to build"
312 # @echo "relink - rebuild servers and examples"
313 # @echo "relocate - building the relocatable binaries in the dirs"
314 @echo "BID_cont_reset - reset the state used by the \"cont\" target"
315 @echo 'rm-old-links - remove invalid symlinks in $$(L4DIR)/lib, $$(L4DIR)/include'
316 @echo "update - update the packages currently checked out"
317 @echo "help - this help"
319 #####################
320 # cont handling: "cont" is in the target list
322 -include $(BID_STATE_FILE)
324 $(VERBOSE)$(MAKE) $(addprefix -o ,BID_cont_reset $(BID_STATE_DONE)) \
325 $(filter-out cont,$(MAKECMDGOALS))
327 # eat up the other targets