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 ifneq ($(findstring $(CCVER_MAJOR),4 5 6 7),)
59 ifeq ($(CCVER_MAJOR),4)
60 CC_OK := $(if $(findstring $(CCVER_MINOR),0 1 2 3),,y)
70 @$(ECHO_E) "\033[31m\n" \
71 " ERROR: gcc version "$(CCVER_MAJOR).$(CCVER_MINOR)" is not supported for "\
73 " please update gcc to at least version 4.4.\033[m\n"; exit 1
76 ifeq ($(CC_TYPE),clang)
77 ifeq ($(CC_OK),not-yet)
78 @$(ECHO_E) "\033[31m\n" \
79 " ERROR: clang version "$(CCVER_MAJOR).$(CCVER_MINOR)" is not supported for "\
81 " please update clang to at least version ?.?.\033[m\n"; exit 1
85 Checkinitcalls: $(KERNEL) $(OBJ_KERNEL)
86 ifneq ($(shell $(CXX) -dumpversion | cut -d . -f1-2),3.4)
87 @echo "Checking initcalls"
88 $(VERBOSE)$(srcdir)/../tool/checkinitcalls \
90 -Werror $(filter-out fiasco.image, $^) \
91 $(if $(SYSTEM_TARGET),-t $(SYSTEM_TARGET)) && \
94 @echo "Initcall check disabled due to gcc-3.4"
98 @files=$$(cd $(srcdir) && \
99 find . -type f -name '*.cpp' -o -name '*.cc' -o \
100 -name '*.h' -o -name '*.S' -o -name '*.h'); \
101 fixme=$$(cd $(srcdir) && cat $$files | grep -wc FIXME); \
102 XXX=$$(cd $(srcdir) && cat $$files | grep -wc XXX); \
103 if [ "$$fixme" -ne "0" -o "$$XXX" -ne "0" ]; then \
104 echo "Found $$fixme times 'FIXME' and $$XXX times 'XXX'"; \
107 doc: docs/stamp-doc.ready
109 docs/stamp-doc.ready: $(srcdir)/doxygen.conf $(foreach m, $(GENERATED_MODULES), auto/stamp-$(m).ready)
112 $(VERBOSE)doxygen $(srcdir)/doxygen.conf
116 # Make function "makedeps": Creates (on stdout) a list of Make-like
117 # dependencies in a format suitable for $(SHOWDEPS). Expects a list
118 # of source (BASE-suffix.{cpp,cc,c}, BASE[_i].h) files as input and extracts
119 # include directives from them. Dependecies contain only basenames of
120 # files (up to the first "-"). Suffixes and extensions are stripped.
121 makedeps= implname () { echo $$1 | sed 's|.*/||; s|_i\.h|.h|; s|[.-].*||;'; };\
124 echo $$(implname $$i): $$(perl -n -e \
125 '/^\s*\#include\s+["<](.*).h[">]/ && print "$$1 "; next;' \
129 DEPS: $(SRC_ALL) $(foreach idir, $(PRIVATE_INCDIR), $(wildcard $(idir)/*.h))
130 $(call makedeps, $^) | $(SHOWDEPS) > $@.new
133 # Graphical version of DEPS dependency graph.
135 # XXX DEPS.{dot,ps} only contain dependency graphs for the KERNEL and
136 # LIBK subsystem. Also, we remove a number of top-level and low-level
137 # modules from the resulting graph to reduce the overwhelming number
138 # of edges; however, `gendotdeps' ensures that modules participating
139 # in circular dependencies are never removed.
141 GENDOT_FLAGS ?= -t1u1
143 KERNEL_MODULES_CPP = $(foreach mod, $(INTERFACES_KERNEL) $(INTERFACES_LIBK), \
144 $(addsuffix .cpp,$(call eval_impl,$(mod)))) \
145 $(foreach idir, $(srcdir)/kern $(srcdir)/kern/shared \
146 $(srcdir)/kern/$(CONFIG_XARCH), \
147 $(wildcard $(idir)/*.h))
149 ifeq ($(CONFIG_XARCH),ux)
150 EXTRA_INCLUDES = -I/usr/include/c++/$(shell $(CXX) -dumpversion) -I/usr/include
153 DEPS.dot: $(KERNEL_MODULES_CPP)
154 @echo -n > source_files.mkdeps
156 echo $$f >> source_files.mkdeps ; \
158 $(srcdir)/../tool/gendotdeps \
159 -E "$(PREPROCESS_PARTS)" $(addprefix -I,$(PRIVATE_INCDIR)) \
160 $(EXTRA_INCLUDES) $(addprefix --vpath=,$(VPATH)) $(GENDOT_FLAGS) \
161 -v -b $(srcdir)/DEPS.blacklist source_files.mkdeps -o $@ || $(RM) $@
162 @$(RM) source_files.mkdeps
165 dot -Tps -Gmclimit=200.0 -Gnslimit=500.0 \
166 -Gsize=11,10 -Grotate=90 -o $@ $<
169 dot -Tps -Gmclimit=200.0 -Gnslimit=500.0 \
170 -Gsize="11,8" -Granksep=0.7 -Grotate=90 -o $@ $<
173 tred $< | dot -Tps -Gmclimit=200.0 -Gnslimit=500.0 \
174 -Gsize="11,8" -Granksep=0.7 -Grotate=90 -o $@
177 dot -Tsvg -Gmclimit=200.0 -Gnslimit=500.0 \
178 -Gsize=11,10 -Grotate=90 -o $@ $<
181 dot -Tsvg -Gmclimit=200.0 -Gnslimit=500.0 \
182 -Gsize="11,8" -Granksep=0.7 -Grotate=90 -o $@ $<
185 tred $< | dot -Tsvg -Gmclimit=200.0 -Gnslimit=500.0 \
186 -Gsize="11,8" -Granksep=0.7 -Grotate=90 -o $@
191 # Circular should really be dependent on $(DEPS). However, we cannot
192 # enforce that all $(DEPS) are made before this target, because the
193 # Makefile contains "-include $(DEPS)" (which can result in Circular
194 # being created/updated before all $(DEPS) are). Therefore, depend on
195 # the fiasco.image and on main (not with Fiasco-UX). Once this is made,
196 # we know all $(DEPS) have been updated.
197 Circular: $(KERNEL) $(BOOT) $(RUN_TESTS) $(CHECKSUM)
200 echo 'Do "make DEPS" for full fine-grained dependency information.';\
203 $(PREPROCESSDEPS) $$i; \
204 done | $(SHOWDEPS) | $(CIRCULAR) \
208 # Create a Circular.max file for the first time. Usually this target
209 # is not needed -- there should be a Circular.max file in the CVS.
210 $(srcdir)/Circular.max.$(CONFIG_XARCH):
211 # Circular is not in the dependencies because we do not want a new
212 # copy of Circular.max every time Circular changes. We nevertheless
213 # need it to so the copy -- so create it explicitly
214 $(MAKE) -f $(srcdir)/Makefile.sub2 Circular
217 # Check that the number of circular dependency has not increased in
220 Circular-ok: $(srcdir)/Circular.max.$(CONFIG_XARCH) Circular
221 # Circular.max.* must be the first dependency: We are going to
222 # reference it as $<.
223 @ max=$$(tail -1 $<); \
224 current=$$(tail -1 Circular); \
225 if [ $$current -gt $$max ]; \
227 echo "Number of circular dependencies increased!"; \
228 diff -up $< Circular; \
231 echo "Circular-dependency check OK ($$current <= $$max)"
237 # Find directories for source and header files. There may be
238 # duplicates, so weed out the list using a tiny Perl script.
240 ( find $(shell perl -e ' \
242 foreach $$i (@ARGV) { \
243 next if ! -e $$i || $$i eq "."; \
244 next if defined $$seen{$$i}; \
247 }' $(filter-out auto, $(VPATH) $(PRIVATE_INCDIR))) \
248 -maxdepth 1 -type f -name '*.cpp' -o -name '*.h' \
249 -o -name '*.cc' -o -name '*.c' )
253 $(source-files) | etags --members --language=c++ -
256 $(source-files) | ctags --members --language=c++ -d -w -T -