3 # Targets in this Makefile:
4 # - all: Run all subsystems' "all" targets
5 # - doc: Create doxygen documentation in directory "docs"
6 # - DEPS, DEPS.ps, DEPS.a4.ps, DEPS.tred.ps:
7 # Create dependency graphs
10 # This Makefile is invoked in a sub-Make from the top-level Makefile
11 # when globalconfig.out, Modules and .Modules.deps are up-to-date and
12 # all `preprocess'd C++ source files have been created.
15 $(VERBOSE)echo " --> Build-Nr: $$(cat .build_nr)"
19 include $(srcdir)/Makeconf # also reads srcdir/Makeconf.local
20 # and objdir/Makeconf.local
21 include $(MODULES_FILE)
24 # Compute sets of sources. From these variables, Makeconf computes
25 # $(DEPS) and $(SRC_ALL). Set them before including Makerules.global.
26 SRC_S = $(foreach subsys, $(SUBSYSTEMS), $(ASSRC_$(subsys)))
27 SRC_C = $(foreach subsys, $(SUBSYSTEMS), $(CSRC_$(subsys)))
28 SRC_CC = $(foreach subsys, $(SUBSYSTEMS), $(CXXSRC_$(subsys)))
30 include $(srcdir)/Makerules.global # also reads objdir/Makerules.local
32 include $(MAKERULES_SUBSYS)
35 # Recompile everything if the compiler configuration has changed.
36 OBJS = $(foreach subsys, $(SUBSYSTEMS), $(OBJ_$(subsys)))
37 $(OBJS): .Compiler-config
40 # Subsystem-specific rules and targets
43 ifeq ("$(CONFIG_MAINTAINER_MODE)","y")
45 do-all: Checkinitcalls Circular-ok ToDoItems $(ALL)
46 ifeq ($(CONFIG_XARCH),ux)
47 # disabled until unittests fixed
51 else # ! maintainer mode
55 endif # ! maintainer mode
58 Checkinitcalls: $(KERNEL) $(OBJ_KERNEL)
59 ifneq ($(shell $(CXX) -dumpversion | cut -d . -f1-2),3.4)
60 @echo "Checking initcalls"
61 $(VERBOSE)$(srcdir)/../tool/checkinitcalls \
63 -Werror $(filter-out fiasco.image, $^) \
64 $(if $(CROSS_COMPILE),-t $(CROSS_COMPILE)) && \
67 @echo "Initcall check disabled due to gcc-3.4"
70 TOOL_GDB_DIR=$(srcdir)/../tool/gdb
74 $(VERBOSE)FIASCO_TOOL_GDB_DIR=$(TOOL_GDB_DIR) \
75 $(GDB) -x $(TOOL_GDB_DIR)/interactive.gdb fiasco.image
77 gen_ktrace_events.h: fiasco.image
78 $(VERBOSE)FIASCO_TOOL_GDB_DIR=$(TOOL_GDB_DIR) \
79 $(GDB) --batch -x $(TOOL_GDB_DIR)/gen_ktrace_events.gdb \
83 @files=$$(cd $(srcdir) && \
84 find . -type f -name '*.cpp' -o -name '*.cc' -o \
85 -name '*.h' -o -name '*.S' -o -name '*.h'); \
86 fixme=$$(cd $(srcdir) && cat $$files | grep -wc FIXME); \
87 XXX=$$(cd $(srcdir) && cat $$files | grep -wc XXX); \
88 if [ "$$fixme" -ne "0" -o "$$XXX" -ne "0" ]; then \
89 echo "Found $$fixme times 'FIXME' and $$XXX times 'XXX'"; \
92 doc: docs/stamp-doc.ready
94 docs/stamp-doc.ready: $(srcdir)/doxygen.conf $(foreach m, $(GENERATED_MODULES), auto/stamp-$(m).ready)
97 $(VERBOSE)doxygen $(srcdir)/doxygen.conf
101 # Make function "makedeps": Creates (on stdout) a list of Make-like
102 # dependencies in a format suitable for $(SHOWDEPS). Expects a list
103 # of source (BASE-suffix.{cpp,cc,c}, BASE[_i].h) files as input and extracts
104 # include directives from them. Dependecies contain only basenames of
105 # files (up to the first "-"). Suffixes and extensions are stripped.
106 makedeps= implname () { echo $$1 | sed 's|.*/||; s|_i\.h|.h|; s|[.-].*||;'; };\
109 echo $$(implname $$i): $$(perl -n -e \
110 '/^\s*\#include\s+["<](.*).h[">]/ && print "$$1 "; next;' \
114 DEPS: $(SRC_ALL) $(foreach idir, $(PRIVATE_INCDIR), $(wildcard $(idir)/*.h))
115 $(call makedeps, $^) | $(SHOWDEPS) > $@.new
118 # Graphical version of DEPS dependency graph.
120 # XXX DEPS.{dot,ps} only contain dependency graphs for the KERNEL and
121 # LIBK subsystem. Also, we remove a number of top-level and low-level
122 # modules from the resulting graph to reduce the overwhelming number
123 # of edges; however, `gendotdeps' ensures that modules participating
124 # in circular dependencies are never removed.
126 GENDOT_FLAGS ?= -t1u1
128 KERNEL_MODULES_CPP = $(foreach mod, $(INTERFACES_KERNEL) $(INTERFACES_LIBK), \
129 $(addsuffix .cpp,$(call eval_impl,$(mod)))) \
130 $(foreach idir, $(srcdir)/kern $(srcdir)/kern/shared \
131 $(srcdir)/kern/$(CONFIG_XARCH), \
132 $(wildcard $(idir)/*.h))
134 ifeq ($(CONFIG_XARCH),ux)
135 EXTRA_INCLUDES = -I/usr/include/c++/$(shell $(CXX) -dumpversion) -I/usr/include
138 DEPS.dot: $(KERNEL_MODULES_CPP)
139 @echo -n > source_files.mkdeps
141 echo $$f >> source_files.mkdeps ; \
143 $(srcdir)/../tool/gendotdeps \
144 -E "$(PREPROCESS_PARTS)" $(addprefix -I,$(PRIVATE_INCDIR)) \
145 $(EXTRA_INCLUDES) $(addprefix --vpath=,$(VPATH)) $(GENDOT_FLAGS) \
146 -v -b $(srcdir)/DEPS.blacklist source_files.mkdeps -o $@ || $(RM) $@
147 @$(RM) source_files.mkdeps
150 dot -Tps -Gmclimit=200.0 -Gnslimit=500.0 \
151 -Gsize=11,10 -Grotate=90 -o $@ $<
154 dot -Tps -Gmclimit=200.0 -Gnslimit=500.0 \
155 -Gsize="11,8" -Granksep=0.7 -Grotate=90 -o $@ $<
158 tred $< | dot -Tps -Gmclimit=200.0 -Gnslimit=500.0 \
159 -Gsize="11,8" -Granksep=0.7 -Grotate=90 -o $@
162 dot -Tsvg -Gmclimit=200.0 -Gnslimit=500.0 \
163 -Gsize=11,10 -Grotate=90 -o $@ $<
166 dot -Tsvg -Gmclimit=200.0 -Gnslimit=500.0 \
167 -Gsize="11,8" -Granksep=0.7 -Grotate=90 -o $@ $<
170 tred $< | dot -Tsvg -Gmclimit=200.0 -Gnslimit=500.0 \
171 -Gsize="11,8" -Granksep=0.7 -Grotate=90 -o $@
176 # Circular should really be dependent on $(DEPS). However, we cannot
177 # enforce that all $(DEPS) are made before this target, because the
178 # Makefile contains "-include $(DEPS)" (which can result in Circular
179 # being created/updated before all $(DEPS) are). Therefore, depend on
180 # the fiasco.image and on main (not with Fiasco-UX). Once this is made,
181 # we know all $(DEPS) have been updated.
182 Circular: $(KERNEL) $(BOOT) $(RUN_TESTS) $(CHECKSUM)
185 echo 'Do "make DEPS" for full fine-grained dependency information.';\
188 $(PREPROCESSDEPS) $$i; \
189 done | $(SHOWDEPS) | $(CIRCULAR) \
193 # Create a Circular.max file for the first time. Usually this target
194 # is not needed -- there should be a Circular.max file in the CVS.
195 $(srcdir)/Circular.max.$(CONFIG_XARCH):
196 # Circular is not in the dependencies because we do not want a new
197 # copy of Circular.max every time Circular changes. We nevertheless
198 # need it to so the copy -- so create it explicitly
199 $(MAKE) -f $(srcdir)/Makefile.sub2 Circular
202 # Check that the number of circular dependency has not increased in
205 Circular-ok: $(srcdir)/Circular.max.$(CONFIG_XARCH) Circular
206 # Circular.max.* must be the first dependency: We are going to
207 # reference it as $<.
208 @ max=$$(tail -1 $<); \
209 current=$$(tail -1 Circular); \
210 if [ $$current -gt $$max ]; \
212 echo "Number of circular dependencies increased!"; \
213 diff -up $< Circular; \
216 echo "Circular-dependency check OK ($$current <= $$max)"
222 # Find directories for source and header files. There may be
223 # duplicates, so weed out the list using a tiny Perl script.
225 ( find $(shell perl -e ' \
227 foreach $$i (@ARGV) { \
228 next if ! -e $$i || $$i eq "."; \
229 next if defined $$seen{$$i}; \
232 }' $(filter-out auto, $(VPATH) $(PRIVATE_INCDIR))) \
233 -maxdepth 1 -type f -name '*.cpp' -o -name '*.h' \
234 -o -name '*.cc' -o -name '*.c' )
238 $(source-files) | etags --members --language=c++ -
241 $(source-files) | ctags --members --language=c++ -d -w -T -