]> rtime.felk.cvut.cz Git - l4.git/blob - l4/mk/binary.inc
update
[l4.git] / l4 / mk / binary.inc
1 # -*- Makefile -*-
2 # vim:set ft=make:
3 #
4 # DROPS (Dresden Realtime OPerating System) Component
5 #
6 # Makefile-Include for compiling templates (prog.mk, lib.mk)
7
8 # Makefile-Include for binary and lib directories
9 # Definitions for building the Makefile.inc, building dependencies,
10 # compiler configuration.
11 #
12 # If SYSTEM is defined and we do not clean, we generate Makefile.inc. This file
13 # holds the dependencies of the targets. Is also contains the definitions of
14 # variables holding the objects of the related targets. In a multiple
15 # architecture makefile, Makefile.inc will be built in arch-specific subdirs, 
16 # like the other components built.
17 #
18 # Most compiler- and linker-flag variables are defined in such a way that
19 # using them in the rule will expand all the target- and
20 # architecture-specific definitions.
21 #
22 # The relink-rule is defined in this file.
23 #
24 # The dependencies for compiling files are defined here, the dep-files are
25 # generated with names .(source-file).d for .c, .cc and .S-files.
26 #
27 # Clean-rules are defined here.
28 #
29
30 $(GENERAL_D_LOC): $(L4DIR)/mk/binary.inc $(L4DIR)/mk/modes.inc
31
32 # our default Makefile-name in the OBJ-Subdirs
33 BID_OBJ_Makefile ?= Makefile
34
35 ifeq ($(SYSTEM),) # if we have no system yet, build the subdirs
36 #################################################################
37 #
38 # we have NO system defined in $(SYSTEM), we are in the src/ dir
39 #
40 #################################################################
41
42 # our default systems
43 SYSTEMS ?= $(SYSTEMS_ABI)
44
45 BID_MISSING_PCS := \
46    $(strip $(if $(DEPENDS_PKGS), \
47              $(strip $(foreach i,$(DEPENDS_PKGS),            \
48                        $(if $(strip $(wildcard $(OBJ_BASE)/pc/$(i).pc)),,$(i))))))
49
50 ifneq ($(strip $(SRC_F)$(foreach t,$(TARGET),$(SRC_F_$(t)))),)
51   ifeq ($(filter x86 amd64,$(BUILD_ARCH)),)
52     $(info $(shell echo -e "\033[32mFortran is only available on x86 and amd64 currently, skipping directory '$(SRC_DIR)'.\033[0m"))
53     SYSTEMS =
54   else
55     ifeq ($(GCCFORTRANAVAIL),)
56       $(info $(shell echo -e "\033[32mFortran compiler (gcc-4.6 or later) missing, skipping directory '$(SRC_DIR)'.\033[0m"))
57       SYSTEMS =
58     else
59       ifeq ($(filter 4.6 4.7 4.8,$(GCCVERSION)),)
60         $(info $(shell echo -e "\033[32mFortran compiler gcc version 4.6 or later required, skipping directory '$(SRC_DIR)'.\033[0m"))
61         SYSTEMS =
62       endif
63     endif
64   endif
65 endif
66
67 ifneq ($(BID_MISSING_PCS),)
68   # clear SYSTEMS to prevent building anything
69   SYSTEMS =
70   text := $(shell echo -e "\033[32mPackage dependencies missing: \033[1m$(BID_MISSING_PCS)\033[22m; skipping directory '$(SRC_DIR)'.\033[0m")
71   $(if $(BID_FAIL_ON_MISSING),$(error $(text)), $(info $(text)))
72 endif
73
74 # intersection with BUILD_SYSTEMS
75
76 # filter the systems from the local SYSTEMS variable ($2), that match
77 # the build-architecture.
78 # args: $(1) - build architecture (one from BUILD_SYSTEMS)
79 #       $(2) - SYSTEMS
80 # 1. check, if both systems are the same (optionally reduced by the CPU)
81 # 2. check, if at least the arch matches (and optionally the cpu)
82 FILTER_SYSTEM = $(shell echo $(2)|$(AWKP) '\
83                         BEGIN{m=s="$(1)";sub("_[^-]*","",m)}\
84                         {for(i=1;i<=NF;i++){\
85                                 if(m==$$i||s==$$i){print s}else\
86                                 if(index(m,$$i)==1||index(s,$$i)==1)\
87                                         {t=s;sub("-.*","",t);print t}}}')
88
89 # print that system of the SYSTEMS variable that actually matched with
90 # $(BUILD_SYSTEMS) to the given system
91 # args: $(1) - build architecture (SYSTEM)
92 #       $(2) - SYSTEMS
93 # + do nearly the same as in FILTER_SYSTEM, but additionally check if
94 #   the resulting system matches $(1). If so, print the according pattern from
95 #   SYSTEMS and exit
96 BID_ORIG_SYSTEM = $(shell echo $(2)|$(AWKP) '\
97                     BEGIN{m=s="$(1)";sub("_[^-]*","",m)}\
98                     {for(i=1;i<=NF;i++){\
99                         if(m==$$i||s==$$i){if(s=="$(1)"){print $$i;exit}};\
100                         if(index(m,$$i)==1||index(s,$$i)==1)\
101                             {t=s;sub("-.*","",t);\
102                              if(t=="$(1)"){print $$i;exit}}}}')
103
104 ifeq ($(ROLE),idl.mk)
105 TARGET_SYSTEMS := $(sort $(foreach sys,$(sort \
106         $(shell echo $(BUILD_SYSTEMS)|$(SED) -e 's/_[^- ]*\(-\{0,1\}\)/\1/g')), \
107         $(call FILTER_SYSTEM,$(sys),$(SYSTEMS))))
108 else
109 TARGET_SYSTEMS := $(sort $(foreach sys,$(BUILD_SYSTEMS),\
110                         $(call FILTER_SYSTEM,$(sys),$(SYSTEMS))))
111 endif
112
113 DIR_FROM_SUB = $(firstword $(addprefix ../,$(patsubst /%,,$(1))) $(1))
114 SYSTEM_TO_ARCH = $(shell echo $(1)|$(SED) -e 's/[_-].*//')
115 SYSTEM_TO_CPU = $(shell echo $(1)|$(SED) -ne 's/[^-_]*_\([^-]*\).*/\1/p')
116 SYSTEM_TO_L4API = $(shell echo $(1)|$(SED) -ne 's/.*-\(.*\)/\1/p')
117
118 $(foreach sys,$(TARGET_SYSTEMS),$(OBJ_DIR)/OBJ-$(sys)/$(BID_OBJ_Makefile)):$(OBJ_DIR)/OBJ-%/$(BID_OBJ_Makefile):$(OBJ_DIR)/.general.d
119         @install -d $(dir $@)
120         @echo 'L4DIR=$(L4DIR_ABS)'>$@
121         @echo 'OBJ_BASE=$(OBJ_BASE)'>>$@
122         @echo 'OBJ_DIR=$(OBJ_DIR)'>>$@
123         @echo 'SRC_DIR=$(SRC_DIR)'>>$@
124         @echo 'PKGDIR=$(PKGDIR_ABS)'>>$@
125         @echo 'PKGDIR_ABS=$(PKGDIR_ABS)'>>$@
126         @echo 'PKGDIR_OBJ=$(PKGDIR_OBJ)'>>$@
127         @echo 'MAKECONFLOCAL=$(SRC_DIR)/Makeconf.local'>>$@
128         @echo 'OSYSTEM=$(call BID_ORIG_SYSTEM,$*,$(SYSTEMS))'>>$@
129         @echo 'SYSTEM=$*'>>$@
130         @echo 'ARCH=$(call SYSTEM_TO_ARCH,$*)'>>$@
131         @echo 'CPU=$(call SYSTEM_TO_CPU,$*)'>>$@
132         @echo 'L4API=$(call SYSTEM_TO_L4API,$*)'>>$@
133         @echo 'vpath %.c $(VPATH_SRC_BASE)'>>$@
134         @echo 'vpath %.cc $(VPATH_SRC_BASE)'>>$@
135         @echo 'vpath %.cpp $(VPATH_SRC_BASE)'>>$@
136         @for fext in $(FORTRAN_FILE_EXTENSIONS); do echo "vpath %$$fext $(VPATH_SRC_BASE)">>$@ ; done
137         @echo 'vpath %.S $(VPATH_SRC_BASE)'>>$@
138         @echo 'vpath %.y $(VPATH_SRC_BASE)'>>$@
139         @echo 'vpath %.l $(VPATH_SRC_BASE)'>>$@
140         @echo 'vpath %.ld $(VPATH_SRC_BASE)'>>$@
141         @echo 'vpath %.dpe $(VPATH_SRC_BASE)'>>$@
142         @echo '.general.d: $(SRC_DIR)/$(if $(wildcard Make.rules),Make.rules,Makefile)'>>$@
143         @echo 'include $(SRC_DIR)/$(if $(wildcard Make.rules),Make.rules,Makefile)'>>$@
144         @echo 'include $$(L4DIR)/mk/$(ROLE)'>>$@
145
146 install relink scrub:: $(foreach arch,$(TARGET_SYSTEMS),\
147                                           $(OBJ_DIR)/OBJ-$(arch)/$(BID_OBJ_Makefile))
148         $(if $(TARGET_SYSTEMS),  $(VERBOSE)set -e ; \
149             for d in $(TARGET_SYSTEMS) ; do \
150                 PWD=$OBJ-$$d $(MAKE) -C $(OBJ_DIR)/OBJ-$$d -f $(BID_OBJ_Makefile) \
151                         $@ ; done )
152
153 .PHONY: pre-obj
154 pre-obj::
155
156 all:: $(foreach arch,$(TARGET_SYSTEMS), $(OBJ_DIR)/OBJ-$(arch))
157 .PHONY: $(foreach arch,$(TARGET_SYSTEMS), $(OBJ_DIR)/OBJ-$(arch))
158 $(foreach arch,$(TARGET_SYSTEMS), $(OBJ_DIR)/OBJ-$(arch)):%:%/$(BID_OBJ_Makefile) pre-obj
159         $(VERBOSE)PWD=$@ $(MAKE) $(PL_j) -C $@ -f $(BID_OBJ_Makefile)
160
161
162 foreach_objdir = $(if $(wildcard $(OBJ_DIR)/OBJ-*), $(VERBOSE)set -e ; \
163                      for d in $(wildcard $(OBJ_DIR)/OBJ-*) ; do \
164                        PWD=$$d $(MAKE) -C $$d -f $(BID_OBJ_Makefile) $(1); \
165                      done, @true)
166
167 %.i %.s.i:: export DO_SHOW_RESULT_FILE=y
168 %.i %.s.i::
169         $(call foreach_objdir,$@)
170
171 clean disasm::
172         $(call foreach_objdir,$@)
173
174 cleanall::
175         $(VERBOSE)$(RM) -r $(wildcard $(OBJ_DIR))
176
177 .PHONY: $(TARGET_SYSTEMS)
178
179 else
180 ###############################################################
181 #
182 # we have a system defined in $(SYSTEM), we are in an OBJ- dir
183 #
184 ###############################################################
185
186 all::           $(TARGET)
187
188 disasm: $(TARGET)
189         $(call DISASM_CMD,$(if $(DABIN),$(DABIN),$<))
190
191 ifneq ($(CONFIG_USE_DROPS_STDDIR),)
192 L4INCDIR ?=     $(addprefix $(OBJ_BASE)/include/$(ARCH)/,$(L4API)) \
193                 $(addprefix $(OBJ_BASE)/include/,$(L4API)) \
194                 $(OBJ_BASE)/include/$(ARCH) \
195                 $(OBJ_BASE)/include \
196                 $(if $(USE_DICE),$(DICE_INCDIR),) \
197                 $(addprefix $(DROPS_STDDIR)/include/$(ARCH)/,$(L4API)) \
198                 $(addprefix $(DROPS_STDDIR)/include/,$(L4API)) \
199                 $(DROPS_STDDIR)/include/$(ARCH) \
200                 $(DROPS_STDDIR)/include
201
202 L4LIBDIR ?=     $(addprefix $(OBJ_BASE)/lib/$(ARCH)_$(CPU)/,$(L4API)) \
203                 $(OBJ_BASE)/lib/$(ARCH)_$(CPU) \
204                 $(OBJ_BASE)/lib \
205                 $(addprefix $(DROPS_STDDIR)/lib/$(ARCH)_$(CPU)/,$(L4API)) \
206                 $(DROPS_STDDIR)/lib/$(ARCH)_$(CPU) \
207                 $(DROPS_STDDIR)/lib
208
209 else
210
211 L4INCDIR ?=     $(addprefix $(OBJ_BASE)/include/$(ARCH)/,$(L4API)) \
212                 $(addprefix $(OBJ_BASE)/include/,$(L4API)) \
213                 $(OBJ_BASE)/include/$(ARCH) \
214                 $(OBJ_BASE)/include \
215                 $(if $(USE_DICE),$(DICE_INCDIR),)
216
217 L4LIBDIR ?=     $(addprefix $(OBJ_BASE)/lib/$(ARCH)_$(CPU)/,$(L4API)) \
218                 $(OBJ_BASE)/lib/$(ARCH)_$(CPU) \
219                 $(OBJ_BASE)/lib
220 endif
221
222 #
223 # Variables Section
224 #
225 # There is a hierarchy on defining variables depending on the targets they
226 # refer to: Most standard-Make Variables are supported. This includes
227 # LDFLAGS       - options for ld, defined in prog.mk and lib.mk
228 # CPPFLAGS      - options for the c preprocessor, included in CFLAGS
229 # CFLAGS        - options for the c compiler
230 # CXXFLAGS      - options for the c++ compiler
231 # FFLAGS        - options for the fortran compiler
232 # ASFLAGS       - options for the assembler
233 #
234 # Addtitionally, the following varibales are supported:
235 # SRC_C, SRC_CC, SRC_F, SRC_S - .c, .cc, .f90, .S source files
236 # CRT0, CRTN    - startup and finish code
237 # LIBS          - additional libs to link (with -l), including paths (-L)
238 # IDL           - interface definition files
239 # TARGET        - targets to ge built
240 #
241 # These variables will be used for all operations with the corresponding
242 # file types. More specific description is possible by using variables with
243 # added specifications. These specifications include a referred element and
244 # the architecture, both optional but in this order, separated by
245 # underscores. The referred element for CPPFLAGS, CFLAGS, CXXFLAGS and
246 # ASFLAGS is the source file. For the other variables, it is one of the
247 # target files. The TARGET variable can only be postfixed by an
248 # architecture.
249 # The specific variables will be used for the target and the referred element
250 # given in the name, additionally to the more general ones.
251 #
252 # Example for a valid specifications:
253 # SRC_C_libxverbose.a = verbose.c   - ar's verbose.o into libxverbose.a, but
254 #                                     not in other libs in the TARGET var.
255
256 include $(L4DIR)/mk/modes.inc
257
258 # select the variable specified in $(1) from the current architecture and
259 # mode. Fall back to "all" architecture if no specific version exists.
260 BID_mode_var= $(if $($(1)_$(ARCH)_$(MODE)),$($(1)_$(ARCH)_$(MODE)),$($(1)_all_$(MODE)))
261
262 BID_SUPPORTED ?= $(call BID_mode_var,BID_SUPPORTED)
263 ifneq ($(BID_SUPPORTED),y)
264 $(error Mode "$(MODE)" is not supported for CPU architecture "$(ARCH)")
265 endif
266
267 LIBCINCDIR    ?= $(call BID_mode_var,LIBCINCDIR)
268 LIBCLIBDIR    ?= $(call BID_mode_var,LIBCLIBDIR)
269 L4_LIBS       ?= $(call BID_mode_var,L4_LIBS)
270 CRT0          ?= $(call BID_mode_var,CRT0)
271 CRTP          ?= $(if $(filter $(CRT0_DEFAULT),$(CRT0)),$(CRTP_DEFAULT),$(CRT0))
272 CRTN          ?= $(call BID_mode_var,CRTN)
273 LDSCRIPT      ?= $(call BID_mode_var,LDSCRIPT)
274 LDFLAGS       += $(call BID_mode_var,LDFLAGS)
275 REQUIRES_LIBS += $(REQUIRES_LIBS_$(ARCH)) $(call BID_mode_var,REQUIRES_LIBS)
276
277 # we do not need to put our FLAG-definitions into a special file if we can
278 # use the target to parameterize it and if it needs not to appear in the deps 
279 #CRT0   =  $(word 1, $(CRT0_$@_$(OSYSTEM)) $(CRT0_$@) $(CRT0_$(OSYSTEM)))
280 #CRTN   =  $(word 1, $(CRTN_$@_$(OSYSTEM)) $(CRTN_$@) $(CRTN_$(OSYSTEM)))
281 LIBS    += $(strip $(LIBS_$(OSYSTEM)) $(LIBS_$@) $(LIBS_$@_$(OSYSTEM)))
282
283 LDFLAGS += $(strip $(LDFLAGS_$(OSYSTEM)) $(LDFLAGS_$@) $(LDFLAGS_$@_$(OSYSTEM)))
284 CARCHFLAGS += $(CARCHFLAGS_$(ARCH)) $(CARCHFLAGS_$(ARCH)_$(CPU))
285
286 # ---------------------------------
287
288 BID_MISSING_LIBS :=
289
290 # call pkg-config, returns __PKGCONFIG_FAILED__ if the call failed
291 # 1: OBJ_BASE
292 # 2: parameters to pkg-config
293 # 3: list of packages
294 # use L4_BID_PKG_CONFIG because of export-defs, the function is copied
295 L4_BID_PKG_CONFIG = $(PKG_CONFIG)
296 BID_PKG_CONFIG = $(if $(strip $(3)),                                     \
297                    $(shell PKG_CONFIG_LIBDIR=$(1)/pc                     \
298                            PKG_CONFIG_PATH= $(L4_BID_PKG_CONFIG)         \
299                            --define-variable=incdir=$(1)/include/contrib \
300                            $(if $(VERBOSE),--silence-errors)             \
301                            $(2) $(3) || echo __PKGCONFIG_FAILED__))
302
303 BID_PKG_CONFIG_MISSING =                                        \
304      $(if $(strip $(3)),                                        \
305           $(shell PKG_CONFIG_LIBDIR=$(1)/pc                     \
306                   PKG_CONFIG_PATH= LANG=C $(L4_BID_PKG_CONFIG)  \
307                   --errors-to-stdout --print-errors $(2) $(3)   \
308                   | LANG=C grep ", not found"))
309
310 BID_PKG_CONFIG_FAILED = $(findstring __PKGCONFIG_FAILED__,$(1))
311
312 ifeq ($(BID_MISSING_PCS),)
313  ifneq ($(SYSTEM),)
314   ifneq ($(REQUIRES_LIBS),)
315    REQUIRES_LIBS_LIST := $(strip $(call BID_PKG_CONFIG,$(OBJ_BASE),--libs,$(REQUIRES_LIBS)))
316    # error handling
317    ifneq ($(call BID_PKG_CONFIG_FAILED,$(REQUIRES_LIBS_LIST)),)
318     BID_MISSING_PCS := $(strip $(foreach i,$(REQUIRES_LIBS), \
319                          $(if $(filter __PKGCONFIG_FAILED__,$(call BID_PKG_CONFIG,$(OBJ_BASE),--libs --print-errors,$(i))),$(i))))
320     text := $(shell echo -e "\033[31mLibrary dependencies missing: \033[1m$(BID_MISSING_PCS)\033[22m in directory '$(SRC_DIR)'; aborting.\033[0m")
321     text2 := $(strip $(foreach i,$(REQUIRES_LIBS), $(call BID_PKG_CONFIG_MISSING,$(OBJ_BASE),--libs,$(i))))
322     $(if $(text2),$(info $(shell echo -e "\033[31m$(text2)\033[0m")))
323     $(if $(BID_MISSING_PCS),$(info $(text)),$(error $(text)))
324    endif
325
326    # some sanity check
327    ifneq ($(filter libl4re-vfs,$(REQUIRES_LIBS)),)
328      $(error Never include 'libl4re-vfs'!)
329    endif
330   endif
331
332   BID_PKG_CONFIG_CFLAGS := $(call BID_PKG_CONFIG,$(OBJ_BASE),--cflags, $(REQUIRES_CFLAGS) $(REQUIRES_LIBS))
333
334   # error handling
335   ifneq ($(call BID_PKG_CONFIG_FAILED,$(BID_PKG_CONFIG_CFLAGS)),)
336    BID_MISSING_PCS := $(strip $(foreach i,$(REQUIRES_CFLAGS) $(REQUIRES_LIBS), \
337                           $(if $(filter __PKGCONFIG_FAILED__,$(call BID_PKG_CONFIG,$(OBJ_BASE),--cflags --print-errors,$(i))),$(i))))
338    text := $(shell echo -e "\033[31mCflags dependencies missing: \033[1m$(BID_MISSING_PCS)\033[22m in directory '$(SRC_DIR)'; aborting.\033[0m")
339    text2 := $(strip $(foreach i,$(REQUIRES_LIBS), $(call BID_PKG_CONFIG_MISSING,$(OBJ_BASE),--cflags,$(i))))
340    $(if $(text2),$(info $(shell echo -e "\033[31m$(text2)\033[0m")))
341    $(error $(text))
342   endif
343  endif # SYSTEM
344 endif
345
346 # -----------------------
347
348 # May 2007: force somewhat old hash-style as some(!, independant of the
349 #           actual version) ld now use an other format, no uclibc upstream fix
350 #           available yet, until available, we need:
351 ifeq ($(LD_HAS_HASH_STYLE_OPTION),y)
352 ifneq ($(HOST_LINK),1)
353 LDFLAGS += --hash-style=sysv
354 endif
355 endif
356
357 OPTS    ?= -g -O2 -fno-strict-aliasing
358 WARNINGS?= -Wextra -Wall -Wstrict-prototypes -Wmissing-prototypes -Wmissing-declarations $(WARNINGS_$@)
359
360 ifeq ($(MODE),host)
361 # never cross compile in host mode
362 SYSTEM_TARGET = 
363 CC            = $(HOST_CC)
364 CXX           = $(HOST_CXX)
365 LIBS         += $(REQUIRES_LIBS_LIST)
366 else
367 # no architecture specific flags in host mode
368 LDFLAGS      += $(LDFLAGS_$(ARCH))
369 L4_LIBS      += $(REQUIRES_LIBS_LIST)
370 endif
371
372 # no link address if build a lib or we're compiling a host program and using
373 # the host linker scripts
374 ifeq ($(ROLE),lib.mk)
375 NO_DEFAULT_RELOC := y
376 endif
377 ifneq ($(HOST_LINK),)
378 NO_DEFAULT_RELOC := y
379 endif
380
381 default_reloc_base = $(firstword $(DEFAULT_RELOC_$(1)) \
382                                  $(DEFAULT_RELOC_$(ARCH)) \
383                                  $(DEFAULT_RELOC) \
384                                  $(if $(NO_DEFAULT_RELOC),,0x01000000))
385 default_reloc = $(if $(call default_reloc_base,$(1)),\
386                      $(if $(RELOC_PHYS), \
387                           $(shell printf "0x%x" $$(($(RAM_BASE) + $(call default_reloc_base,$(1))))), \
388                           $(call default_reloc_base,$(1))))
389
390 # can be overwritten to get the old mode
391 CFLAGS_C99 ?= -std=gnu99
392
393 ifneq ($(MODE),host)
394 CFLAGS_L4_GENERIC += $(CCXX_FLAGS) $(CARCHFLAGS) $(GCCNOSTACKPROTOPT)
395 endif
396
397 $(CLIENTIDL:.idl=-client.o): CFLAGS += -ffunction-sections
398 CFLAGS  += $(if $(CONFIG_BID_GCC_OMIT_FP),-fomit-frame-pointer,)
399 CFLAGS  += $(CFLAGS_$(OSYSTEM)) $(CFLAGS_$<) $(CFLAGS_$(<F)) $(CFLAGS_$(<D)) $(CFLAGS_$(<F)_$(OSYSTEM))
400 CFLAGS  += $(CFLAGS_$(L4API))
401 CFLAGS  += $(OPTS) $(WARNINGS)
402 CFLAGS  += -fno-common
403 CFLAGS  += $(CFLAGS_C99)
404 CFLAGS  += $(CFLAGS_L4_GENERIC)
405 DEFINES += $(DEFINES_$(OSYSTEM)) $(DEFINES_$<) $(DEFINES_$(<F)) $(DEFINES_$(<D)) $(DEFINES_$(<F)_$(OSYSTEM))
406 DEFINES += -DSYSTEM_$(subst -,_,$(SYSTEM)) -DARCH_$(ARCH) -DCPUTYPE_$(CPU) -DL4API_$(L4API)
407 DEFINES += $(DEFINES-y)
408 DEFINES += -D_GNU_SOURCE $(if $(L4API),,-DL4_MINIMAL_LIBC)
409 ifdef DEBUG
410 ifeq (,$(filter 0 n N, $(DEBUG)))
411 DEFINES += -DDEBUG
412 endif
413 endif
414
415 CPPFLAGS-DEBUG_MODE = \
416     $(addprefix -include, $(OBJ_BASE)/include/$(ARCH)/l4/sys/kdebug.h) \
417     $(addprefix -include, $(wildcard $(if $(L4API),$(OBJ_BASE)/include/$(ARCH)/$(L4API)/l4/sys/ktrace.h) \
418                                      $(OBJ_BASE)/include/$(ARCH)/l4/sys/ktrace.h)) \
419     -include $(OBJ_BASE)/include/l4/util/kprintf.h \
420     $(if $(L4API),-include $(OBJ_BASE)/include/l4/sys/debugger.h)
421
422 CPPFLAGS+= $(CPPFLAGS_$(OSYSTEM)) $(CPPFLAGS_$<) $(CPPFLAGS_$(<F)) $(CPPFLAGS_$(<D)) $(CPPFLAGS_$(<F)_$(OSYSTEM))
423 CPPFLAGS+= $(DEFINES)
424 CPPFLAGS+= $(addprefix -I, $(PRIVATE_INCDIR) $(PRIVATE_INCDIR_$(OSYSTEM)) $(PRIVATE_INCDIR_$@) $(PRIVATE_INCDIR_$@_$(OSYSTEM)))
425 CPPFLAGS+= $(if $(CONTRIB_INCDIR),$(addprefix -I$(OBJ_BASE)/include/contrib/,$(CONTRIB_INCDIR)))
426 CPPFLAGS+= $(BID_PKG_CONFIG_CFLAGS)
427 #CPPFLAGS+= $(if $(CLIENTIDL)$(SERVERIDL)$(addprefix CLIENTIDL_,$(TARGET))$(addprefix SERVERIDL_,$(TARGET)),$(addprefix -I, $(IDL_PATH)))
428 ifneq ($(MODE),host)
429 CPPFLAGS+= $(addprefix -I, $(L4INCDIR))
430 endif
431 CPPFLAGS+= $(if $(DEBUG_MODE),$(CPPFLAGS-DEBUG_MODE))
432 CPPFLAGS+= $(LIBCINCDIR)
433
434 ifneq ($(MODE),host)
435 CXXFLAGS_L4_GENERIC += $(CARCHFLAGS) $(CCXX_FLAGS)
436 CXXFLAGS_L4_GENERIC += $(if $(GCC_HAS_ATOMICS),-DL4_GCC_HAS_ATOMICS)
437 CXXFLAGS_L4_GENERIC += $(GCCNOSTACKPROTOPT)
438 CXXFLAGS_L4_GENERIC += -fuse-cxa-atexit
439 endif
440
441 CXXFLAGS+= $(if $(CONFIG_BID_GCC_OMIT_FP),-fomit-frame-pointer,)
442 CXXFLAGS+= $(CXXFLAGS_$(OSYSTEM)) $(CXXFLAGS_$@) $(CXXFLAGS_$(@D)) $(CXXFLAGS_$<) $(CXXFLAGS_$(<F))  $(CXXFLAGS_$(<D)) $(CXXFLAGS_$(<F)_$(OSYSTEM))
443 CXXFLAGS+= $(OPTS) $(filter-out -Wstrict-prototypes -Wmissing-prototypes -Wno-pointer-sign,$(WARNINGS))
444 CXXFLAGS+= $(CXXFLAGS-y)
445 CXXFLAGS+= -fno-common
446 CXXFLAGS+= $(CXXFLAGS_L4_GENERIC)
447
448 FFLAGS  += $(CFLAGS_L4_GENERIC)
449
450 PICFLAGS += -fPIC -U__PIC__ -D__PIC__=1
451
452 ifneq ($(MODE),host)
453 ASFLAGS_L4_GENERIC += $(CARCHFLAGS) $(CCXX_FLAGS)
454 endif
455
456 ASFLAGS += $(OPTS) $(ASFLAGS_L4_GENERIC)
457 ASFLAGS += $(ASFLAGS_$(ARCH)) $(ASFLAGS_$(@:.o=.S)) $(ASFLAGS_$(@:.o=.S)_$(OSYSTEM))
458 OBJS    += $(strip $(OBJS_$(OSYSTEM)) $(OBJS_$@) $(OBJS_$@_$(OSYSTEM)))
459 ALLOBJS  = $(OBJS) $(foreach target,$(TARGET) $(TARGET_$(OSYSTEM)),\
460                              $(OBJS_$(target)) $(OBJS_$(target)_$(OSYSTEM)))
461 ALLDPI = $(sort $(foreach obj,$(ALLOBJS),$(patsubst %.dpe,%.dpi,\
462                 $(DPE_$(obj:.o=.c)))))
463
464 # implementation of $(CLIENTIDL) and $(SERVERIDL)
465 IDL_TYPE   ?= dice
466 IDL_PKGDIR ?= $(PKGDIR_OBJ)
467 IDL_PATH   ?= $(addsuffix /idl/OBJ-$(ARCH)-$(L4API),$(IDL_PKGDIR))
468 ifneq ($(IDL_TYPE), dice)
469 ifneq ($(IDL_TYPE), corba)
470 $(error IDL_TYPE "$(IDL_TYPE)" not supported.)
471 endif
472 endif
473
474 # A function to deliver the source files generated from IDL-files and
475 # that should be linked to a given target. Used by "targetobjs" to write
476 # the target-objects and in the "Makefile.inc:"-rule to write the IDL_SRC_C-
477 # variables
478 # arg: 1 - target
479 IDL_SRC_Cfn = $(CLIENTIDL:.idl=-client.c) $(SERVERIDL:.idl=-server.c)   \
480               $(foreach inter, $(OSYSTEM) $(1) $(1)_$(OSYSTEM),         \
481                         $(CLIENTIDL_$(inter):.idl=-client.c)            \
482                         $(SERVERIDL_$(inter):.idl=-server.c))
483 IDL_SRC_CCfn = $(CLIENTIDL:.idl=-client.cc) $(SERVERIDL:.idl=-server.cc) \
484               $(foreach inter, $(OSYSTEM) $(1) $(1)_$(OSYSTEM),         \
485                         $(CLIENTIDL_$(inter):.idl=-client.cc)           \
486                         $(SERVERIDL_$(inter):.idl=-server.cc))
487
488 # *all* CLIENTIDLs/SERVERIDLs
489 # needed for the test if we should include the IDL-Path into vpath
490 IDL_ALLCLIENTIDL = $(CLIENTIDL) $(CLIENTIDL_$(OSYSTEM))                 \
491                    $(foreach target,$(TARGET) $(TARGET_$(OSYSTEM)),     \
492                       $(CLIENTIDL_$(target)) $(CLIENTIDL_$(target)_$(OSYSTEM)))
493 IDL_ALLSERVERIDL = $(SERVERIDL) $(SERVERIDL_$(OSYSTEM))                 \
494                    $(foreach target,$(TARGET) $(TARGET_$(OSYSTEM)),     \
495                       $(SERVERIDL_$(target)) $(SERVERIDL_$(target)_$(OSYSTEM)))
496
497 ifneq ($(IDL_ALLCLIENTIDL),)
498 vpath %-client.c $(IDL_PATH)
499 vpath %-client.cc $(IDL_PATH)
500 endif
501 ifneq ($(IDL_ALLSERVERIDL),)
502 vpath %-server.c $(IDL_PATH)
503 vpath %-server.cc $(IDL_PATH)
504 endif
505
506 # adjust obj path in case an absolute path name is given,
507 # for that to work we also need to explicitly list .o to .source relations
508 # arg: 1 - file path
509 gen_obj_path = $(foreach f,$(1),$(if $(filter /%,$(f)),$(OBJ_BASE)$(patsubst $(SRC_BASE)/%,/%,$(f)),$(f)))
510
511 # check for absolute paths
512 # arg: 1 - list of paths
513 check_path = $(foreach f,$(1),$(if $(filter /%,$(f)),$(error Given paths must be relative.),$(f)))
514
515 # convert list of c++ files names to .o files
516 # arg: 1 - list of files
517 #      2 - infix between the basename and the .o
518 convert_cc_to_o_file = $(patsubst %.cc,%$(2).o, $(filter %.cc,$(1)))     \
519                        $(if $(BID_ALLOW_CPP_AS_CPLUSPLUS_FILE),          \
520                          $(patsubst %.cpp,%$(2).o,$(filter %.cpp,$(1))))
521
522 # convert list of Fortran file names to .o files
523 # arg: 1 - list of files
524 #      2 - infix between the basename and the .o
525 convert_f_to_o_file = $(foreach e,$(FORTRAN_FILE_EXTENSIONS),$(patsubst %$e,%$(2).o,$(filter %$e,$(1))))
526
527 # generic targetobjs
528 # arg: 1 - target
529 #      2 - infix between the basename and the .o
530 #      3 - additional infix before .o in case of .cc files
531 targetobjs_gen = $(call check_path,                                            \
532                         $(SRC_C:.c=$(2).o) $(SRC_S:.S=$(2).o)                  \
533                         $(call convert_cc_to_o_file,$(SRC_CC),$(2)$(3))        \
534                         $(call convert_f_to_o_file,$(SRC_F),$(2)$(3))          \
535                         $(foreach inter, $(OSYSTEM) $(1) $(1)_$(OSYSTEM),      \
536                             $(SRC_C_$(inter):.c=$(2).o)                        \
537                             $(SRC_S_$(inter):.S=$(2).o)                        \
538                             $(call convert_cc_to_o_file,$(SRC_CC_$(inter)),$(2)$(3)) \
539                             $(call convert_f_to_o_file,$(SRC_F_$(inter)),$(2)$(3)))  \
540                         $(patsubst %.c,%$(2).o,$(call IDL_SRC_Cfn,$(1))))
541
542 # a helper function to generate the object-files for a given target
543 # arg: 1 - target
544 #      2 - infix between the basename and the .o
545 targetobjs   = $(call targetobjs_gen,$(1),$(2),)
546
547 # special version of targetobjs that shares objects between exception and
548 # non-exception cases, we just need two versions for C++ files
549 # arg: 1 - target
550 #      2 - infix between the basename and the .o or .ne.o
551 targetobjs_ne = $(call targetobjs_gen,$(1),$(2),.ne)
552
553 # The directories our object files will go into. These dirs will be created
554 # on generation of Makefile.inc in the OBJ- dirs.
555 OBJDIRS = $(strip $(sort $(filter-out ./,$(dir                          \
556                 $(foreach t,$(TARGET_STANDARD),                         \
557                         $(call targetobjs,$(t),))                       \
558                 $(foreach t,$(TARGET_STANDARD_NE),                      \
559                         $(call targetobjs,$(t),.ne))                    \
560                 $(foreach t,$(TARGET_SHARED),                           \
561                         $(call targetobjs,$(t),))                       \
562                 $(foreach t,$(TARGET_SHARED_NE),                        \
563                         $(call targetobjs,$(t),.ne))                    \
564                 $(foreach t,$(PROFILE),                                 \
565                         $(call targetobjs,$(t),.pr))                    \
566                 $(foreach t,$(TARGET_PROFILE_PIC) $(TARGET_PROFILE_SHARED),\
567                 $(call targetobjs,$(t),.pr.s))))))
568
569 # The include file for the Makefile. This file contains definitions and
570 # dependencies which are dynamically generated. Unfortunately, make does
571 # not support variable declarations using the foreach function. Same
572 # for rules.
573 $(BID_OBJ_Makefile).inc: .general.d $(BID_RAM_BASE_DEP)
574         @$(BUILD_MESSAGE)
575         @$(ECHO) "# automatically generated, do not edit!" >$@_
576         # write helper variables containing the IDL-C-Sources
577         @$(ECHO) -en '$(strip $(foreach target,$(TARGET),               \
578                 \nIDL_SRC_C_$(target)=$(call IDL_SRC_Cfn,$(target))))'>>$@_
579         # and add them to SRC_C
580         @$(ECHO) -en '$(strip $(foreach target,$(TARGET),               \
581                 \nSRC_C_$(target) += $$(IDL_SRC_C_$(target))))'>>$@_
582         # but set the variables empty for the current rule
583         @$(ECHO) -en '$(strip $(foreach target,$(TARGET),               \
584                 \n$(BID_OBJ_Makefile).inc: IDL_SRC_C_$(target)=))'>>$@_
585         # write helper variables containing the IDL-C++-Sources
586         @$(ECHO) -en '$(strip $(foreach target,$(TARGET),               \
587                 \nIDL_SRC_CC_$(target)=$(call IDL_SRC_CCfn,$(target))))'>>$@_
588         # and add them to SRC_CC
589         @$(ECHO) -en '$(strip $(foreach target,$(TARGET),               \
590                 \nSRC_CC_$(target) += $$(IDL_SRC_CC_$(target))))'>>$@_
591         # but set the variables empty for the current rule
592         @$(ECHO) -en '$(strip $(foreach target,$(TARGET),               \
593                 \n$(BID_OBJ_Makefile).inc: IDL_SRC_CC_$(target)=))'>>$@_
594         # write the object declaration variables
595         # TARGET_{STANDARD, PIC, SHARED, STANDARD_NE, SHARED_NE}
596         #    contain the appropriate targets
597         # TARGET_PROFILE_{STANDARD, PIC, SHARED} as well
598         @$(ECHO) -en '$(strip $(foreach target,$(TARGET_STANDARD),      \
599                 \nOBJS_$(target) += $(call targetobjs,$(target),)))' >>$@_
600         @$(ECHO) -en '$(strip $(foreach target,$(TARGET_STANDARD_NE),   \
601                 \nOBJS_$(target) += $(call targetobjs_ne,$(target),)))' >>$@_
602         @$(ECHO) -en '$(strip $(foreach target,$(TARGET_PIC) $(TARGET_SHARED), \
603                 \nOBJS_$(target) += $(call targetobjs,$(target),.s)))' >>$@_
604         @$(ECHO) -en '$(strip $(foreach target,$(TARGET_PIC_NE) $(TARGET_SHARED_NE), \
605                 \nOBJS_$(target) += $(call targetobjs_ne,$(target),.s) \
606                 \nLINK_WITH_NOEXC_LIBS_$(target) = y))' >>$@_
607         @$(ECHO) -en '$(strip $(foreach target,$(TARGET_PROFILE),       \
608                 \nOBJS_$(target) += $(call targetobjs,$(target),.pr)))' >>$@_
609         @$(ECHO) -e '$(strip $(foreach target,$(TARGET_PROFILE_PIC) $(TARGET_PROFILE_SHARED),           \
610                 \nOBJS_$(target) += $(call targetobjs,$(target),.pr.s)))' >>$@_
611         #
612         # write the dpe-dependencies
613         @$(ECHO) -e '$(foreach obj,$(sort                               \
614                 $(foreach t,$(TARGET_STANDARD),$(call targetobjs,$t))   \
615                 $(foreach t,$(TARGET_PIC) $(TARGET_SHARED),             \
616                         $(call targetobjs,$t,.s))                       \
617                 $(foreach t,$(TARGET_PROFILE),$(call targetobjs,$t,.pr)) \
618                 $(foreach t,$(TARGET_PROFILE_PIC) $(TARGET_PROFILE_SHARED),\
619                         $(call targetobjs,$t,.pr.s))),$(strip           \
620                 $(addprefix \n$(obj): ,$(patsubst %.dpe,%.dpi,          \
621                 $(DPE_$(obj:.o=.c)) $(DPE_$(obj:.o=.cc))                \
622                 $(DPE_$(obj:.s.o=.c)) $(DPE_$(obj:.s.o=.cc))            \
623                 $(DPE_$(obj:.pr.o=.c)) $(DPE_$(obj:.pr.o=.cc))          \
624                 $(DPE_$(obj:.pr.s.o=.c)) $(DPE_$(obj:.pr.s.o=.cc))      \
625                 ))))' >>$@_
626         #
627         # create the object-dirs
628         @$(if $(OBJDIRS), $(VERBOSE)set -e; for d in $(OBJDIRS); do     \
629                 [ -d "$$d" ] || $(MKDIR) $$d; done )
630
631         #
632         # write the object-dependencies for the targets
633         @$(ECHO) -e '$(foreach target,$(TARGET),$(strip\
634                   \n$(target): $$(OBJS_$(target)) ))' >> $@_
635         # make the target dependent on '.general.d'
636         @$(ECHO) -e '$(foreach target,$(TARGET),$(strip                 \
637                   \n$$(OBJS_$(target)): .general.d))'                   \
638                 >> $@_
639         # Using LDSO does not need a RELOC address, so omit the following in
640         # this case
641 ifneq ($(MODE),shared)
642         # in case of a binary, write the link address
643         # the dependency to the static file: If DEFAULT_RELOC is set,
644         # all targets are made dependent on the STATIC file
645         # (defined in Makeconf).
646         # If DEFAULT_RELOC_xxx is set, xxx is made dependent on the
647         # STATIC file.
648 ifneq ($(strip $(foreach target,$(TARGET), $(call default_reloc,$(target)))),)
649 ifneq ($(filter l4linux host,$(MODE)),)
650         $(error DEFAULT_RELOC must not be set if MODE is l4linux or host)
651 endif
652         # the relocatable binaries depend on Makefile.inc
653         @$(ECHO) -e '\n$(strip                                           \
654                 $(foreach target, $(TARGET),                             \
655                         $(if $(call default_reloc,$(target)),$(target))) \
656                 : $@)' >>$@_
657         # we find out the relocation address here.
658         @$(ECHO) -e '$(foreach target, $(TARGET),$(strip                \
659                 \nLDFLAGS_$(target)+=  --defsym=__executable_start=$(firstword          \
660                         $(call default_reloc,$(target)))))'     \
661                 >>$@_
662 endif
663 endif # MODE != shared
664         @mv $@_ $@
665
666 ifeq ($(filter scrub help,$(MAKECMDGOALS)),)
667 -include $(BID_OBJ_Makefile).inc
668 endif
669
670 #
671 # Rules Section
672 #
673
674 # the default target "all" ensures building of the targets. When multiple
675 # architectures are used, the targets are build in subdirs.
676
677 # the relink-rule: make the TARGETs phony. Specification of build-targets 
678 # in MAKECMDGOALS is not allowed. Possibility: TARGET=
679 #
680 ifneq ($(filter relink,$(MAKECMDGOALS)),)
681 .PHONY: $(TARGET)
682 relink: all
683 endif
684
685
686
687 ###
688 #
689 # Compilation rules with dependency-generation
690 #
691 # If we have ld.so, we use it to create our dependencies (see MAKEDEP
692 # definition). Otherwise, we fall back to whatever we need. For
693 # compilation with gcc, this is using "-MD" and postprocessing the
694 # generated files.
695
696 ifeq ($(CONFIG_HAVE_LDSO),)
697 LIBDEPS = $(foreach file, \
698                     $(patsubst -l%,lib%.a,$(filter-out -L%,$(LDFLAGS))) \
699                     $(patsubst -l%,lib%.so,$(filter-out -L%,$(LDFLAGS))),\
700                     $(word 1, $(foreach dir, \
701                            $(patsubst -L%,%,\
702                            $(filter -L%,$(LDFLAGS) $(L4ALL_LIBDIR))),\
703                       $(wildcard $(dir)/$(file)))))
704
705 DEPEND_EXTEND_CMD = $(AWKP) '                   \
706 /^[^:]*: ..*/{                                  \
707         while(sub("\\\\$$","")){                \
708                 getline nextline ;              \
709                 $$0=$$0 " " nextline            \
710         }                                       \
711         split($$0,field,": ");                  \
712         sub("^$(*F).o","$*.s $*.i $@",field[1]);        \
713         nr=split(field[2],deps) ;               \
714         for(i=1;i<=nr;){                        \
715           printf("ifeq ($$(shell test y \\\n"); \
716           for(j=0; j<100 && i+j<=nr; j++){      \
717             printf("-a -r %s \\\n", deps[i+j]); \
718           }                                     \
719           printf("&& echo y),)");               \
720           printf("\n%s: FORCE\nelse\n%s: $(BID_OBJ_Makefile) \\\n",     \
721                 field[1],field[1]);             \
722           for(j=0; j<100 && i+j<=nr; j++){      \
723             printf("%s \\\n",deps[i+j]);        \
724           }                                     \
725           printf("\nendif\n");                  \
726           i+=j;                                 \
727         }                                       \
728 }'
729 DEPEND_EXTEND_FUNC = ( $(DEPEND_EXTEND_CMD) < $(1) > $(2).new && rm -f $(1) && mv $(2).new $(2) ) || ( rm -f $(1) $(2).new $(2) ; $(DEPEND_IGNORE_ERRORS) )
730 DEPEND_FLAG = -MD
731
732 .PHONY: FORCE
733 endif # CONFIG_HAVE_LDSO empty
734 DEPFLAGS   = -MD -MF $(@D)/.$(@F).d
735 DEPFLAGS_F = -cpp
736
737 include $(L4DIR)/mk/rules.inc
738
739 # generate rules to compile %.cc files to %.o, %.s.o etc
740 $(eval $(call BID_GENERATE_CXX_MAKE_RULES,cc))
741 # generate rules to compile %.cpp files to %.o, %.s.o etc
742 $(if $(BID_ALLOW_CPP_AS_CPLUSPLUS_FILE),$(eval $(call BID_GENERATE_CXX_MAKE_RULES,cpp)))
743 # generate rules to compile %.c files to %.o, %.s.o etc
744 $(eval $(call BID_GENERATE_C_MAKE_RULES,c))
745 # generate rules to compile %.f90 files to %.o, %.s.o etc
746 $(foreach e,$(FORTRAN_FILE_EXTENSIONS),$(eval $(call BID_GENERATE_F_MAKE_RULES,$(subst .,,$e))))
747 # generate rules to compile %.S files to %.o, %.s.o etc
748 $(eval $(call BID_GENERATE_DEFAULT_MAKE_RULES,%,%.S,AS))
749
750 # Reset implicit rules, mind the TAB.
751 define reset_implicit_rule =
752 %: $(1)
753         
754 endef
755
756 $(foreach e,.c .cc .cpp .S $(FORTRAN_FILE_EXTENSIONS),$(eval $(call reset_implicit_rule,$e)))
757
758 $(eval $(call BID_GENERATE_I_MAKE_RULE,%.i,%.c,$(CC),$(CFLAGS)))
759 $(eval $(call BID_GENERATE_I_MAKE_RULE,%.s.i,%.c,$(CC),$(CFLAGS) $(PICFLAGS)))
760 $(eval $(call BID_GENERATE_I_MAKE_RULE,%.i,%.cc,$(CXX),$(CXXFLAGS)))
761 $(eval $(call BID_GENERATE_I_MAKE_RULE,%.s.i,%.cc,$(CXX),$(CXXFLAGS) $(PICFLAGS)))
762 $(if $(BID_ALLOW_CPP_AS_CPLUSPLUS_FILE),$(eval $(call BID_GENERATE_I_MAKE_RULE,%.i,%.cpp,$(CXX),$(CXXFLAGS))))
763 $(if $(BID_ALLOW_CPP_AS_CPLUSPLUS_FILE),$(eval $(call BID_GENERATE_I_MAKE_RULE,%.s.i,%.cpp,$(CXX),$(CXXFLAGS) $(PICFLAGS))))
764 $(eval $(call BID_GENERATE_I_MAKE_RULE,%.i,%.S,$(CC),$(ASFLAGS)))
765
766 $(eval $(call BID_GENERATE_S_MAKE_RULE,%.c,$(CC),$(CFLAGS)))
767 $(eval $(call BID_GENERATE_S_MAKE_RULE,%.cc,$(CC),$(CXXFLAGS)))
768 $(if $(BID_ALLOW_CPP_AS_CPLUSPLUS_FILE),$(eval $(call BID_GENERATE_S_MAKE_RULE,%.cpp,$(CC),$(CXXFLAGS))))
769
770 %.c:    %.y
771         @$(GEN_MESSAGE)
772         $(VERBOSE)$(CONFIG_YACC) $(YFLAGS) $(call absfilename,$<)
773         $(VERBOSE)mv -f y.tab.c $@
774         $(VERBOSE)if [ -f y.tab.h ]; then mv -f y.tab.h $(@:.c=.h); fi
775
776 %.c:    %.l
777         @$(COMP_MESSAGE)
778         $(VERBOSE)$(CONFIG_LEX) -o$@ $(call absfilename,$<)
779
780 %.dpi:  %.dpe
781         @$(GEN_MESSAGE)
782         $(VERBOSE)$(call MAKEDEP,perl) $(GEN_DOPECODE) $< >$@
783
784 DEPS    += $(foreach file,$(ALLOBJS), $(dir $(file)).$(notdir $(file)).d)
785 DEPS    += $(foreach file,$(ALLDPI), $(dir $(file)).$(notdir $(file)).d)
786
787 # Common clean Rules
788
789 clean cleanall::
790         $(VERBOSE)$(RM) $(strip $(filter-out $(KEEP_ON_CLEAN),\
791                 $(wildcard *.dpi) $(wildcard *.o) $(wildcard *.i) \
792                 $(wildcard *.S) $(ALLOBJS) $(DEL_ON_CLEAN)))
793
794 # clean: delete all temporary editor files, objects, binaries
795 #        and most generated files
796 cleanall::
797         $(VERBOSE)$(RM) $(TARGET) $(wildcard .*.d) $(wildcard $(BID_OBJ_Makefile).inc)
798
799 .PHONY: scrub clean cleanall disasm
800
801 endif   # $(SYSTEM) is defined
802
803 # General rules
804
805 # scrub: delete temporary editor files and stuff like this
806 #        can be extended by lokals
807 scrub cleanall::
808         $(VERBOSE)$(SCRUB)
809