diff options
Diffstat (limited to 'scripts')
| -rw-r--r-- | scripts/Kbuild.include | 65 | ||||
| -rw-r--r-- | scripts/Makefile.build | 27 | ||||
| -rw-r--r-- | scripts/Makefile.clean | 10 | ||||
| -rw-r--r-- | scripts/Makefile.modinst | 10 | ||||
| -rw-r--r-- | scripts/Makefile.modpost | 19 | ||||
| -rw-r--r-- | scripts/basic/fixdep.c | 14 | ||||
| -rwxr-xr-x | scripts/checkconfig.pl | 65 | ||||
| -rw-r--r-- | scripts/genksyms/genksyms.c | 843 | ||||
| -rw-r--r-- | scripts/genksyms/genksyms.h | 57 | ||||
| -rw-r--r-- | scripts/kconfig/Makefile | 6 | ||||
| -rw-r--r-- | scripts/kconfig/confdata.c | 2 | ||||
| -rw-r--r-- | scripts/kconfig/lxdialog/Makefile | 6 | ||||
| -rw-r--r-- | scripts/mkmakefile | 8 | ||||
| -rw-r--r-- | scripts/mod/file2alias.c | 17 | ||||
| -rw-r--r-- | scripts/mod/mk_elfconfig.c | 4 | ||||
| -rw-r--r-- | scripts/mod/modpost.c | 698 | ||||
| -rw-r--r-- | scripts/mod/modpost.h | 25 | ||||
| -rw-r--r-- | scripts/mod/sumversion.c | 32 | ||||
| -rw-r--r-- | scripts/namespace.pl | 4 | ||||
| -rw-r--r-- | scripts/package/Makefile | 20 | ||||
| -rw-r--r-- | scripts/reference_discarded.pl | 112 | ||||
| -rw-r--r-- | scripts/reference_init.pl | 108 |
22 files changed, 1139 insertions, 1013 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))) |
diff --git a/scripts/Makefile.build b/scripts/Makefile.build index c33e62bde6b0..e48e60da3040 100644 --- a/scripts/Makefile.build +++ b/scripts/Makefile.build | |||
| @@ -4,17 +4,18 @@ | |||
| 4 | 4 | ||
| 5 | src := $(obj) | 5 | src := $(obj) |
| 6 | 6 | ||
| 7 | .PHONY: __build | 7 | PHONY := __build |
| 8 | __build: | 8 | __build: |
| 9 | 9 | ||
| 10 | # Read .config if it exist, otherwise ignore | 10 | # Read .config if it exist, otherwise ignore |
| 11 | -include .config | 11 | -include .config |
| 12 | 12 | ||
| 13 | include scripts/Kbuild.include | ||
| 14 | |||
| 13 | # The filename Kbuild has precedence over Makefile | 15 | # The filename Kbuild has precedence over Makefile |
| 14 | kbuild-dir := $(if $(filter /%,$(src)),$(src),$(srctree)/$(src)) | 16 | kbuild-dir := $(if $(filter /%,$(src)),$(src),$(srctree)/$(src)) |
| 15 | include $(if $(wildcard $(kbuild-dir)/Kbuild), $(kbuild-dir)/Kbuild, $(kbuild-dir)/Makefile) | 17 | include $(if $(wildcard $(kbuild-dir)/Kbuild), $(kbuild-dir)/Kbuild, $(kbuild-dir)/Makefile) |
| 16 | 18 | ||
| 17 | include scripts/Kbuild.include | ||
| 18 | include scripts/Makefile.lib | 19 | include scripts/Makefile.lib |
| 19 | 20 | ||
| 20 | ifdef host-progs | 21 | ifdef host-progs |
| @@ -128,7 +129,7 @@ $(multi-objs-y:.o=.s) : modname = $(modname-multi) | |||
| 128 | $(multi-objs-y:.o=.lst) : modname = $(modname-multi) | 129 | $(multi-objs-y:.o=.lst) : modname = $(modname-multi) |
| 129 | 130 | ||
| 130 | quiet_cmd_cc_s_c = CC $(quiet_modtag) $@ | 131 | quiet_cmd_cc_s_c = CC $(quiet_modtag) $@ |
| 131 | cmd_cc_s_c = $(CC) $(c_flags) -S -o $@ $< | 132 | cmd_cc_s_c = $(CC) $(c_flags) -fverbose-asm -S -o $@ $< |
| 132 | 133 | ||
| 133 | %.s: %.c FORCE | 134 | %.s: %.c FORCE |
| 134 | $(call if_changed_dep,cc_s_c) | 135 | $(call if_changed_dep,cc_s_c) |
| @@ -165,7 +166,7 @@ cmd_cc_o_c = $(CC) $(c_flags) -c -o $(@D)/.tmp_$(@F) $< | |||
| 165 | cmd_modversions = \ | 166 | cmd_modversions = \ |
| 166 | if $(OBJDUMP) -h $(@D)/.tmp_$(@F) | grep -q __ksymtab; then \ | 167 | if $(OBJDUMP) -h $(@D)/.tmp_$(@F) | grep -q __ksymtab; then \ |
| 167 | $(CPP) -D__GENKSYMS__ $(c_flags) $< \ | 168 | $(CPP) -D__GENKSYMS__ $(c_flags) $< \ |
| 168 | | $(GENKSYMS) \ | 169 | | $(GENKSYMS) -a $(ARCH) \ |
| 169 | > $(@D)/.tmp_$(@F:.o=.ver); \ | 170 | > $(@D)/.tmp_$(@F:.o=.ver); \ |
| 170 | \ | 171 | \ |
| 171 | $(LD) $(LDFLAGS) -r -o $@ $(@D)/.tmp_$(@F) \ | ||
