X-Git-Url: https://git.sur5r.net/?a=blobdiff_plain;f=scripts%2FMakefile.build;h=4a6ed345928eb8ec3b55bca49fe91ae8ab26c8a0;hb=c444afbbefa103d567f197393d39ec0fcca21a0c;hp=59361f4d7ab4d0d53eb462af0705a5de828f0907;hpb=01072b44db66d31dc397ccccd1bf8ccf98e39094;p=u-boot diff --git a/scripts/Makefile.build b/scripts/Makefile.build index 59361f4d7a..4a6ed34592 100644 --- a/scripts/Makefile.build +++ b/scripts/Makefile.build @@ -1,16 +1,17 @@ +# SPDX-License-Identifier: GPL-2.0 # ========================================================================== # Building # ========================================================================== # Modified for U-Boot -ifeq ($(CONFIG_TPL_BUILD),y) - src := $(patsubst tpl/%,%,$(obj)) -else - ifeq ($(CONFIG_SPL_BUILD),y) - src := $(patsubst spl/%,%,$(obj)) - else - src := $(obj) - endif +prefix := tpl +src := $(patsubst $(prefix)/%,%,$(obj)) +ifeq ($(obj),$(src)) +prefix := spl +src := $(patsubst $(prefix)/%,%,$(obj)) +ifeq ($(obj),$(src)) +prefix := . +endif endif PHONY := __build @@ -40,26 +41,13 @@ subdir-asflags-y := subdir-ccflags-y := # Read auto.conf if it exists, otherwise ignore +# Modified for U-Boot -include include/config/auto.conf - -# Added for U-Boot: Load U-Boot configuration -ifeq ($(CONFIG_TPL_BUILD),y) - -include include/tpl-autoconf.mk -else - ifeq ($(CONFIG_SPL_BUILD),y) - -include include/spl-autoconf.mk - else - -include include/autoconf.mk - endif -endif +-include $(prefix)/include/autoconf.mk +include scripts/Makefile.uncmd_spl include scripts/Kbuild.include -# Added for U-Boot -# We must include config.mk after Kbuild.include -# so that some config.mk can use cc-option. -include config.mk - # For backward compatibility check that these variables do not change save-cflags := $(CFLAGS) @@ -68,6 +56,11 @@ kbuild-dir := $(if $(filter /%,$(src)),$(src),$(srctree)/$(src)) kbuild-file := $(if $(wildcard $(kbuild-dir)/Kbuild),$(kbuild-dir)/Kbuild,$(kbuild-dir)/Makefile) include $(kbuild-file) +# Added for U-Boot +asflags-y += $(PLATFORM_CPPFLAGS) +ccflags-y += $(PLATFORM_CPPFLAGS) +cppflags-y += $(PLATFORM_CPPFLAGS) + # If the save-* variables changed error out ifeq ($(KBUILD_NOPEDANTIC),) ifneq ("$(save-cflags)","$(CFLAGS)") @@ -75,57 +68,6 @@ ifeq ($(KBUILD_NOPEDANTIC),) endif endif -# -# make W=... settings -# -# W=1 - warnings that may be relevant and does not occur too often -# W=2 - warnings that occur quite often but may still be relevant -# W=3 - the more obscure warnings, can most likely be ignored -# -# $(call cc-option, -W...) handles gcc -W.. options which -# are not supported by all versions of the compiler -ifdef KBUILD_ENABLE_EXTRA_GCC_CHECKS -warning- := $(empty) - -warning-1 := -Wextra -Wunused -Wno-unused-parameter -warning-1 += -Wmissing-declarations -warning-1 += -Wmissing-format-attribute -warning-1 += -Wmissing-prototypes -warning-1 += -Wold-style-definition -warning-1 += $(call cc-option, -Wmissing-include-dirs) -warning-1 += $(call cc-option, -Wunused-but-set-variable) -warning-1 += $(call cc-disable-warning, missing-field-initializers) - -warning-2 := -Waggregate-return -warning-2 += -Wcast-align -warning-2 += -Wdisabled-optimization -warning-2 += -Wnested-externs -warning-2 += -Wshadow -warning-2 += $(call cc-option, -Wlogical-op) -warning-2 += $(call cc-option, -Wmissing-field-initializers) - -warning-3 := -Wbad-function-cast -warning-3 += -Wcast-qual -warning-3 += -Wconversion -warning-3 += -Wpacked -warning-3 += -Wpadded -warning-3 += -Wpointer-arith -warning-3 += -Wredundant-decls -warning-3 += -Wswitch-default -warning-3 += $(call cc-option, -Wpacked-bitfield-compat) -warning-3 += $(call cc-option, -Wvla) - -warning := $(warning-$(findstring 1, $(KBUILD_ENABLE_EXTRA_GCC_CHECKS))) -warning += $(warning-$(findstring 2, $(KBUILD_ENABLE_EXTRA_GCC_CHECKS))) -warning += $(warning-$(findstring 3, $(KBUILD_ENABLE_EXTRA_GCC_CHECKS))) - -ifeq ("$(strip $(warning))","") - $(error W=$(KBUILD_ENABLE_EXTRA_GCC_CHECKS) is unknown) -endif - -KBUILD_CFLAGS += $(warning) -endif - include scripts/Makefile.lib ifdef host-progs @@ -157,11 +99,11 @@ endif # =========================================================================== -ifneq ($(strip $(lib-y) $(lib-m) $(lib-n) $(lib-)),) +ifneq ($(strip $(lib-y) $(lib-m) $(lib-)),) lib-target := $(obj)/lib.a endif -ifneq ($(strip $(obj-y) $(obj-m) $(obj-n) $(obj-) $(subdir-m) $(lib-target)),) +ifneq ($(strip $(obj-y) $(obj-m) $(obj-) $(subdir-m) $(lib-target)),) builtin-target := $(obj)/built-in.o endif @@ -225,7 +167,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) @@ -312,8 +254,9 @@ sub_cmd_record_mcount = set -e ; perl $(srctree)/scripts/recordmcount.pl "$(ARCH "$(if $(part-of-module),1,0)" "$(@)"; recordmcount_source := $(srctree)/scripts/recordmcount.pl endif -cmd_record_mcount = \ - if [ "$(findstring -pg,$(_c_flags))" = "-pg" ]; then \ +cmd_record_mcount = \ + if [ "$(findstring $(CC_FLAGS_FTRACE),$(_c_flags))" = \ + "$(CC_FLAGS_FTRACE)" ]; then \ $(sub_cmd_record_mcount) \ fi; endif @@ -359,7 +302,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) @@ -453,23 +396,21 @@ 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) quiet_cmd_link_multi-m = LD [M] $@ cmd_link_multi-m = $(cmd_link_multi-y) -# We would rather have a list of rules like -# foo.o: $(foo-objs) -# but that's not so easy, so we rather make all composite objects depend -# on the set of all their parts -$(multi-used-y) : %.o: $(multi-objs-y) FORCE +$(multi-used-y): FORCE $(call if_changed,link_multi-y) +$(call multi_depend, $(multi-used-y), .o, -objs -y) -$(multi-used-m) : %.o: $(multi-objs-m) FORCE +$(multi-used-m): FORCE $(call if_changed,link_multi-m) @{ echo $(@:.o=.ko); echo $(link_multi_deps); } > $(MODVERDIR)/$(@F:.o=.mod) +$(call multi_depend, $(multi-used-m), .o, -objs -y) targets += $(multi-used-y) $(multi-used-m)