diff options
author | Linus Torvalds <torvalds@g5.osdl.org> | 2006-03-25 11:48:48 -0500 |
---|---|---|
committer | Linus Torvalds <torvalds@g5.osdl.org> | 2006-03-25 11:48:48 -0500 |
commit | 2e1ca21d46aaef95101723fa402f39d3a95aba59 (patch) | |
tree | cd95efefb9ccb6ab4ac0589d01c06cdfc22cc989 /scripts/Kbuild.include | |
parent | 315ab19a6d12d6af7b6957090822f3057ab7e80f (diff) | |
parent | eae0f536f640bb95f2ad437a57c40c7d5683d1ac (diff) |
Merge master.kernel.org:/pub/scm/linux/kernel/git/sam/kbuild
* master.kernel.org:/pub/scm/linux/kernel/git/sam/kbuild: (46 commits)
kbuild: remove obsoleted scripts/reference_* files
kbuild: fix make help & make *pkg
kconfig: fix time ordering of writes to .kconfig.d and include/linux/autoconf.h
Kconfig: remove the CONFIG_CC_ALIGN_* options
kbuild: add -fverbose-asm to i386 Makefile
kbuild: clean-up genksyms
kbuild: Lindent genksyms.c
kbuild: fix genksyms build error
kbuild: in makefile.txt note that Makefile is preferred name for kbuild files
kbuild: replace PHONY with FORCE
kbuild: Fix bug in crc symbol generating of kernel and modules
kbuild: change kbuild to not rely on incorrect GNU make behavior
kbuild: when warning symbols exported twice now tell user this is the problem
kbuild: fix make dir/file.xx when asm symlink is missing
kbuild: in the section mismatch check try harder to find symbols
kbuild: fix section mismatch check for unwind on IA64
kbuild: kill false positives from section mismatch warnings for powerpc
kbuild: kill trailing whitespace in modpost & friends
kbuild: small update of allnoconfig description
kbuild: make namespace.pl CROSS_COMPILE happy
...
Trivial conflict in arch/ppc/boot/Makefile manually fixed up
Diffstat (limited to 'scripts/Kbuild.include')
-rw-r--r-- | scripts/Kbuild.include | 65 |
1 files changed, 52 insertions, 13 deletions
diff --git a/scripts/Kbuild.include b/scripts/Kbuild.include index 0168d6c37075..59620b1554e0 100644 --- a/scripts/Kbuild.include +++ b/scripts/Kbuild.include | |||
@@ -44,6 +44,43 @@ define filechk | |||
44 | fi | 44 | fi |
45 | endef | 45 | endef |
46 | 46 | ||
47 | ###### | ||
48 | # gcc support functions | ||
49 | # See documentation in Documentation/kbuild/makefiles.txt | ||
50 | |||
51 | # as-option | ||
52 | # Usage: cflags-y += $(call as-option, -Wa$(comma)-isa=foo,) | ||
53 | |||
54 | as-option = $(shell if $(CC) $(CFLAGS) $(1) -Wa,-Z -c -o /dev/null \ | ||
55 | -xassembler /dev/null > /dev/null 2>&1; then echo "$(1)"; \ | ||
56 | else echo "$(2)"; fi ;) | ||
57 | |||
58 | # cc-option | ||
59 | # Usage: cflags-y += $(call cc-option, -march=winchip-c6, -march=i586) | ||
60 | |||
61 | cc-option = $(shell if $(CC) $(CFLAGS) $(1) -S -o /dev/null -xc /dev/null \ | ||
62 | > /dev/null 2>&1; then echo "$(1)"; else echo "$(2)"; fi ;) | ||
63 | |||
64 | # cc-option-yn | ||
65 | # Usage: flag := $(call cc-option-yn, -march=winchip-c6) | ||
66 | cc-option-yn = $(shell if $(CC) $(CFLAGS) $(1) -S -o /dev/null -xc /dev/null \ | ||
67 | > /dev/null 2>&1; then echo "y"; else echo "n"; fi;) | ||
68 | |||
69 | # cc-option-align | ||
70 | # Prefix align with either -falign or -malign | ||
71 | cc-option-align = $(subst -functions=0,,\ | ||
72 | $(call cc-option,-falign-functions=0,-malign-functions=0)) | ||
73 | |||
74 | # cc-version | ||
75 | # Usage gcc-ver := $(call cc-version, $(CC)) | ||
76 | cc-version = $(shell $(CONFIG_SHELL) $(srctree)/scripts/gcc-version.sh \ | ||
77 | $(if $(1), $(1), $(CC))) | ||
78 | |||
79 | # cc-ifversion | ||
80 | # Usage: EXTRA_CFLAGS += $(call cc-ifversion, -lt, 0402, -O1) | ||
81 | cc-ifversion = $(shell if [ $(call cc-version, $(CC)) $(1) $(2) ]; then \ | ||
82 | echo $(3); fi;) | ||
83 | |||
47 | ### | 84 | ### |
48 | # Shorthand for $(Q)$(MAKE) -f scripts/Makefile.build obj= | 85 | # Shorthand for $(Q)$(MAKE) -f scripts/Makefile.build obj= |
49 | # Usage: | 86 | # Usage: |
@@ -51,8 +88,7 @@ endef | |||
51 | build := -f $(if $(KBUILD_SRC),$(srctree)/)scripts/Makefile.build obj | 88 | build := -f $(if $(KBUILD_SRC),$(srctree)/)scripts/Makefile.build obj |
52 | 89 | ||
53 | # If quiet is set, only print short version of command | 90 | # If quiet is set, only print short version of command |
54 | cmd = @$(if $($(quiet)cmd_$(1)),\ | 91 | cmd = @$(echo-cmd) $(cmd_$(1)) |
55 | echo ' $(call escsq,$($(quiet)cmd_$(1)))' &&) $(cmd_$(1)) | ||
56 | 92 | ||
57 | # Add $(obj)/ for paths that is not absolute | 93 | # Add $(obj)/ for paths that is not absolute |
58 | objectify = $(foreach o,$(1),$(if $(filter /%,$(o)),$(o),$(obj)/$(o))) | 94 | objectify = $(foreach o,$(1),$(if $(filter /%,$(o)),$(o),$(obj)/$(o))) |
@@ -75,30 +111,33 @@ endif | |||
75 | echo-cmd = $(if $($(quiet)cmd_$(1)), \ | 111 | echo-cmd = $(if $($(quiet)cmd_$(1)), \ |
76 | echo ' $(call escsq,$($(quiet)cmd_$(1)))';) | 112 | echo ' $(call escsq,$($(quiet)cmd_$(1)))';) |
77 | 113 | ||
114 | make-cmd = $(subst \#,\\\#,$(subst $$,$$$$,$(call escsq,$(cmd_$(1))))) | ||
115 | |||
78 | # function to only execute the passed command if necessary | 116 | # function to only execute the passed command if necessary |
79 | # >'< substitution is for echo to work, >$< substitution to preserve $ when reloading .cmd file | 117 | # >'< substitution is for echo to work, >$< substitution to preserve $ when reloading .cmd file |
80 | # note: when using inline perl scripts [perl -e '...$$t=1;...'] in $(cmd_xxx) double $$ your perl vars | 118 | # note: when using inline perl scripts [perl -e '...$$t=1;...'] in $(cmd_xxx) double $$ your perl vars |
81 | # | 119 | # |
82 | if_changed = $(if $(strip $? $(call arg-check, $(cmd_$(1)), $(cmd_$@)) ), \ | 120 | if_changed = $(if $(strip $(filter-out $(PHONY),$?) \ |
121 | $(call arg-check, $(cmd_$(1)), $(cmd_$@)) ), \ | ||
83 | @set -e; \ | 122 | @set -e; \ |
84 | $(echo-cmd) \ | 123 | $(echo-cmd) $(cmd_$(1)); \ |
85 | $(cmd_$(1)); \ | 124 | echo 'cmd_$@ := $(make-cmd)' > $(@D)/.$(@F).cmd) |
86 | echo 'cmd_$@ := $(subst $$,$$$$,$(call escsq,$(cmd_$(1))))' > $(@D)/.$(@F).cmd) | ||
87 | 125 | ||
88 | # execute the command and also postprocess generated .d dependencies | 126 | # execute the command and also postprocess generated .d dependencies |
89 | # file | 127 | # file |
90 | if_changed_dep = $(if $(strip $? $(filter-out FORCE $(wildcard $^),$^)\ | 128 | if_changed_dep = $(if $(strip $(filter-out $(PHONY),$?) \ |
91 | $(call arg-check, $(cmd_$(1)), $(cmd_$@)) ), \ | 129 | $(filter-out FORCE $(wildcard $^),$^) \ |
130 | $(call arg-check, $(cmd_$(1)), $(cmd_$@)) ), \ | ||
92 | @set -e; \ | 131 | @set -e; \ |
93 | $(echo-cmd) \ | 132 | $(echo-cmd) $(cmd_$(1)); \ |
94 | $(cmd_$(1)); \ | 133 | scripts/basic/fixdep $(depfile) $@ '$(make-cmd)' > $(@D)/.$(@F).tmp; \ |
95 | scripts/basic/fixdep $(depfile) $@ '$(subst $$,$$$$,$(call escsq,$(cmd_$(1))))' > $(@D)/.$(@F).tmp; \ | ||
96 | rm -f $(depfile); \ | 134 | rm -f $(depfile); \ |
97 | mv -f $(@D)/.$(@F).tmp $(@D)/.$(@F).cmd) | 135 | mv -f $(@D)/.$(@F).tmp $(@D)/.$(@F).cmd) |
98 | 136 | ||
99 | # Usage: $(call if_changed_rule,foo) | 137 | # Usage: $(call if_changed_rule,foo) |
100 | # will check if $(cmd_foo) changed, or any of the prequisites changed, | 138 | # will check if $(cmd_foo) changed, or any of the prequisites changed, |
101 | # and if so will execute $(rule_foo) | 139 | # and if so will execute $(rule_foo) |
102 | if_changed_rule = $(if $(strip $? $(call arg-check, $(cmd_$(1)), $(cmd_$@)) ),\ | 140 | if_changed_rule = $(if $(strip $(filter-out $(PHONY),$?) \ |
141 | $(call arg-check, $(cmd_$(1)), $(cmd_$@)) ),\ | ||
103 | @set -e; \ | 142 | @set -e; \ |
104 | $(rule_$(1))) | 143 | $(rule_$(1))) |