aboutsummaryrefslogtreecommitdiffstats
path: root/Makefile
diff options
context:
space:
mode:
authorSam Ravnborg <sam@mars.(none)>2005-07-25 16:10:36 -0400
committerSam Ravnborg <sam@mars.(none)>2005-07-25 16:10:36 -0400
commit8ec4b4ff1c89bb280e662b84eba503ca44abe836 (patch)
treed520638dd0288aba3cff6875928dfa7b7b20d2f1 /Makefile
parent7c6b155fb49fbc63e0b30a1d49552693c0b45be7 (diff)
kbuild: introduce Kbuild.include
Kbuild.include is a placeholder for definitions originally present in both the top-level Makefile and scripts/Makefile.build. There were a slight difference in the filechk definition, so the most videly used version was kept and usr/Makefile was adopted for this syntax. Signed-off-by: Sam Ravnborg <sam@ravnborg.org> ---
Diffstat (limited to 'Makefile')
-rw-r--r--Makefile74
1 files changed, 3 insertions, 71 deletions
diff --git a/Makefile b/Makefile
index 7e4624a14586..7c607dc64479 100644
--- a/Makefile
+++ b/Makefile
@@ -309,6 +309,9 @@ cc-version = $(shell $(CONFIG_SHELL) $(srctree)/scripts/gcc-version.sh \
309# Look for make include files relative to root of kernel src 309# Look for make include files relative to root of kernel src
310MAKEFLAGS += --include-dir=$(srctree) 310MAKEFLAGS += --include-dir=$(srctree)
311 311
312# We need some generic definitions
313include scripts/Kbuild.include
314
312# For maximum performance (+ possibly random breakage, uncomment 315# For maximum performance (+ possibly random breakage, uncomment
313# the following) 316# the following)
314 317
@@ -367,11 +370,6 @@ export AFLAGS AFLAGS_KERNEL AFLAGS_MODULE
367# even be read-only. 370# even be read-only.
368export MODVERDIR := $(if $(KBUILD_EXTMOD),$(firstword $(KBUILD_EXTMOD))/).tmp_versions 371export MODVERDIR := $(if $(KBUILD_EXTMOD),$(firstword $(KBUILD_EXTMOD))/).tmp_versions
369 372
370# The temporary file to save gcc -MD generated dependencies must not
371# contain a comma
372comma := ,
373depfile = $(subst $(comma),_,$(@D)/.$(@F).d)
374
375# Files to ignore in find ... statements 373# Files to ignore in find ... statements
376 374
377RCS_FIND_IGNORE := \( -name SCCS -o -name BitKeeper -o -name .svn -o -name CVS -o -name .pc \) -prune -o 375RCS_FIND_IGNORE := \( -name SCCS -o -name BitKeeper -o -name .svn -o -name CVS -o -name .pc \) -prune -o
@@ -1285,72 +1283,6 @@ ifneq ($(cmd_files),)
1285 include $(cmd_files) 1283 include $(cmd_files)
1286endif 1284endif
1287 1285
1288# Execute command and generate cmd file
1289if_changed = $(if $(strip $? \
1290 $(filter-out $(cmd_$(1)),$(cmd_$@))\
1291 $(filter-out $(cmd_$@),$(cmd_$(1)))),\
1292 @set -e; \
1293 $(if $($(quiet)cmd_$(1)),echo ' $(subst ','\'',$($(quiet)cmd_$(1)))';) \
1294 $(cmd_$(1)); \
1295 echo 'cmd_$@ := $(subst $$,$$$$,$(subst ','\'',$(cmd_$(1))))' > $(@D)/.$(@F).cmd)
1296
1297
1298# execute the command and also postprocess generated .d dependencies
1299# file
1300if_changed_dep = $(if $(strip $? $(filter-out FORCE $(wildcard $^),$^)\
1301 $(filter-out $(cmd_$(1)),$(cmd_$@))\
1302 $(filter-out $(cmd_$@),$(cmd_$(1)))),\
1303 $(Q)set -e; \
1304 $(if $($(quiet)cmd_$(1)),echo ' $(subst ','\'',$($(quiet)cmd_$(1)))';) \
1305 $(cmd_$(1)); \
1306 scripts/basic/fixdep $(depfile) $@ '$(subst $$,$$$$,$(subst ','\'',$(cmd_$(1))))' > $(@D)/.$(@F).tmp; \
1307 rm -f $(depfile); \
1308 mv -f $(@D)/.$(@F).tmp $(@D)/.$(@F).cmd)
1309
1310# Usage: $(call if_changed_rule,foo)
1311# will check if $(cmd_foo) changed, or any of the prequisites changed,
1312# and if so will execute $(rule_foo)
1313
1314if_changed_rule = $(if $(strip $? \
1315 $(filter-out $(cmd_$(1)),$(cmd_$(@F)))\
1316 $(filter-out $(cmd_$(@F)),$(cmd_$(1)))),\
1317 $(Q)$(rule_$(1)))
1318
1319# If quiet is set, only print short version of command
1320
1321cmd = @$(if $($(quiet)cmd_$(1)),echo ' $($(quiet)cmd_$(1))' &&) $(cmd_$(1))
1322
1323# filechk is used to check if the content of a generated file is updated.
1324# Sample usage:
1325# define filechk_sample
1326# echo $KERNELRELEASE
1327# endef
1328# version.h : Makefile
1329# $(call filechk,sample)
1330# The rule defined shall write to stdout the content of the new file.
1331# The existing file will be compared with the new one.
1332# - If no file exist it is created
1333# - If the content differ the new file is used
1334# - If they are equal no change, and no timestamp update
1335
1336define filechk
1337 @set -e; \
1338 echo ' CHK $@'; \
1339 mkdir -p $(dir $@); \
1340 $(filechk_$(1)) < $< > $@.tmp; \
1341 if [ -r $@ ] && cmp -s $@ $@.tmp; then \
1342 rm -f $@.tmp; \
1343 else \
1344 echo ' UPD $@'; \
1345 mv -f $@.tmp $@; \
1346 fi
1347endef
1348
1349# Shorthand for $(Q)$(MAKE) -f scripts/Makefile.build obj=dir
1350# Usage:
1351# $(Q)$(MAKE) $(build)=dir
1352build := -f $(if $(KBUILD_SRC),$(srctree)/)scripts/Makefile.build obj
1353
1354# Shorthand for $(Q)$(MAKE) -f scripts/Makefile.clean obj=dir 1286# Shorthand for $(Q)$(MAKE) -f scripts/Makefile.clean obj=dir
1355# Usage: 1287# Usage:
1356# $(Q)$(MAKE) $(clean)=dir 1288# $(Q)$(MAKE) $(clean)=dir