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 compilertest $(ALL)
46 ifeq ($(CONFIG_XARCH),ux)
47 # disabled until unittests fixed
51 else # ! maintainer mode
53 do-all: compilertest $(ALL)
55 endif # ! maintainer mode
58 ifeq ($(CCVER_MAJOR),2)
59 @$(ECHO_E) "\033[31m\n"\
60 " ERROR: gcc version "$(CCVER_MAJOR).$(CCVER_MINOR)" is not supported for"\
62 " please update gcc to version 3.{3-4}.\033[m\n"; exit -1
64 ifeq ($(CCVER_MAJOR),3)
65 ifeq ($(findstring $(CCVER_MINOR),2 3 4),)
66 @$(ECHO_E) "\033[31m\n"\
67 " WARNING: gcc version $(CCVER_MAJOR).$(CCVER_MINOR) is not supported for"\
68 "Fiasco -- please use gcc\n"\
69 " version 3.{3-4}. Be prepared to observe bugs in this kernel!\n"\
70 " Don't use this kernel for performance analysis!\033[m\n"
74 Checkinitcalls: $(KERNEL) $(OBJ_KERNEL)
75 ifneq ($(shell $(CXX) -dumpversion | cut -d . -f1-2),3.4)
76 @echo "Checking initcalls"
77 $(VERBOSE)$(srcdir)/../tool/checkinitcalls \
79 -Werror $(filter-out fiasco.image, $^) \
80 $(if $(SYSTEM_TARGET),-t $(SYSTEM_TARGET)) && \
83 @echo "Initcall check disabled due to gcc-3.4"
87 @files=$$(cd $(srcdir) && \
88 find . -type f -name '*.cpp' -o -name '*.cc' -o \
89 -name '*.h' -o -name '*.S' -o -name '*.h'); \
90 fixme=$$(cd $(srcdir) && cat $$files | grep -wc FIXME); \
91 XXX=$$(cd $(srcdir) && cat $$files | grep -wc XXX); \
92 if [ "$$fixme" -ne "0" -o "$$XXX" -ne "0" ]; then \
93 echo "Found $$fixme times 'FIXME' and $$XXX times 'XXX'"; \
96 doc: docs/stamp-doc.ready
98 docs/stamp-doc.ready: $(foreach m, $(GENERATED_MODULES), auto/stamp-$(m).ready)
101 @doxygen $(srcdir)/doxygen.conf
105 # Make function "makedeps": Creates (on stdout) a list of Make-like
106 # dependencies in a format suitable for $(SHOWDEPS). Expects a list
107 # of source (BASE-suffix.{cpp,cc,c}, BASE[_i].h) files as input and extracts
108 # include directives from them. Dependecies contain only basenames of
109 # files (up to the first "-"). Suffixes and extensions are stripped.
110 makedeps= implname () { echo $$1 | sed 's|.*/||; s|_i\.h|.h|; s|[.-].*||;'; };\
113 echo $$(implname $$i): $$(perl -n -e \
114 '/^\s*\#include\s+["<](.*).h[">]/ && print "$$1 "; next;' \
118 DEPS: $(SRC_ALL) $(foreach idir, $(PRIVATE_INCDIR), $(wildcard $(idir)/*.h))
119 $(call makedeps, $^) | $(SHOWDEPS) > $@.new
122 # Graphical version of DEPS dependency graph.
124 # XXX DEPS.{dot,ps} only contain dependency graphs for the KERNEL and
125 # LIBK subsystem. Also, we remove a number of top-level and low-level
126 # modules from the resulting graph to reduce the overwhelming number
127 # of edges; however, `gendotdeps' ensures that modules participating
128 # in circular dependencies are never removed.
130 GENDOT_FLAGS ?= -t1u1
132 KERNEL_MODULES_CPP = $(foreach mod, $(INTERFACES_KERNEL) $(INTERFACES_LIBK), \
133 $(addsuffix .cpp,$(call eval_impl,$(mod)))) \
134 $(foreach idir, $(srcdir)/kern $(srcdir)/kern/shared \
135 $(srcdir)/kern/$(CONFIG_XARCH), \
136 $(wildcard $(idir)/*.h))
138 ifeq ($(CONFIG_XARCH),ux)
139 EXTRA_INCLUDES = -I/usr/include/c++/$(shell $(CXX) -dumpversion) -I/usr/include
142 DEPS.dot: $(KERNEL_MODULES_CPP)
143 @echo -n > source_files.mkdeps
145 echo $$f >> source_files.mkdeps ; \
147 $(srcdir)/../tool/gendotdeps \
148 -E "$(PREPROCESS_PARTS)" $(addprefix -I,$(PRIVATE_INCDIR)) \
149 $(EXTRA_INCLUDES) $(addprefix --vpath=,$(VPATH)) $(GENDOT_FLAGS) \
150 -v -b $(srcdir)/DEPS.blacklist source_files.mkdeps -o $@ || $(RM) $@
151 @$(RM) source_files.mkdeps
154 dot -Tps -Gmclimit=200.0 -Gnslimit=500.0 \
155 -Gsize=11,10 -Grotate=90 -o $@ $<
158 dot -Tps -Gmclimit=200.0 -Gnslimit=500.0 \
159 -Gsize="11,8" -Granksep=0.7 -Grotate=90 -o $@ $<
162 tred $< | dot -Tps -Gmclimit=200.0 -Gnslimit=500.0 \
163 -Gsize="11,8" -Granksep=0.7 -Grotate=90 -o $@
166 dot -Tsvg -Gmclimit=200.0 -Gnslimit=500.0 \
167 -Gsize=11,10 -Grotate=90 -o $@ $<
170 dot -Tsvg -Gmclimit=200.0 -Gnslimit=500.0 \
171 -Gsize="11,8" -Granksep=0.7 -Grotate=90 -o $@ $<
174 tred $< | dot -Tsvg -Gmclimit=200.0 -Gnslimit=500.0 \
175 -Gsize="11,8" -Granksep=0.7 -Grotate=90 -o $@
180 # Circular should really be dependent on $(DEPS). However, we cannot
181 # enforce that all $(DEPS) are made before this target, because the
182 # Makefile contains "-include $(DEPS)" (which can result in Circular
183 # being created/updated before all $(DEPS) are). Therefore, depend on
184 # the fiasco.image and on main (not with Fiasco-UX). Once this is made,
185 # we know all $(DEPS) have been updated.
186 Circular: $(KERNEL) $(BOOT) $(RUN_TESTS) $(CHECKSUM)
189 echo 'Do "make DEPS" for full fine-grained dependency information.';\
192 $(PREPROCESSDEPS) $$i; \
193 done | $(SHOWDEPS) | $(CIRCULAR) \
197 # Create a Circular.max file for the first time. Usually this target
198 # is not needed -- there should be a Circular.max file in the CVS.
199 $(srcdir)/Circular.max.$(CONFIG_XARCH):
200 # Circular is not in the dependencies because we do not want a new
201 # copy of Circular.max every time Circular changes. We nevertheless
202 # need it to so the copy -- so create it explicitly
203 $(MAKE) -f $(srcdir)/Makefile.sub2 Circular
206 # Check that the number of circular dependency has not increased in
209 Circular-ok: $(srcdir)/Circular.max.$(CONFIG_XARCH) Circular
210 # Circular.max.* must be the first dependency: We are going to
211 # reference it as $<.
212 @ max=$$(tail -1 $<); \
213 current=$$(tail -1 Circular); \
214 if [ $$current -gt $$max ]; \
216 echo "Number of circular dependencies increased!"; \
217 diff -up $< Circular; \
220 echo "Circular-dependency check OK ($$current <= $$max)"
226 # Find directories for source and header files. There may be
227 # duplicates, so weed out the list using a tiny Perl script.
229 ( find $(shell perl -e ' \
231 foreach $$i (@ARGV) { \
232 next if ! -e $$i || $$i eq "."; \
233 next if defined $$seen{$$i}; \
236 }' $(filter-out auto, $(VPATH) $(PRIVATE_INCDIR))) \
237 -maxdepth 1 -type f -name '*.cpp' -o -name '*.h' \
238 -o -name '*.cc' -o -name '*.c' )
242 $(source-files) | etags --members --language=c++ -
245 $(source-files) | ctags --members --language=c++ -d -w -T -