diff options
Diffstat (limited to 'scripts/Makefile.build')
| -rw-r--r-- | scripts/Makefile.build | 51 | 
1 files changed, 37 insertions, 14 deletions
diff --git a/scripts/Makefile.build b/scripts/Makefile.build index 5ad25e17b6c..bf3e6778cd7 100644 --- a/scripts/Makefile.build +++ b/scripts/Makefile.build @@ -46,9 +46,10 @@ include $(kbuild-file)  # If the save-* variables changed error out  ifeq ($(KBUILD_NOPEDANTIC),)          ifneq ("$(save-cflags)","$(CFLAGS)") -                $(error CFLAGS was changed in "$(kbuild-file)". Fix it to use EXTRA_CFLAGS) +                $(error CFLAGS was changed in "$(kbuild-file)". Fix it to use ccflags-y)          endif  endif +  include scripts/Makefile.lib  ifdef host-progs @@ -146,7 +147,7 @@ $(multi-objs-y:.o=.s)   : modname = $(modname-multi)  $(multi-objs-y:.o=.lst) : modname = $(modname-multi)  quiet_cmd_cc_s_c = CC $(quiet_modtag)  $@ -cmd_cc_s_c       = $(CC) $(c_flags) -fverbose-asm -S -o $@ $< +cmd_cc_s_c       = $(CC) $(c_flags) $(DISABLE_LTO) -fverbose-asm -S -o $@ $<  $(obj)/%.s: $(src)/%.c FORCE  	$(call if_changed_dep,cc_s_c) @@ -159,7 +160,8 @@ $(obj)/%.i: $(src)/%.c FORCE  cmd_gensymtypes =                                                           \      $(CPP) -D__GENKSYMS__ $(c_flags) $< |                                   \ -    $(GENKSYMS) $(if $(1), -T $(2)) -a $(ARCH)                              \ +    $(GENKSYMS) $(if $(1), -T $(2))                                         \ +     $(patsubst y,-s _,$(CONFIG_HAVE_UNDERSCORE_SYMBOL_PREFIX))             \       $(if $(KBUILD_PRESERVE),-p)                                            \       -r $(firstword $(wildcard $(2:.symtypes=.symref) /dev/null)) @@ -210,21 +212,32 @@ endif  ifdef CONFIG_FTRACE_MCOUNT_RECORD  ifdef BUILD_C_RECORDMCOUNT +ifeq ("$(origin RECORDMCOUNT_WARN)", "command line") +  RECORDMCOUNT_FLAGS = -w +endif  # Due to recursion, we must skip empty.o.  # The empty.o file is created in the make process in order to determine  #  the target endianness and word size. It is made before all other C  #  files, including recordmcount. -cmd_record_mcount = if [ $(@) != "scripts/mod/empty.o" ]; then			\ -			$(objtree)/scripts/recordmcount "$(@)";			\ -		    fi; +sub_cmd_record_mcount =					\ +	if [ $(@) != "scripts/mod/empty.o" ]; then	\ +		$(objtree)/scripts/recordmcount $(RECORDMCOUNT_FLAGS) "$(@)";	\ +	fi; +recordmcount_source := $(srctree)/scripts/recordmcount.c \ +		    $(srctree)/scripts/recordmcount.h  else -cmd_record_mcount = set -e ; perl $(srctree)/scripts/recordmcount.pl "$(ARCH)" \ +sub_cmd_record_mcount = set -e ; perl $(srctree)/scripts/recordmcount.pl "$(ARCH)" \  	"$(if $(CONFIG_CPU_BIG_ENDIAN),big,little)" \  	"$(if $(CONFIG_64BIT),64,32)" \  	"$(OBJDUMP)" "$(OBJCOPY)" "$(CC) $(KBUILD_CFLAGS)" \  	"$(LD)" "$(NM)" "$(RM)" "$(MV)" \  	"$(if $(part-of-module),1,0)" "$(@)"; +recordmcount_source := $(srctree)/scripts/recordmcount.pl  endif +cmd_record_mcount = 						\ +	if [ "$(findstring -pg,$(_c_flags))" = "-pg" ]; then	\ +		$(sub_cmd_record_mcount)			\ +	fi;  endif  define rule_cc_o_c @@ -240,13 +253,13 @@ define rule_cc_o_c  endef  # Built-in and composite module parts -$(obj)/%.o: $(src)/%.c FORCE +$(obj)/%.o: $(src)/%.c $(recordmcount_source) FORCE  	$(call cmd,force_checksrc)  	$(call if_changed_rule,cc_o_c)  # Single-part modules are special since we need to mark them in $(MODVERDIR) -$(single-used-m): $(obj)/%.o: $(src)/%.c FORCE +$(single-used-m): $(obj)/%.o: $(src)/%.c $(recordmcount_source) FORCE  	$(call cmd,force_checksrc)  	$(call if_changed_rule,cc_o_c)  	@{ echo $(@:.o=.ko); echo $@; } > $(MODVERDIR)/$(@F:.o=.mod) @@ -268,7 +281,7 @@ $(real-objs-m)      : modkern_aflags := $(KBUILD_AFLAGS_MODULE) $(AFLAGS_MODULE)  $(real-objs-m:.o=.s): modkern_aflags := $(KBUILD_AFLAGS_MODULE) $(AFLAGS_MODULE)  quiet_cmd_as_s_S = CPP $(quiet_modtag) $@ -cmd_as_s_S       = $(CPP) $(a_flags)   -o $@ $<  +cmd_as_s_S       = $(CPP) $(a_flags)   -o $@ $<  $(obj)/%.s: $(src)/%.S FORCE  	$(call if_changed_dep,as_s_S) @@ -291,6 +304,17 @@ quiet_cmd_cpp_lds_S = LDS     $@  $(obj)/%.lds: $(src)/%.lds.S FORCE  	$(call if_changed_dep,cpp_lds_S) +# ASN.1 grammar +# --------------------------------------------------------------------------- +quiet_cmd_asn1_compiler = ASN.1   $@ +      cmd_asn1_compiler = $(objtree)/scripts/asn1_compiler $< \ +				$(subst .h,.c,$@) $(subst .c,.h,$@) + +.PRECIOUS: $(objtree)/$(obj)/%-asn1.c $(objtree)/$(obj)/%-asn1.h + +$(obj)/%-asn1.c $(obj)/%-asn1.h: $(src)/%.asn1 $(objtree)/scripts/asn1_compiler +	$(call cmd,asn1_compiler) +  # Build the compiled-in targets  # --------------------------------------------------------------------------- @@ -306,7 +330,7 @@ quiet_cmd_link_o_target = LD      $@  cmd_link_o_target = $(if $(strip $(obj-y)),\  		      $(LD) $(ld_flags) -r -o $@ $(filter $(obj-y), $^) \  		      $(cmd_secanalysis),\ -		      rm -f $@; $(AR) rcs $@) +		      rm -f $@; $(AR) rcs$(KBUILD_ARFLAGS) $@)  $(builtin-target): $(obj-y) FORCE  	$(call if_changed,link_o_target) @@ -332,7 +356,7 @@ $(modorder-target): $(subdir-ym) FORCE  #  ifdef lib-target  quiet_cmd_link_l_target = AR      $@ -cmd_link_l_target = rm -f $@; $(AR) rcs $@ $(lib-y) +cmd_link_l_target = rm -f $@; $(AR) rcs$(KBUILD_ARFLAGS) $@ $(lib-y)  $(lib-target): $(lib-y) FORCE  	$(call if_changed,link_l_target) @@ -351,7 +375,7 @@ link_multi_deps =                     \  $(filter $(addprefix $(obj)/,         \  $($(subst $(obj)/,,$(@:.o=-objs)))    \  $($(subst $(obj)/,,$(@:.o=-y)))), $^) -  +  quiet_cmd_link_multi-y = LD      $@  cmd_link_multi-y = $(LD) $(ld_flags) -r -o $@ $(link_multi_deps) $(cmd_secanalysis) @@ -398,7 +422,6 @@ ifneq ($(cmd_files),)    include $(cmd_files)  endif -  # Declare the contents of the .PHONY variable as phony.  We keep that  # information in a variable se we can use it in if_changed and friends.  | 
