Commit 6825a95b0ba72c4e5667d02d8b31986e2e9abd5a

Authored by Masahiro Yamada
Committed by Tom Rini
1 parent 22433fc54b

kbuild: use Linux Kernel build scripts

Now we are ready to switch over to real Kbuild.

This commit disables temporary scripts:
  scripts/{Makefile.build.tmp, Makefile.host.tmp}
and enables real Kbuild scripts:
  scripts/{Makefile.build,Makefile.host,Makefile.lib}.

This switch is triggered by the line in scripts/Kbuild.include
  -build := -f $(if $(KBUILD_SRC),$(srctree)/)scripts/Makefile.build.tmp obj
  +build := -f $(if $(KBUILD_SRC),$(srctree)/)scripts/Makefile.build obj

We need to adjust some build scripts for U-Boot.
But smaller amount of modification is preferable.

Additionally, we need to fix compiler flags which are
locally added or removed.

In Kbuild, it is not allowed to change CFLAGS locally.
Instead, ccflags-y, asflags-y, cppflags-y,
CFLAGS_$(basetarget).o, CFLAGS_REMOVE_$(basetarget).o
are prepared for that purpose.

Signed-off-by: Masahiro Yamada <yamada.m@jp.panasonic.com>
Tested-by: Gerhard Sittig <gsi@denx.de>

Showing 77 changed files with 526 additions and 325 deletions Side-by-side Diff

... ... @@ -43,6 +43,78 @@
43 43 XECHO = :
44 44 endif
45 45  
  46 +# *DOCUMENTATION*
  47 +# To see a list of typical targets execute "make help"
  48 +# More info can be located in ./README
  49 +# Comments in this file are targeted only to the developer, do not
  50 +# expect to learn how to build the kernel reading this file.
  51 +
  52 +# Do not:
  53 +# o use make's built-in rules and variables
  54 +# (this increases performance and avoids hard-to-debug behaviour);
  55 +# o print "Entering directory ...";
  56 +MAKEFLAGS += -rR --no-print-directory
  57 +
  58 +# Avoid funny character set dependencies
  59 +unexport LC_ALL
  60 +LC_COLLATE=C
  61 +LC_NUMERIC=C
  62 +export LC_COLLATE LC_NUMERIC
  63 +
  64 +# We are using a recursive build, so we need to do a little thinking
  65 +# to get the ordering right.
  66 +#
  67 +# Most importantly: sub-Makefiles should only ever modify files in
  68 +# their own directory. If in some directory we have a dependency on
  69 +# a file in another dir (which doesn't happen often, but it's often
  70 +# unavoidable when linking the built-in.o targets which finally
  71 +# turn into vmlinux), we will call a sub make in that other dir, and
  72 +# after that we are sure that everything which is in that other dir
  73 +# is now up to date.
  74 +#
  75 +# The only cases where we need to modify files which have global
  76 +# effects are thus separated out and done before the recursive
  77 +# descending is started. They are now explicitly listed as the
  78 +# prepare rule.
  79 +
  80 +# To put more focus on warnings, be less verbose as default
  81 +# Use 'make V=1' to see the full commands
  82 +
  83 +ifeq ("$(origin V)", "command line")
  84 + KBUILD_VERBOSE = $(V)
  85 +endif
  86 +ifndef KBUILD_VERBOSE
  87 + KBUILD_VERBOSE = 0
  88 +endif
  89 +
  90 +# Call a source code checker (by default, "sparse") as part of the
  91 +# C compilation.
  92 +#
  93 +# Use 'make C=1' to enable checking of only re-compiled files.
  94 +# Use 'make C=2' to enable checking of *all* source files, regardless
  95 +# of whether they are re-compiled or not.
  96 +#
  97 +# See the file "Documentation/sparse.txt" for more details, including
  98 +# where to get the "sparse" utility.
  99 +
  100 +ifeq ("$(origin C)", "command line")
  101 + KBUILD_CHECKSRC = $(C)
  102 +endif
  103 +ifndef KBUILD_CHECKSRC
  104 + KBUILD_CHECKSRC = 0
  105 +endif
  106 +
  107 +# Use make M=dir to specify directory of external module to build
  108 +# Old syntax make ... SUBDIRS=$PWD is still supported
  109 +# Setting the environment variable KBUILD_EXTMOD take precedence
  110 +ifdef SUBDIRS
  111 + KBUILD_EXTMOD ?= $(SUBDIRS)
  112 +endif
  113 +
  114 +ifeq ("$(origin M)", "command line")
  115 + KBUILD_EXTMOD := $(M)
  116 +endif
  117 +
46 118 # kbuild supports saving output files in a separate directory.
47 119 # To locate output files in a separate directory two syntaxes are supported.
48 120 # In both cases the working directory must be the root of the kernel src.
49 121  
50 122  
... ... @@ -107,8 +179,14 @@
107 179 # We process the rest of the Makefile if this is the final invocation of make
108 180 ifeq ($(skip-makefile),)
109 181  
  182 +# If building an external module we do not care about the all: rule
  183 +# but instead _all depend on modules
110 184 PHONY += all
  185 +ifeq ($(KBUILD_EXTMOD),)
111 186 _all: all
  187 +else
  188 +_all: modules
  189 +endif
112 190  
113 191 srctree := $(if $(KBUILD_SRC),$(KBUILD_SRC),$(CURDIR))
114 192 objtree := $(CURDIR)
... ... @@ -119,24 +197,6 @@
119 197  
120 198 export srctree objtree VPATH
121 199  
122   -# Call a source code checker (by default, "sparse") as part of the
123   -# C compilation.
124   -#
125   -# Use 'make C=1' to enable checking of re-compiled files.
126   -#
127   -# See the linux kernel file "Documentation/sparse.txt" for more details,
128   -# including where to get the "sparse" utility.
129   -
130   -ifdef C
131   -ifeq ("$(origin C)", "command line")
132   -CHECKSRC := $(C)
133   -endif
134   -endif
135   -ifndef CHECKSRC
136   - CHECKSRC = 0
137   -endif
138   -export CHECKSRC
139   -
140 200 OBJTREE := $(objtree)
141 201 SPLTREE := $(OBJTREE)/spl
142 202 TPLTREE := $(OBJTREE)/tpl
... ... @@ -222,6 +282,78 @@
222 282 HOSTLDFLAGS += $(call os_x_before, 10, 5, "-multiply_defined suppress")
223 283 endif
224 284  
  285 +# Decide whether to build built-in, modular, or both.
  286 +# Normally, just do built-in.
  287 +
  288 +KBUILD_MODULES :=
  289 +KBUILD_BUILTIN := 1
  290 +
  291 +# If we have only "make modules", don't compile built-in objects.
  292 +# When we're building modules with modversions, we need to consider
  293 +# the built-in objects during the descend as well, in order to
  294 +# make sure the checksums are up to date before we record them.
  295 +
  296 +ifeq ($(MAKECMDGOALS),modules)
  297 + KBUILD_BUILTIN := $(if $(CONFIG_MODVERSIONS),1)
  298 +endif
  299 +
  300 +# If we have "make <whatever> modules", compile modules
  301 +# in addition to whatever we do anyway.
  302 +# Just "make" or "make all" shall build modules as well
  303 +
  304 +# U-Boot does not need modules
  305 +#ifneq ($(filter all _all modules,$(MAKECMDGOALS)),)
  306 +# KBUILD_MODULES := 1
  307 +#endif
  308 +
  309 +#ifeq ($(MAKECMDGOALS),)
  310 +# KBUILD_MODULES := 1
  311 +#endif
  312 +
  313 +export KBUILD_MODULES KBUILD_BUILTIN
  314 +export KBUILD_CHECKSRC KBUILD_SRC KBUILD_EXTMOD
  315 +
  316 +# Beautify output
  317 +# ---------------------------------------------------------------------------
  318 +#
  319 +# Normally, we echo the whole command before executing it. By making
  320 +# that echo $($(quiet)$(cmd)), we now have the possibility to set
  321 +# $(quiet) to choose other forms of output instead, e.g.
  322 +#
  323 +# quiet_cmd_cc_o_c = Compiling $(RELDIR)/$@
  324 +# cmd_cc_o_c = $(CC) $(c_flags) -c -o $@ $<
  325 +#
  326 +# If $(quiet) is empty, the whole command will be printed.
  327 +# If it is set to "quiet_", only the short version will be printed.
  328 +# If it is set to "silent_", nothing will be printed at all, since
  329 +# the variable $(silent_cmd_cc_o_c) doesn't exist.
  330 +#
  331 +# A simple variant is to prefix commands with $(Q) - that's useful
  332 +# for commands that shall be hidden in non-verbose mode.
  333 +#
  334 +# $(Q)ln $@ :<
  335 +#
  336 +# If KBUILD_VERBOSE equals 0 then the above command will be hidden.
  337 +# If KBUILD_VERBOSE equals 1 then the above command is displayed.
  338 +
  339 +ifeq ($(KBUILD_VERBOSE),1)
  340 + quiet =
  341 + Q =
  342 +else
  343 + quiet=quiet_
  344 + Q = @
  345 +endif
  346 +
  347 +# If the user is running make -s (silent mode), suppress echoing of
  348 +# commands
  349 +
  350 +ifneq ($(filter s% -s%,$(MAKEFLAGS)),)
  351 + quiet=silent_
  352 +endif
  353 +
  354 +export quiet Q KBUILD_VERBOSE
  355 +
  356 +
225 357 # Look for make include files relative to root of kernel src
226 358 MAKEFLAGS += --include-dir=$(srctree)
227 359  
... ... @@ -278,6 +410,31 @@
278 410 export KBUILD_CPPFLAGS NOSTDINC_FLAGS UBOOTINCLUDE
279 411 export KBUILD_CFLAGS KBUILD_AFLAGS
280 412  
  413 +# When compiling out-of-tree modules, put MODVERDIR in the module
  414 +# tree rather than in the kernel tree. The kernel tree might
  415 +# even be read-only.
  416 +export MODVERDIR := $(if $(KBUILD_EXTMOD),$(firstword $(KBUILD_EXTMOD))/).tmp_versions
  417 +
  418 +# Files to ignore in find ... statements
  419 +
  420 +RCS_FIND_IGNORE := \( -name SCCS -o -name BitKeeper -o -name .svn -o -name CVS \
  421 + -o -name .pc -o -name .hg -o -name .git \) -prune -o
  422 +export RCS_TAR_IGNORE := --exclude SCCS --exclude BitKeeper --exclude .svn \
  423 + --exclude CVS --exclude .pc --exclude .hg --exclude .git
  424 +
  425 +# ===========================================================================
  426 +# Rules shared between *config targets and build targets
  427 +
  428 +# Basic helpers built in scripts/
  429 +PHONY += scripts_basic
  430 +scripts_basic:
  431 + $(Q)$(MAKE) $(build)=scripts/basic
  432 + $(Q)rm -f .tmp_quiet_recordmcount
  433 +
  434 +# To avoid any implicit rule to kick in, define an empty command.
  435 +scripts/basic/%: scripts_basic ;
  436 +
  437 +
281 438 KBUILD_CFLAGS += -Os #-fomit-frame-pointer
282 439  
283 440 ifdef BUILD_TAG
... ... @@ -333,6 +490,10 @@
333 490 endif
334 491 endif
335 492  
  493 +# FIX ME
  494 +cpp_flags := $(KBUILD_CPPFLAGS) $(CPPFLAGS) $(UBOOTINCLUDE) $(NOSTDINC_FLAGS)
  495 +c_flags := $(KBUILD_CFLAGS) $(cpp_flags)
  496 +
336 497 # If board code explicitly specified LDSCRIPT or CONFIG_SYS_LDSCRIPT, use
337 498 # that (or fail if absent). Otherwise, search for a linker script in a
338 499 # standard location.
339 500  
... ... @@ -446,12 +607,12 @@
446 607 # Add GCC lib
447 608 ifdef USE_PRIVATE_LIBGCC
448 609 ifeq ("$(USE_PRIVATE_LIBGCC)", "yes")
449   -PLATFORM_LIBGCC = $(OBJTREE)/arch/$(ARCH)/lib/libgcc.o
  610 +PLATFORM_LIBGCC = $(OBJTREE)/arch/$(ARCH)/lib/lib.a
450 611 else
451 612 PLATFORM_LIBGCC = -L $(USE_PRIVATE_LIBGCC) -lgcc
452 613 endif
453 614 else
454   -PLATFORM_LIBGCC := -L $(shell dirname `$(CC) $(CFLAGS) -print-libgcc-file-name`) -lgcc
  615 +PLATFORM_LIBGCC := -L $(shell dirname `$(CC) $(c_flags) -print-libgcc-file-name`) -lgcc
455 616 endif
456 617 PLATFORM_LIBS += $(PLATFORM_LIBGCC)
457 618 export PLATFORM_LIBS
... ... @@ -701,7 +862,7 @@
701 862 ifeq ($(CONFIG_KALLSYMS),y)
702 863 smap=`$(call SYSTEM_MAP,u-boot) | \
703 864 awk '$$2 ~ /[tTwW]/ {printf $$1 $$3 "\\\\000"}'` ; \
704   - $(CC) $(CFLAGS) -DSYSTEM_MAP="\"$${smap}\"" \
  865 + $(CC) $(c_flags) -DSYSTEM_MAP="\"$${smap}\"" \
705 866 -c $(srctree)/common/system_map.c -o common/system_map.o
706 867 $(GEN_UBOOT) common/system_map.o
707 868 endif
708 869  
709 870  
710 871  
711 872  
712 873  
... ... @@ -709,27 +870,27 @@
709 870 $(OBJS):
710 871 @:
711 872  
712   -$(LIBS): depend $(SUBDIR_TOOLS)
713   - $(MAKE) $(build)=$(patsubst %/,%,$(dir $@))
  873 +$(LIBS): depend $(SUBDIR_TOOLS) scripts_basic
  874 + $(Q)$(MAKE) $(build)=$(patsubst %/,%,$(dir $@))
714 875  
715   -$(SUBDIRS): depend
716   - $(MAKE) $(build)=$@ all
  876 +$(SUBDIRS): depend scripts_basic
  877 + $(Q)$(MAKE) $(build)=$@
717 878  
718 879 $(SUBDIR_EXAMPLES-y): u-boot
719 880  
720 881 u-boot.lds: $(LDSCRIPT) depend
721   - $(CPP) $(CPPFLAGS) $(LDPPFLAGS) -ansi -D__ASSEMBLY__ -P - <$< >$@
  882 + $(CPP) $(cpp_flags) $(LDPPFLAGS) -ansi -D__ASSEMBLY__ -P - <$< >$@
722 883  
723   -nand_spl: $(TIMESTAMP_FILE) $(VERSION_FILE) depend
  884 +nand_spl: $(TIMESTAMP_FILE) $(VERSION_FILE) depend scripts_basic
724 885 $(MAKE) $(build)=nand_spl/board/$(BOARDDIR) all
725 886  
726 887 u-boot-nand.bin: nand_spl u-boot.bin
727 888 cat nand_spl/u-boot-spl-16k.bin u-boot.bin > u-boot-nand.bin
728 889  
729   -spl/u-boot-spl.bin: $(SUBDIR_TOOLS) depend
  890 +spl/u-boot-spl.bin: $(SUBDIR_TOOLS) depend scripts_basic
730 891 $(MAKE) obj=spl -f $(srctree)/spl/Makefile all
731 892  
732   -tpl/u-boot-tpl.bin: $(SUBDIR_TOOLS) depend
  893 +tpl/u-boot-tpl.bin: $(SUBDIR_TOOLS) depend scripts_basic
733 894 $(MAKE) obj=tpl -f $(srctree)/spl/Makefile all CONFIG_TPL_BUILD=y
734 895  
735 896 # Explicitly make _depend in subdirs containing multiple targets to prevent
736 897  
... ... @@ -804,14 +965,14 @@
804 965 include/autoconf.mk.dep: include/config.h include/common.h
805 966 @$(XECHO) Generating $@ ; \
806 967 : Generate the dependancies ; \
807   - $(CC) -x c -DDO_DEPS_ONLY -M $(CFLAGS) $(CPPFLAGS) \
  968 + $(CC) -x c -DDO_DEPS_ONLY -M $(c_flags) \
808 969 -MQ include/autoconf.mk $(srctree)/include/common.h > $@ || \
809 970 rm $@
810 971  
811 972 include/autoconf.mk: include/config.h
812 973 @$(XECHO) Generating $@ ; \
813 974 : Extract the config macros ; \
814   - $(CPP) $(CFLAGS) -DDO_DEPS_ONLY -dM $(srctree)/include/common.h > $@.tmp && \
  975 + $(CPP) $(c_flags) -DDO_DEPS_ONLY -dM $(srctree)/include/common.h > $@.tmp && \
815 976 sed -n -f $(srctree)/tools/scripts/define2mk.sed $@.tmp > $@; \
816 977 rm $@.tmp
817 978  
... ... @@ -819,7 +980,7 @@
819 980 include/tpl-autoconf.mk: include/config.h
820 981 @$(XECHO) Generating $@ ; \
821 982 : Extract the config macros ; \
822   - $(CPP) $(CFLAGS) -DCONFIG_TPL_BUILD -DCONFIG_SPL_BUILD\
  983 + $(CPP) $(c_flags) -DCONFIG_TPL_BUILD -DCONFIG_SPL_BUILD\
823 984 -DDO_DEPS_ONLY -dM $(srctree)/include/common.h > $@.tmp && \
824 985 sed -n -f $(srctree)/tools/scripts/define2mk.sed $@.tmp > $@; \
825 986 rm $@.tmp
... ... @@ -827,7 +988,7 @@
827 988 include/spl-autoconf.mk: include/config.h
828 989 @$(XECHO) Generating $@ ; \
829 990 : Extract the config macros ; \
830   - $(CPP) $(CFLAGS) -DCONFIG_SPL_BUILD -DDO_DEPS_ONLY -dM $(srctree)/include/common.h > $@.tmp && \
  991 + $(CPP) $(c_flags) -DCONFIG_SPL_BUILD -DDO_DEPS_ONLY -dM $(srctree)/include/common.h > $@.tmp && \
831 992 sed -n -f $(srctree)/tools/scripts/define2mk.sed $@.tmp > $@; \
832 993 rm $@.tmp
833 994  
... ... @@ -838,7 +999,7 @@
838 999 lib/asm-offsets.s: include/config.h $(srctree)/lib/asm-offsets.c
839 1000 @mkdir -p lib
840 1001 $(CC) -DDO_DEPS_ONLY \
841   - $(CFLAGS) $(CFLAGS_$(BCURDIR)/$(@F)) $(CFLAGS_$(BCURDIR)) \
  1002 + $(c_flags) $(CFLAGS_$(BCURDIR)/$(@F)) $(CFLAGS_$(BCURDIR)) \
842 1003 -o $@ $(srctree)/lib/asm-offsets.c -c -S
843 1004  
844 1005 include/generated/asm-offsets.h: $(CPUDIR)/$(SOC)/asm-offsets.s
... ... @@ -849,7 +1010,7 @@
849 1010 @mkdir -p $(CPUDIR)/$(SOC)
850 1011 if [ -f $(srctree)/$(CPUDIR)/$(SOC)/asm-offsets.c ];then \
851 1012 $(CC) -DDO_DEPS_ONLY \
852   - $(CFLAGS) $(CFLAGS_$(BCURDIR)/$(@F)) $(CFLAGS_$(BCURDIR)) \
  1013 + $(c_flags) $(CFLAGS_$(BCURDIR)/$(@F)) $(CFLAGS_$(BCURDIR)) \
853 1014 -o $@ $(srctree)/$(CPUDIR)/$(SOC)/asm-offsets.c -c -S; \
854 1015 else \
855 1016 touch $@; \
856 1017  
857 1018  
... ... @@ -900,15 +1061,15 @@
900 1061 @cmp -s $@ $@.tmp && rm -f $@.tmp || mv -f $@.tmp $@
901 1062  
902 1063 easylogo env gdb:
903   - $(MAKE) $(build)=tools/$@ MTD_VERSION=${MTD_VERSION}
  1064 + $(Q)$(MAKE) $(build)=tools/$@ MTD_VERSION=${MTD_VERSION}
904 1065  
905 1066 gdbtools: gdb
906 1067  
907 1068 xmldocs pdfdocs psdocs htmldocs mandocs: tools/kernel-doc/docproc
908   - $(MAKE) U_BOOT_VERSION=$(U_BOOT_VERSION) $(build)=doc/DocBook $@
  1069 + $(Q)$(MAKE) U_BOOT_VERSION=$(U_BOOT_VERSION) $(build)=doc/DocBook $@
909 1070  
910 1071 tools-all: easylogo env gdb $(VERSION_FILE) $(TIMESTAMP_FILE)
911   - $(MAKE) $(build)=tools HOST_TOOLS_ALL=y
  1072 + $(Q)$(MAKE) $(build)=tools HOST_TOOLS_ALL=y
912 1073  
913 1074 .PHONY : CHANGELOG
914 1075 CHANGELOG:
... ... @@ -968,7 +1129,7 @@
968 1129 @$(MAKE) -f $(srctree)/doc/DocBook/Makefile cleandocs
969 1130 @find $(OBJTREE) -type f \
970 1131 \( -name 'core' -o -name '*.bak' -o -name '*~' -o -name '*.su' \
971   - -o -name '*.o' -o -name '*.a' -o -name '*.exe' \
  1132 + -o -name '*.o' -o -name '*.a' -o -name '*.exe' -o -name '*.cmd' \
972 1133 -o -name '*.cfgtmp' \) -print \
973 1134 | xargs rm -f
974 1135  
arch/arm/imx-common/Makefile
... ... @@ -25,7 +25,7 @@
25 25  
26 26 $(OBJTREE)/$(patsubst "%",%,$(CONFIG_IMX_CONFIG)).cfgtmp: $(OBJTREE)/%.cfgtmp : $(SRCTREE)/%
27 27 mkdir -p $(dir $@)
28   - $(CC) -E -x c $< $(CPPFLAGS) -o $@
  28 + $(CPP) $(cpp_flags) -x c -o $@ $<
29 29  
30 30 $(OBJTREE)/u-boot.imx: $(OBJTREE)/u-boot.bin $(OBJTREE)/$(patsubst "%",%,$(CONFIG_IMX_CONFIG)).cfgtmp
31 31 $(OBJTREE)/tools/mkimage -n $(filter-out %.bin,$^) -T imximage \
arch/blackfin/cpu/Makefile
... ... @@ -25,7 +25,7 @@
25 25  
26 26 # make sure our initcode (which goes into LDR) does not
27 27 # have relocs or external references
28   -$(obj)/initcode.o: CFLAGS += -fno-function-sections -fno-data-sections
  28 +CFLAGS_REMOVE_initcode.o := -ffunction-sections -fdata-sections
29 29 READINIT = env LC_ALL=C $(CROSS_COMPILE)readelf -s $<
30 30 $(obj)/check_initcode: $(obj)/initcode.o
31 31 ifneq ($(CONFIG_BFIN_BOOT_MODE),BFIN_BOOT_BYPASS)
... ... @@ -35,8 +35,7 @@
35 35 fi
36 36 endif
37 37  
38   -$(obj)/init.lds: $(src)/init.lds.S
39   - $(CPP) $(CPPFLAGS) $(LDPPFLAGS) -ansi -D__ASSEMBLY__ -P $^ -o $@
  38 +CPPFLAGS_init.lds := -ansi
40 39 $(obj)/init.elf: $(obj)/init.lds $(obj)/init.o $(obj)/initcode.o
41 40 $(LD) $(LDFLAGS) -T $^ -o $@
arch/blackfin/lib/Makefile
... ... @@ -9,7 +9,10 @@
9 9 # SPDX-License-Identifier: GPL-2.0+
10 10 #
11 11  
12   -CFLAGS += -DBFIN_BOARD_NAME='"$(BOARD)"'
  12 +# Unnecessary.
  13 +# Use CONFIG_SYS_BOARD instead of BFIN_BOARD_NAME
  14 +# and delete this.
  15 +ccflags-y += -DBFIN_BOARD_NAME='"$(BOARD)"'
13 16  
14 17 obj-y += ins.o
15 18 obj-y += memcmp.o
arch/m68k/cpu/mcf5227x/Makefile
... ... @@ -5,7 +5,7 @@
5 5 # SPDX-License-Identifier: GPL-2.0+
6 6 #
7 7  
8   -# CFLAGS += -DET_DEBUG
  8 +# ccflags-y += -DET_DEBUG
9 9  
10 10 extra-y = start.o
11 11 obj-y = cpu.o speed.o cpu_init.o interrupts.o
arch/m68k/cpu/mcf523x/Makefile
... ... @@ -5,7 +5,7 @@
5 5 # SPDX-License-Identifier: GPL-2.0+
6 6 #
7 7  
8   -# CFLAGS += -DET_DEBUG
  8 +# ccflags-y += -DET_DEBUG
9 9  
10 10 extra-y = start.o
11 11 obj-y = cpu.o speed.o cpu_init.o interrupts.o
arch/m68k/cpu/mcf52x2/Makefile
... ... @@ -5,7 +5,7 @@
5 5 # SPDX-License-Identifier: GPL-2.0+
6 6 #
7 7  
8   -# CFLAGS += -DET_DEBUG
  8 +# ccflags-y += -DET_DEBUG
9 9  
10 10 extra-y = start.o
11 11 obj-y = interrupts.o cpu.o speed.o cpu_init.o
arch/m68k/cpu/mcf532x/Makefile
... ... @@ -5,7 +5,7 @@
5 5 # SPDX-License-Identifier: GPL-2.0+
6 6 #
7 7  
8   -# CFLAGS += -DET_DEBUG
  8 +# ccflags-y += -DET_DEBUG
9 9  
10 10 extra-y := start.o
11 11 obj-y = cpu.o speed.o cpu_init.o interrupts.o
arch/m68k/cpu/mcf5445x/Makefile
... ... @@ -5,7 +5,7 @@
5 5 # SPDX-License-Identifier: GPL-2.0+
6 6 #
7 7  
8   -# CFLAGS += -DET_DEBUG
  8 +# ccflags-y += -DET_DEBUG
9 9  
10 10 extra-y = start.o
11 11 obj-y = cpu.o speed.o cpu_init.o interrupts.o pci.o
arch/m68k/cpu/mcf547x_8x/Makefile
... ... @@ -5,7 +5,7 @@
5 5 # SPDX-License-Identifier: GPL-2.0+
6 6 #
7 7  
8   -# CFLAGS += -DET_DEBUG
  8 +# ccflags-y += -DET_DEBUG
9 9  
10 10 extra-y = start.o
11 11 obj-y = cpu.o speed.o cpu_init.o pci.o interrupts.o slicetimer.o
arch/powerpc/cpu/mpc8xx/Makefile
... ... @@ -5,7 +5,7 @@
5 5 # SPDX-License-Identifier: GPL-2.0+
6 6 #
7 7  
8   -# CFLAGS += -DET_DEBUG
  8 +# ccflags-y += -DET_DEBUG
9 9  
10 10 extra-y += start.o
11 11 extra-y += traps.o
arch/powerpc/lib/Makefile
... ... @@ -54,11 +54,11 @@
54 54 # Workaround for local bus unaligned access problems
55 55 # on MPC512x and MPC5200
56 56 ifdef CONFIG_MPC512X
57   -$(obj)/ppcstring.o: AFLAGS += -Dmemcpy=__memcpy
  57 +AFLAGS_ppcstring.o += -Dmemcpy=__memcpy
58 58 obj-y += memcpy_mpc5200.o
59 59 endif
60 60 ifdef CONFIG_MPC5200
61   -$(obj)/ppcstring.o: AFLAGS += -Dmemcpy=__memcpy
  61 +AFLAGS_ppcstring.o += -Dmemcpy=__memcpy
62 62 obj-y += memcpy_mpc5200.o
63 63 endif
64 64 endif
arch/sandbox/cpu/Makefile
... ... @@ -10,8 +10,11 @@
10 10 obj-y := cpu.o os.o start.o state.o
11 11  
12 12 # os.c is build in the system environment, so needs standard includes
13   -$(obj)/os.o: CFLAGS := $(filter-out -nostdinc,\
14   - $(patsubst -I%,-idirafter%,$(CFLAGS)))
15   -$(obj)/.depend.os: CPPFLAGS := $(filter-out -nostdinc,\
16   - $(patsubst -I%,-idirafter%,$(CPPFLAGS)))
  13 +# CFLAGS_REMOVE_os.o cannot be used to drop header include path
  14 +quiet_cmd_cc_os.o = CC $(quiet_modtag) $@
  15 +cmd_cc_os.o = $(CC) $(filter-out -nostdinc, \
  16 + $(patsubst -I%,-idirafter%,$(c_flags))) -c -o $@ $<
  17 +
  18 +$(obj)/os.o: $(src)/os.c FORCE
  19 + $(call if_changed_dep,cc_os.o)
board/bct-brettl2/config.mk
... ... @@ -7,7 +7,8 @@
7 7 # SPDX-License-Identifier: GPL-2.0+
8 8 #
9 9  
10   -CFLAGS_lib += -O2
11   -CFLAGS_lib/lzma += -O2
12   -CFLAGS_lib/zlib += -O2
  10 +# FIX ME
  11 +ifneq ($(filter lib lib/lzma lib/zlib, $(obj)),)
  12 +ccflags-y := -O2
  13 +endif
board/bf518f-ezbrd/config.mk
... ... @@ -7,7 +7,8 @@
7 7 # SPDX-License-Identifier: GPL-2.0+
8 8 #
9 9  
10   -CFLAGS_lib += -O2
11   -CFLAGS_lib/lzma += -O2
12   -CFLAGS_lib/zlib += -O2
  10 +# FIX ME
  11 +ifneq ($(filter lib lib/lzma lib/zlib, $(obj)),)
  12 +ccflags-y := -O2
  13 +endif
board/bf526-ezbrd/config.mk
... ... @@ -7,7 +7,8 @@
7 7 # SPDX-License-Identifier: GPL-2.0+
8 8 #
9 9  
10   -CFLAGS_lib += -O2
11   -CFLAGS_lib/lzma += -O2
12   -CFLAGS_lib/zlib += -O2
  10 +# FIX ME
  11 +ifneq ($(filter lib lib/lzma lib/zlib, $(obj)),)
  12 +ccflags-y := -O2
  13 +endif
board/bf527-ad7160-eval/config.mk
... ... @@ -7,7 +7,8 @@
7 7 # SPDX-License-Identifier: GPL-2.0+
8 8 #
9 9  
10   -CFLAGS_lib += -O2
11   -CFLAGS_lib/lzma += -O2
12   -CFLAGS_lib/zlib += -O2
  10 +# FIX ME
  11 +ifneq ($(filter lib lib/lzma lib/zlib, $(obj)),)
  12 +ccflags-y := -O2
  13 +endif
board/bf527-ezkit/config.mk
... ... @@ -7,7 +7,8 @@
7 7 # SPDX-License-Identifier: GPL-2.0+
8 8 #
9 9  
10   -CFLAGS_lib += -O2
11   -CFLAGS_lib/lzma += -O2
12   -CFLAGS_lib/zlib += -O2
  10 +# FIX ME
  11 +ifneq ($(filter lib lib/lzma lib/zlib, $(obj)),)
  12 +ccflags-y := -O2
  13 +endif
board/bf527-sdp/config.mk
... ... @@ -7,9 +7,10 @@
7 7 # SPDX-License-Identifier: GPL-2.0+
8 8 #
9 9  
10   -CFLAGS_lib += -O2
11   -CFLAGS_lib/lzma += -O2
12   -CFLAGS_lib/zlib += -O2
  10 +# FIX ME
  11 +ifneq ($(filter lib lib/lzma lib/zlib, $(obj)),)
  12 +ccflags-y := -O2
  13 +endif
13 14  
14 15 # Set some default LDR flags based on boot mode.
15 16 LDR_FLAGS-BFIN_BOOT_PARA := --bits 16 --dma 6
board/bf533-ezkit/config.mk
... ... @@ -7,9 +7,10 @@
7 7 # SPDX-License-Identifier: GPL-2.0+
8 8 #
9 9  
10   -CFLAGS_lib += -O2
11   -CFLAGS_lib/lzma += -O2
12   -CFLAGS_lib/zlib += -O2
  10 +# FIX ME
  11 +ifneq ($(filter lib lib/lzma lib/zlib, $(obj)),)
  12 +ccflags-y := -O2
  13 +endif
13 14  
14 15 # Set some default LDR flags based on boot mode.
15 16 LDR_FLAGS-BFIN_BOOT_PARA := --bits 16 --dma 8
board/bf533-stamp/config.mk
... ... @@ -7,9 +7,10 @@
7 7 # SPDX-License-Identifier: GPL-2.0+
8 8 #
9 9  
10   -CFLAGS_lib += -O2
11   -CFLAGS_lib/lzma += -O2
12   -CFLAGS_lib/zlib += -O2
  10 +# FIX ME
  11 +ifneq ($(filter lib lib/lzma lib/zlib, $(obj)),)
  12 +ccflags-y := -O2
  13 +endif
13 14  
14 15 # Set some default LDR flags based on boot mode.
15 16 LDR_FLAGS-BFIN_BOOT_PARA := --bits 16 --dma 8
board/bf537-stamp/config.mk
... ... @@ -7,9 +7,10 @@
7 7 # SPDX-License-Identifier: GPL-2.0+
8 8 #
9 9  
10   -CFLAGS_lib += -O2
11   -CFLAGS_lib/lzma += -O2
12   -CFLAGS_lib/zlib += -O2
  10 +# FIX ME
  11 +ifneq ($(filter lib lib/lzma lib/zlib, $(obj)),)
  12 +ccflags-y := -O2
  13 +endif
13 14  
14 15 # Set some default LDR flags based on boot mode.
15 16 LDR_FLAGS-BFIN_BOOT_PARA := --bits 16 --dma 8
board/bf538f-ezkit/config.mk
... ... @@ -7,9 +7,10 @@
7 7 # SPDX-License-Identifier: GPL-2.0+
8 8 #
9 9  
10   -CFLAGS_lib += -O2
11   -CFLAGS_lib/lzma += -O2
12   -CFLAGS_lib/zlib += -O2
  10 +# FIX ME
  11 +ifneq ($(filter lib lib/lzma lib/zlib, $(obj)),)
  12 +ccflags-y := -O2
  13 +endif
13 14  
14 15 # Set some default LDR flags based on boot mode.
15 16 LDR_FLAGS-BFIN_BOOT_PARA := --bits 16 --dma 8
board/bf548-ezkit/config.mk
... ... @@ -7,9 +7,10 @@
7 7 # SPDX-License-Identifier: GPL-2.0+
8 8 #
9 9  
10   -CFLAGS_lib += -O2
11   -CFLAGS_lib/lzma += -O2
12   -CFLAGS_lib/zlib += -O2
  10 +# FIX ME
  11 +ifneq ($(filter lib lib/lzma lib/zlib, $(obj)),)
  12 +ccflags-y := -O2
  13 +endif
13 14  
14 15 # Set some default LDR flags based on boot mode.
15 16 LDR_FLAGS-BFIN_BOOT_PARA := --dma 6
board/bf561-acvilon/config.mk
... ... @@ -7,9 +7,10 @@
7 7 # SPDX-License-Identifier: GPL-2.0+
8 8 #
9 9  
10   -CFLAGS_lib += -O2
11   -CFLAGS_lib/lzma += -O2
12   -CFLAGS_lib/zlib += -O2
  10 +# FIX ME
  11 +ifneq ($(filter lib lib/lzma lib/zlib, $(obj)),)
  12 +ccflags-y := -O2
  13 +endif
13 14  
14 15 # Set some default LDR flags based on boot mode.
15 16 LDR_FLAGS-BFIN_BOOT_PARA := --bits 16
board/bf561-ezkit/config.mk
... ... @@ -7,9 +7,10 @@
7 7 # SPDX-License-Identifier: GPL-2.0+
8 8 #
9 9  
10   -CFLAGS_lib += -O2
11   -CFLAGS_lib/lzma += -O2
12   -CFLAGS_lib/zlib += -O2
  10 +# FIX ME
  11 +ifneq ($(filter lib lib/lzma lib/zlib, $(obj)),)
  12 +ccflags-y := -O2
  13 +endif
13 14  
14 15 # Set some default LDR flags based on boot mode.
15 16 LDR_FLAGS-BFIN_BOOT_PARA := --bits 16
... ... @@ -9,7 +9,8 @@
9 9 # SPDX-License-Identifier: GPL-2.0+
10 10 #
11 11  
12   -CFLAGS_lib += -O2
13   -CFLAGS_lib/lzma += -O2
14   -CFLAGS_lib/zlib += -O2
  12 +# FIX ME
  13 +ifneq ($(filter lib lib/lzma lib/zlib, $(obj)),)
  14 +ccflags-y := -O2
  15 +endif
board/cm-bf527/config.mk
... ... @@ -7,7 +7,8 @@
7 7 # SPDX-License-Identifier: GPL-2.0+
8 8 #
9 9  
10   -CFLAGS_lib += -O2
11   -CFLAGS_lib/lzma += -O2
12   -CFLAGS_lib/zlib += -O2
  10 +# FIX ME
  11 +ifneq ($(filter lib lib/lzma lib/zlib, $(obj)),)
  12 +ccflags-y := -O2
  13 +endif
board/cm-bf533/config.mk
... ... @@ -7,9 +7,10 @@
7 7 # SPDX-License-Identifier: GPL-2.0+
8 8 #
9 9  
10   -CFLAGS_lib += -O2
11   -CFLAGS_lib/lzma += -O2
12   -CFLAGS_lib/zlib += -O2
  10 +# FIX ME
  11 +ifneq ($(filter lib lib/lzma lib/zlib, $(obj)),)
  12 +ccflags-y := -O2
  13 +endif
13 14  
14 15 # Set some default LDR flags based on boot mode.
15 16 LDR_FLAGS-BFIN_BOOT_PARA := --bits 16 --dma 8
board/cm-bf537e/config.mk
... ... @@ -7,9 +7,10 @@
7 7 # SPDX-License-Identifier: GPL-2.0+
8 8 #
9 9  
10   -CFLAGS_lib += -O2
11   -CFLAGS_lib/lzma += -O2
12   -CFLAGS_lib/zlib += -O2
  10 +# FIX ME
  11 +ifneq ($(filter lib lib/lzma lib/zlib, $(obj)),)
  12 +ccflags-y := -O2
  13 +endif
13 14  
14 15 # Set some default LDR flags based on boot mode.
15 16 LDR_FLAGS-BFIN_BOOT_PARA := --bits 16 --dma 8
board/cm-bf537u/config.mk
... ... @@ -7,9 +7,10 @@
7 7 # SPDX-License-Identifier: GPL-2.0+
8 8 #
9 9  
10   -CFLAGS_lib += -O2
11   -CFLAGS_lib/lzma += -O2
12   -CFLAGS_lib/zlib += -O2
  10 +# FIX ME
  11 +ifneq ($(filter lib lib/lzma lib/zlib, $(obj)),)
  12 +ccflags-y := -O2
  13 +endif
13 14  
14 15 # Set some default LDR flags based on boot mode.
15 16 LDR_FLAGS-BFIN_BOOT_PARA := --bits 16 --dma 8
board/cm-bf548/config.mk
... ... @@ -7,9 +7,10 @@
7 7 # SPDX-License-Identifier: GPL-2.0+
8 8 #
9 9  
10   -CFLAGS_lib += -O2
11   -CFLAGS_lib/lzma += -O2
12   -CFLAGS_lib/zlib += -O2
  10 +# FIX ME
  11 +ifneq ($(filter lib lib/lzma lib/zlib, $(obj)),)
  12 +ccflags-y := -O2
  13 +endif
13 14  
14 15 # Set some default LDR flags based on boot mode.
15 16 LDR_FLAGS-BFIN_BOOT_PARA := --dma 6
board/cm-bf561/config.mk
... ... @@ -7,9 +7,10 @@
7 7 # SPDX-License-Identifier: GPL-2.0+
8 8 #
9 9  
10   -CFLAGS_lib += -O2
11   -CFLAGS_lib/lzma += -O2
12   -CFLAGS_lib/zlib += -O2
  10 +# FIX ME
  11 +ifneq ($(filter lib lib/lzma lib/zlib, $(obj)),)
  12 +ccflags-y := -O2
  13 +endif
13 14  
14 15 # Set some default LDR flags based on boot mode.
15 16 LDR_FLAGS-BFIN_BOOT_PARA := --bits 16
board/ip04/config.mk
... ... @@ -7,9 +7,10 @@
7 7 # SPDX-License-Identifier: GPL-2.0+
8 8 #
9 9  
10   -CFLAGS_lib += -O2
11   -CFLAGS_lib/lzma += -O2
12   -CFLAGS_lib/zlib += -O2
  10 +# FIX ME
  11 +ifneq ($(filter lib lib/lzma lib/zlib, $(obj)),)
  12 +ccflags-y := -O2
  13 +endif
13 14  
14 15 # Set some default LDR flags based on boot mode.
15 16 LDR_FLAGS-BFIN_BOOT_PARA := --bits 16 --dma 8
board/matrix_vision/mvblx/Makefile
... ... @@ -8,5 +8,5 @@
8 8 obj-y += mvblx.o fpga.o
9 9 obj-$(CONFIG_ID_EEPROM) += sys_eeprom.o
10 10  
11   -CFLAGS += -Werror
  11 +ccflags-y += -Werror
... ... @@ -9,7 +9,8 @@
9 9 # SPDX-License-Identifier: GPL-2.0+
10 10 #
11 11  
12   -CFLAGS_lib += -O2
13   -CFLAGS_lib/lzma += -O2
14   -CFLAGS_lib/zlib += -O2
  12 +# FIX ME
  13 +ifneq ($(filter lib lib/lzma lib/zlib, $(obj)),)
  14 +ccflags-y := -O2
  15 +endif
board/sandburst/karef/Makefile
... ... @@ -13,7 +13,7 @@
13 13 BUILDUSER := $(shell whoami)
14 14 FORCEBUILD := $(shell rm -f karef.o)
15 15  
16   -CFLAGS += -DBUILDUSER='"$(BUILDUSER)"'
  16 +ccflags-y += -DBUILDUSER='"$(BUILDUSER)"'
17 17 # TBS: end debugging
18 18  
19 19 obj-y = karef.o ../common/flash.o ../common/sb_common.o
board/sandburst/metrobox/Makefile
... ... @@ -12,7 +12,7 @@
12 12 BUILDUSER := $(shell whoami)
13 13 FORCEBUILD := $(shell rm -f metrobox.o)
14 14  
15   -CFLAGS += -DBUILDUSER='"$(BUILDUSER)"'
  15 +ccflags-y += -DBUILDUSER='"$(BUILDUSER)"'
16 16 # TBS: end debugging
17 17  
18 18 obj-y = metrobox.o ../common/flash.o ../common/sb_common.o
board/st-ericsson/snowball/Makefile
... ... @@ -4,7 +4,7 @@
4 4 # SPDX-License-Identifier: GPL-2.0+
5 5 #
6 6  
7   -CFLAGS += -D__RELEASE -D__STN_8500
  7 +ccflags-y += -D__RELEASE -D__STN_8500
8 8  
9 9 obj-y := snowball.o
board/st-ericsson/u8500/Makefile
... ... @@ -4,7 +4,7 @@
4 4 # SPDX-License-Identifier: GPL-2.0+
5 5 #
6 6  
7   -CFLAGS += -D__RELEASE -D__STN_8500
  7 +ccflags-y += -D__RELEASE -D__STN_8500
8 8  
9 9 obj-y := u8500_href.o gpio.o
board/tcm-bf518/config.mk
... ... @@ -7,7 +7,8 @@
7 7 # SPDX-License-Identifier: GPL-2.0+
8 8 #
9 9  
10   -CFLAGS_lib += -O2
11   -CFLAGS_lib/lzma += -O2
12   -CFLAGS_lib/zlib += -O2
  10 +# FIX ME
  11 +ifneq ($(filter lib lib/lzma lib/zlib, $(obj)),)
  12 +ccflags-y := -O2
  13 +endif
board/tcm-bf537/config.mk
... ... @@ -7,9 +7,10 @@
7 7 # SPDX-License-Identifier: GPL-2.0+
8 8 #
9 9  
10   -CFLAGS_lib += -O2
11   -CFLAGS_lib/lzma += -O2
12   -CFLAGS_lib/zlib += -O2
  10 +# FIX ME
  11 +ifneq ($(filter lib lib/lzma lib/zlib, $(obj)),)
  12 +ccflags-y := -O2
  13 +endif
13 14  
14 15 # Set some default LDR flags based on boot mode.
15 16 LDR_FLAGS-BFIN_BOOT_PARA := --bits 16 --dma 8
... ... @@ -238,11 +238,7 @@
238 238 obj-y += memsize.o
239 239 obj-y += stdio.o
240 240  
241   -$(obj)/env_embedded.o: $(src)/env_embedded.c
242   - $(CC) $(AFLAGS) -Wa,--no-warn \
243   - -DENV_CRC=$(shell tools/envcrc) -c -o $@ $<
244   -
245   -# SEE README.arm-unaligned-accesses
246   -$(obj)/hush.o: CFLAGS += $(PLATFORM_NO_UNALIGNED)
247   -$(obj)/fdt_support.o: CFLAGS += $(PLATFORM_NO_UNALIGNED)
  241 +CFLAGS_env_embedded.o := -Wa,--no-warn -DENV_CRC=$(shell tools/envcrc 2>/dev/null)
  242 +CFLAGS_hush.o := $(PLATFORM_NO_UNALIGNED)
  243 +CFLAGS_fdt_support.o := $(PLATFORM_NO_UNALIGNED)
... ... @@ -58,20 +58,11 @@
58 58  
59 59 OBJCFLAGS += --gap-fill=0xff
60 60  
61   -CPPFLAGS = $(KBUILD_CPPFLAGS) $(RELFLAGS)
62   -CPPFLAGS += $(UBOOTINCLUDE)
63   -CPPFLAGS += $(NOSTDINC_FLAGS) -pipe $(PLATFORM_CPPFLAGS)
  61 +CPPFLAGS = $(RELFLAGS)
  62 +CPPFLAGS += -pipe $(PLATFORM_CPPFLAGS)
64 63  
65   -CFLAGS := $(KBUILD_CFLAGS) $(CPPFLAGS)
66   -
67 64 BCURDIR = $(subst $(SRCTREE)/,,$(CURDIR:$(obj)%=%))
68 65  
69   -AFLAGS := $(KBUILD_AFLAGS) $(CPPFLAGS)
70   -
71 66 LDFLAGS += $(PLATFORM_LDFLAGS)
72 67 LDFLAGS_FINAL += -Bstatic
73   -
74   -#########################################################################
75   -
76   -export PLATFORM_CPPFLAGS PLATFORM_RELFLAGS CPPFLAGS CFLAGS AFLAGS
... ... @@ -5,7 +5,7 @@
5 5 # SPDX-License-Identifier: GPL-2.0+
6 6 #
7 7  
8   -#CFLAGS += -DET_DEBUG -DDEBUG
  8 +#ccflags-y += -DET_DEBUG -DDEBUG
9 9  
10 10 obj-$(CONFIG_PARTITIONS) += part.o
11 11 obj-$(CONFIG_MAC_PARTITION) += part_mac.o
doc/DocBook/Makefile
... ... @@ -24,9 +24,9 @@
24 24  
25 25 ###
26 26 # The targets that may be used.
27   -PHONY += $(obj).depend xmldocs sgmldocs psdocs pdfdocs htmldocs mandocs installmandocs cleandocs
  27 +PHONY += xmldocs sgmldocs psdocs pdfdocs htmldocs mandocs installmandocs cleandocs
28 28  
29   -BOOKS := $(addprefix $(OBJTREE)/doc/DocBook/,$(DOCBOOKS))
  29 +BOOKS := $(addprefix $(obj)/,$(DOCBOOKS))
30 30 xmldocs: $(BOOKS)
31 31 sgmldocs: xmldocs
32 32  
33 33  
... ... @@ -51,10 +51,10 @@
51 51  
52 52 ###
53 53 #External programs used
54   -KERNELDOC = $(SRCTREE)/tools/kernel-doc/kernel-doc
55   -DOCPROC = $(OBJTREE)/tools/kernel-doc/docproc
  54 +KERNELDOC = $(srctree)/tools/kernel-doc/kernel-doc
  55 +DOCPROC = $(objtree)/tools/kernel-doc/docproc
56 56  
57   -XMLTOFLAGS = -m $(SRCTREE)/doc/DocBook/stylesheet.xsl
  57 +XMLTOFLAGS = -m $(srctree)/doc/DocBook/stylesheet.xsl
58 58 XMLTOFLAGS += --skip-validation
59 59  
60 60 ###
61 61  
62 62  
... ... @@ -64,28 +64,36 @@
64 64 # appropriate parameters.
65 65 # The following rules are used to generate the .xml documentation
66 66 # required to generate the final targets. (ps, pdf, html).
67   -%.xml: %.tmpl
68   - $(DOCPROC) doc $< >$@
  67 +quiet_cmd_docproc = DOCPROC $@
  68 + cmd_docproc = SRCTREE=$(srctree)/ $(DOCPROC) doc $< >$@
  69 +define rule_docproc
  70 + set -e; \
  71 + $(if $($(quiet)cmd_$(1)),echo ' $($(quiet)cmd_$(1))';) \
  72 + $(cmd_$(1)); \
  73 + ( \
  74 + echo 'cmd_$@ := $(cmd_$(1))'; \
  75 + echo $@: `SRCTREE=$(srctree) $(DOCPROC) depend $<`; \
  76 + ) > $(dir $@).$(notdir $@).cmd
  77 +endef
69 78  
70   -ifeq ($@, "cleandocs")
71   -sinclude $(obj).depend
72   -$(obj).depend: $(patsubst %.xml, %.tmpl, $(DOCBOOKS))
73   - rm -f $(obj).depend ; \
74   - touch $(obj).depend ; \
75   - for file in $^ ; do \
76   - xmlfile=`echo "$${file}" | \
77   - sed "s/tmpl$$/xml/"` ; \
78   - echo -n "$${xmlfile}: ">> $(obj).depend ; \
79   - $(DOCPROC) depend $$file >> $(obj).depend ; \
80   - echo -e "\n\t$(DOCPROC) doc $< >$${xmlfile} " >> \
81   - $(obj).depend ; \
82   - done
  79 +%.xml: %.tmpl FORCE
  80 + $(call if_changed_rule,docproc)
  81 +
  82 +###
  83 +#Read in all saved dependency files
  84 +cmd_files := $(wildcard $(foreach f,$(BOOKS),$(dir $(f)).$(notdir $(f)).cmd))
  85 +
  86 +ifneq ($(cmd_files),)
  87 + include $(cmd_files)
83 88 endif
84 89  
85 90 ###
86 91 # Changes in kernel-doc force a rebuild of all documentation
87 92 $(BOOKS): $(KERNELDOC)
88 93  
  94 +# Tell kbuild to always build the programs
  95 +always := $(hostprogs-y)
  96 +
89 97 notfoundtemplate = echo "*** You have to install docbook-utils or xmlto ***"; \
90 98 exit 1
91 99 db2xtemplate = db2TYPE -o $(dir $@) $<
92 100  
... ... @@ -111,12 +119,12 @@
111 119 quiet_cmd_db2ps = PS $@
112 120 cmd_db2ps = $(subst TYPE,ps, $($(PS_METHOD)template))
113 121 %.ps : %.xml
114   - $(call cmd_db2ps)
  122 + $(call cmd,db2ps)
115 123  
116 124 quiet_cmd_db2pdf = PDF $@
117 125 cmd_db2pdf = $(subst TYPE,pdf, $($(PDF_METHOD)template))
118 126 %.pdf : %.xml
119   - $(call cmd_db2pdf)
  127 + $(call cmd,db2pdf)
120 128  
121 129  
122 130 index = index.html
123 131  
124 132  
... ... @@ -132,16 +140,16 @@
132 140 quiet_cmd_db2html = HTML $@
133 141 cmd_db2html = xmlto html $(XMLTOFLAGS) -o $(patsubst %.html,%,$@) $< && \
134 142 echo '<a HREF="$(patsubst %.html,%,$(notdir $@))/index.html"> \
135   - $(patsubst %.html,%,$(notdir $@))</a><p>' > $@
  143 + $(patsubst %.html,%,$(notdir $@))</a><p>' > $@
136 144  
137 145 %.html: %.xml
138 146 @(which xmlto > /dev/null 2>&1) || \
139 147 (echo "*** You need to install xmlto ***"; \
140 148 exit 1)
141 149 @rm -rf $@ $(patsubst %.html,%,$@)
142   - $(call cmd_db2html)
  150 + $(call cmd,db2html)
143 151 @if [ ! -z "$(PNG-$(basename $(notdir $@)))" ]; then \
144   - cp $(PNG-$(basename $(notdir $@))) $(patsubst %.html,%,$@); fi
  152 + cp $(PNG-$(basename $(notdir $@))) $(patsubst %.html,%,$@); fi
145 153  
146 154 quiet_cmd_db2man = MAN $@
147 155 cmd_db2man = if grep -q refentry $<; then xmlto man $(XMLTOFLAGS) -o $(obj)/man $< ; gzip -f $(obj)/man/*.9; fi
... ... @@ -150,7 +158,7 @@
150 158 (echo "*** You need to install xmlto ***"; \
151 159 exit 1)
152 160 $(Q)mkdir -p $(obj)/man
153   - $(call cmd_db2man)
  161 + $(call cmd,db2man)
154 162 @touch $@
155 163  
156 164 ###
... ... @@ -162,7 +170,7 @@
162 170 @(which fig2dev > /dev/null 2>&1) || \
163 171 (echo "*** You need to install transfig ***"; \
164 172 exit 1)
165   - $(call cmd_fig2eps)
  173 + $(call cmd,fig2eps)
166 174  
167 175 quiet_cmd_fig2png = FIG2PNG $@
168 176 cmd_fig2png = fig2dev -Lpng $< $@
... ... @@ -171,7 +179,7 @@
171 179 @(which fig2dev > /dev/null 2>&1) || \
172 180 (echo "*** You need to install transfig ***"; \
173 181 exit 1)
174   - $(call cmd_fig2png)
  182 + $(call cmd,fig2png)
175 183  
176 184 ###
177 185 # Rule to convert a .c file to inline XML documentation
... ... @@ -217,7 +225,6 @@
217 225 clean-dirs := $(patsubst %.xml,%,$(DOCBOOKS)) man
218 226  
219 227 cleandocs:
220   - @rm -f $(obj).depend
221 228 @$(Q)rm -f $(call objectify, $(clean-files))
222 229 @$(Q)rm -rf $(call objectify, $(clean-dirs))
223 230  
drivers/bios_emulator/Makefile
... ... @@ -8,9 +8,6 @@
8 8 $(X86DIR)/sys.o \
9 9 $(X86DIR)/debug.o
10 10  
11   -EXTRA_CFLAGS += -I$(srctree)/$(src) -I$(srctree)/$(src)/include \
  11 +ccflags-y := -I$(srctree)/$(src) -I$(srctree)/$(src)/include \
12 12 -D__PPC__ -D__BIG_ENDIAN__
13   -
14   -CFLAGS += $(EXTRA_CFLAGS)
15   -CPPFLAGS += $(EXTRA_CFLAGS)
drivers/hwmon/Makefile
... ... @@ -8,7 +8,7 @@
8 8 # SPDX-License-Identifier: GPL-2.0+
9 9 #
10 10  
11   -#CFLAGS += -DDEBUG
  11 +#ccflags-y += -DDEBUG
12 12  
13 13 obj-$(CONFIG_DTT_ADM1021) += adm1021.o
14 14 obj-$(CONFIG_DTT_ADT7460) += adt7460.o
drivers/net/npe/Makefile
... ... @@ -5,9 +5,7 @@
5 5 # SPDX-License-Identifier: GPL-2.0+
6 6 #
7 7  
8   -LOCAL_CFLAGS += -I$(TOPDIR)/drivers/net/npe/include -DCONFIG_IXP425_COMPONENT_ETHDB -D__linux
9   -CFLAGS += $(LOCAL_CFLAGS)
10   -CPPFLAGS += $(LOCAL_CFLAGS) # needed for depend
  8 +ccflags-y += -I$(src)/include -DCONFIG_IXP425_COMPONENT_ETHDB -D__linux
11 9  
12 10 obj-y := npe.o \
13 11 miiphy.o \
drivers/rtc/Makefile
... ... @@ -5,7 +5,7 @@
5 5 # SPDX-License-Identifier: GPL-2.0+
6 6 #
7 7  
8   -#CFLAGS += -DDEBUG
  8 +#ccflags-y += -DDEBUG
9 9  
10 10 obj-$(CONFIG_RTC_AT91SAM9_RTT) += at91sam9_rtt.o
11 11 obj-$(CONFIG_RTC_BFIN) += bfin_rtc.o
drivers/usb/musb-new/Makefile
... ... @@ -9,8 +9,7 @@
9 9 obj-$(CONFIG_USB_MUSB_AM35X) += am35x.o
10 10 obj-$(CONFIG_USB_MUSB_OMAP2PLUS) += omap2430.o
11 11  
12   -CFLAGS_NO_WARN := $(call cc-option,-Wno-unused-variable) \
13   - $(call cc-option,-Wno-unused-but-set-variable) \
14   - $(call cc-option,-Wno-unused-label)
15   -CFLAGS += $(CFLAGS_NO_WARN)
  12 +ccflags-y := $(call cc-option,-Wno-unused-variable) \
  13 + $(call cc-option,-Wno-unused-but-set-variable) \
  14 + $(call cc-option,-Wno-unused-label)
... ... @@ -36,7 +36,7 @@
36 36 $(1) | sed -r -n 's/^OUTPUT_$(2)[ ("]*([^")]*).*/\1/p'
37 37  
38 38 # Run the compiler and get the link script from the linker
39   -GET_LDS = $(CC) $(CFLAGS) $(LDFLAGS) -Wl,--verbose 2>&1
  39 +GET_LDS = $(CC) $(c_flags) $(ld_flags) -Wl,--verbose 2>&1
40 40  
41 41 $(obj)/dt.o: $(DT_BIN)
42 42 # We want the output format and arch.
examples/api/Makefile
... ... @@ -5,7 +5,7 @@
5 5 #
6 6  
7 7 ifdef FTRACE
8   -CFLAGS += -finstrument-functions -DFTRACE
  8 +ccflags-y += -finstrument-functions -DFTRACE
9 9 endif
10 10  
11 11 ifeq ($(ARCH),powerpc)
... ... @@ -33,12 +33,6 @@
33 33 EXT_COBJ_FILES-y += lib/vsprintf.o
34 34 EXT_SOBJ_FILES-$(CONFIG_PPC) += arch/powerpc/lib/ppcstring.o
35 35  
36   -# Create a list of source files so their dependencies can be auto-generated
37   -SRCS += $(addprefix $(SRCTREE)/,$(EXT_COBJ_FILES-y:.o=.c))
38   -SRCS += $(addprefix $(SRCTREE)/,$(EXT_SOBJ_FILES-y:.o=.S))
39   -SRCS += $(addprefix $(SRCTREE)/examples/api/,$(COBJ_FILES-y:.o=.c))
40   -SRCS += $(addprefix $(SRCTREE)/examples/api/,$(SOBJ_FILES-y:.o=.S))
41   -
42 36 # Create a list of object files to be compiled
43 37 OBJS += $(addprefix $(obj)/,$(SOBJ_FILES-y))
44 38 OBJS += $(addprefix $(obj)/,$(COBJ_FILES-y))
45 39  
... ... @@ -54,10 +48,11 @@
54 48 $(OBJCOPY) -O binary $< $@ 2>/dev/null
55 49  
56 50 # Rule to build generic library C files
57   -$(addprefix $(obj)/,$(notdir $(EXT_COBJ_FILES-y))): $(obj)/%.o: $(SRCTREE)/lib/%.c
58   - $(CC) -g $(CFLAGS) -c -o $@ $<
  51 +$(addprefix $(obj)/,$(notdir $(EXT_COBJ_FILES-y))): $(obj)/%.o: $(SRCTREE)/lib/%.c FORCE
  52 + $(call cmd,force_checksrc)
  53 + $(call if_changed_rule,cc_o_c)
59 54  
60 55 # Rule to build architecture-specific library assembly files
61 56 $(addprefix $(obj)/,$(notdir $(EXT_SOBJ_FILES-y))): $(obj)/%.o: $(SRCTREE)/arch/$(ARCH)/lib/%.S
62   - $(CC) -g $(CFLAGS) -c -o $@ $<
  57 + $(call if_changed_dep,as_o_S)
examples/standalone/Makefile
... ... @@ -6,7 +6,7 @@
6 6 #
7 7  
8 8 ifdef FTRACE
9   -CFLAGS += -finstrument-functions -DFTRACE
  9 +ccflags-y += -finstrument-functions -DFTRACE
10 10 endif
11 11  
12 12 extra-y := hello_world
13 13  
... ... @@ -39,10 +39,11 @@
39 39  
40 40 LIBCOBJS = stubs.o
41 41  
  42 +.SECONDARY: $(call objectify,$(COBJS))
  43 +targets += $(patsubst $(obj)/%,%,$(LIB)) $(COBJS) $(LIBAOBJS) $(LIBCOBJS)
  44 +
42 45 LIBOBJS = $(addprefix $(obj)/,$(LIBAOBJS) $(LIBCOBJS))
43 46  
44   -SRCS := $(COBJS:.o=.c) $(LIBCOBJS:.o=.c) $(LIBAOBJS:.o=.S)
45   -OBJS := $(addprefix $(obj)/,$(COBJS))
46 47 ELF := $(addprefix $(obj)/,$(ELF))
47 48  
48 49 gcclibdir := $(shell dirname `$(CC) -print-libgcc-file-name`)
49 50  
50 51  
... ... @@ -52,19 +53,22 @@
52 53 # also causes the entry point of the standalone application to be
53 54 # inconsistent.
54 55 ifeq ($(ARCH),powerpc)
55   -AFLAGS := $(filter-out $(RELFLAGS),$(AFLAGS))
56   -CFLAGS := $(filter-out $(RELFLAGS),$(CFLAGS))
57   -CPPFLAGS := $(filter-out $(RELFLAGS),$(CPPFLAGS))
  56 +# FIX ME
  57 +CPPFLAGS := $(filter-out $(RELFLAGS), $(CPPFLAGS))
58 58 endif
59 59  
60 60 # We don't want gcc reordering functions if possible. This ensures that an
61 61 # application's entry point will be the first function in the application's
62 62 # source file.
63   -CFLAGS += $(call cc-option,-fno-toplevel-reorder)
  63 +ccflags-y += $(call cc-option,-fno-toplevel-reorder)
64 64  
65 65 #########################################################################
66   -$(LIB): $(LIBOBJS)
67   - $(call cmd_link_o_target, $(LIBOBJS))
  66 +
  67 +quiet_cmd_link_lib = LD $@
  68 + cmd_link_lib = $(LD) $(ld_flags) -r -o $@ $(filter $(LIBOBJS), $^)
  69 +
  70 +$(LIB): $(LIBOBJS) FORCE
  71 + $(call if_changed,link_lib)
68 72  
69 73 $(ELF):
70 74 $(obj)/%: $(obj)/%.o $(LIB)
... ... @@ -15,5 +15,5 @@
15 15 obj-y += log.o orphan.o recovery.o replay.o
16 16  
17 17 # SEE README.arm-unaligned-accesses
18   -$(obj)/super.o: CFLAGS += $(PLATFORM_NO_UNALIGNED)
  18 +CFLAGS_super.o := $(PLATFORM_NO_UNALIGNED)
... ... @@ -24,10 +24,7 @@
24 24 yaffs_summary.o yaffs_tagscompat.o yaffs_verify.o yaffs_yaffs1.o \
25 25 yaffs_yaffs2.o yaffs_mtdif.o yaffs_mtdif2.o
26 26  
27   -YCFLAGS = -DCONFIG_YAFFS_DIRECT -DCONFIG_YAFFS_SHORT_NAMES_IN_RAM
28   -YCFLAGS += -DCONFIG_YAFFS_YAFFS2 -DNO_Y_INLINE
29   -YCFLAGS += -DCONFIG_YAFFS_PROVIDE_DEFS -DCONFIG_YAFFSFS_PROVIDE_VALUES
30   -
31   -CFLAGS += $(YCFLAGS)
32   -CPPFLAGS += $(YCFLAGS)
  27 +ccflags-y = -DCONFIG_YAFFS_DIRECT -DCONFIG_YAFFS_SHORT_NAMES_IN_RAM \
  28 + -DCONFIG_YAFFS_YAFFS2 -DNO_Y_INLINE \
  29 + -DCONFIG_YAFFS_PROVIDE_DEFS -DCONFIG_YAFFSFS_PROVIDE_VALUES
... ... @@ -67,5 +67,5 @@
67 67 obj-$(CONFIG_CMD_LINK_LOCAL) += rand.o
68 68  
69 69 # SEE README.arm-unaligned-accesses
70   -$(obj)/bzlib.o: CFLAGS += $(PLATFORM_NO_UNALIGNED)
  70 +CFLAGS_bzlib.o := $(PLATFORM_NO_UNALIGNED)
... ... @@ -8,7 +8,7 @@
8 8 # SPDX-License-Identifier: GPL-2.0+
9 9 #
10 10  
11   -CFLAGS += -D_LZMA_PROB32
  11 +ccflags-y += -D_LZMA_PROB32
12 12  
13 13 obj-y += LzmaDec.o LzmaTools.o
nand_spl/board/amcc/acadia/Makefile
... ... @@ -12,17 +12,18 @@
12 12 LDSCRIPT= $(TOPDIR)/nand_spl/board/$(BOARDDIR)/u-boot.lds
13 13 LDFLAGS := -T $(nandobj)u-boot.lds -Ttext $(CONFIG_SYS_TEXT_BASE) $(LDFLAGS) \
14 14 $(LDFLAGS_FINAL)
15   -AFLAGS += -DCONFIG_NAND_SPL
16   -CFLAGS += -DCONFIG_NAND_SPL
  15 +asflags-y += -DCONFIG_NAND_SPL
  16 +ccflags-y += -DCONFIG_NAND_SPL
17 17  
18 18 SOBJS = start.o resetvec.o cache.o
19 19 COBJS = gpio.o nand_boot.o nand_ecc.o memory.o ndfc.o pll.o
20 20  
21   -SRCS := $(addprefix $(obj)/,$(SOBJS:.o=.S) $(COBJS:.o=.c))
22 21 OBJS := $(addprefix $(obj)/,$(SOBJS) $(COBJS))
23 22 __OBJS := $(SOBJS) $(COBJS)
24 23 LNDIR := $(nandobj)board/$(BOARDDIR)
25 24  
  25 +targets += $(__OBJS)
  26 +
26 27 all: $(nandobj)u-boot-spl.bin $(nandobj)u-boot-spl-16k.bin \
27 28 $(nandobj)System.map
28 29  
... ... @@ -42,7 +43,7 @@
42 43 sort > $@
43 44  
44 45 $(nandobj)u-boot.lds: $(LDSCRIPT)
45   - $(CPP) $(CPPFLAGS) $(LDPPFLAGS) -ansi -D__ASSEMBLY__ -P - <$^ >$@
  46 + $(CPP) $(cpp_flags) $(LDPPFLAGS) -ansi -D__ASSEMBLY__ -P - <$^ >$@
46 47  
47 48 # create symbolic links for common files
48 49  
nand_spl/board/amcc/bamboo/Makefile
... ... @@ -12,17 +12,18 @@
12 12 LDSCRIPT= $(TOPDIR)/nand_spl/board/$(BOARDDIR)/u-boot.lds
13 13 LDFLAGS := -T $(nandobj)u-boot.lds -Ttext $(CONFIG_SYS_TEXT_BASE) $(LDFLAGS) \
14 14 $(LDFLAGS_FINAL)
15   -AFLAGS += -DCONFIG_NAND_SPL
16   -CFLAGS += -DCONFIG_NAND_SPL
  15 +asflags-y += -DCONFIG_NAND_SPL
  16 +ccflags-y += -DCONFIG_NAND_SPL
17 17  
18 18 SOBJS = start.o init.o resetvec.o
19 19 COBJS = nand_boot.o nand_ecc.o ndfc.o sdram.o
20 20  
21   -SRCS := $(addprefix $(obj)/,$(SOBJS:.o=.S) $(COBJS:.o=.c))
22 21 OBJS := $(addprefix $(obj)/,$(SOBJS) $(COBJS))
23 22 __OBJS := $(SOBJS) $(COBJS)
24 23 LNDIR := $(nandobj)board/$(BOARDDIR)
25 24  
  25 +targets += $(__OBJS)
  26 +
26 27 all: $(nandobj)u-boot-spl.bin $(nandobj)u-boot-spl-16k.bin
27 28  
28 29 $(nandobj)u-boot-spl-16k.bin: $(nandobj)u-boot-spl
... ... @@ -36,7 +37,7 @@
36 37 -Map $(nandobj)u-boot-spl.map -o $@
37 38  
38 39 $(nandobj)u-boot.lds: $(LDSCRIPT)
39   - $(CPP) $(CPPFLAGS) $(LDPPFLAGS) -ansi -D__ASSEMBLY__ -P - <$^ >$@
  40 + $(CPP) $(cpp_flags) $(LDPPFLAGS) -ansi -D__ASSEMBLY__ -P - <$^ >$@
40 41  
41 42 # create symbolic links for common files
42 43  
nand_spl/board/amcc/canyonlands/Makefile
... ... @@ -12,8 +12,8 @@
12 12 LDSCRIPT= $(TOPDIR)/nand_spl/board/$(BOARDDIR)/u-boot.lds
13 13 LDFLAGS := -T $(nandobj)u-boot.lds -Ttext $(CONFIG_SYS_TEXT_BASE) $(LDFLAGS) \
14 14 $(LDFLAGS_FINAL)
15   -AFLAGS += -DCONFIG_NAND_SPL
16   -CFLAGS += -DCONFIG_NAND_SPL
  15 +asflags-y += -DCONFIG_NAND_SPL
  16 +ccflags-y += -DCONFIG_NAND_SPL
17 17  
18 18 SOBJS := start.o
19 19 SOBJS += init.o
20 20  
... ... @@ -23,11 +23,12 @@
23 23 COBJS += nand_ecc.o
24 24 COBJS += ndfc.o
25 25  
26   -SRCS := $(addprefix $(obj)/,$(SOBJS:.o=.S) $(COBJS:.o=.c))
27 26 OBJS := $(addprefix $(obj)/,$(SOBJS) $(COBJS))
28 27 __OBJS := $(SOBJS) $(COBJS)
29 28 LNDIR := $(nandobj)board/$(BOARDDIR)
30 29  
  30 +targets += $(__OBJS)
  31 +
31 32 all: $(nandobj)u-boot-spl.bin $(nandobj)u-boot-spl-16k.bin
32 33  
33 34 $(nandobj)u-boot-spl-16k.bin: $(nandobj)u-boot-spl
... ... @@ -41,7 +42,7 @@
41 42 -Map $(nandobj)u-boot-spl.map -o $@
42 43  
43 44 $(nandobj)u-boot.lds: $(LDSCRIPT)
44   - $(CPP) $(CPPFLAGS) $(LDPPFLAGS) -ansi -D__ASSEMBLY__ -P - <$^ >$@
  45 + $(CPP) $(cpp_flags) $(LDPPFLAGS) -ansi -D__ASSEMBLY__ -P - <$^ >$@
45 46  
46 47 # create symbolic links for common files
47 48  
nand_spl/board/amcc/kilauea/Makefile
... ... @@ -12,17 +12,18 @@
12 12 LDSCRIPT= $(TOPDIR)/nand_spl/board/$(BOARDDIR)/u-boot.lds
13 13 LDFLAGS := -T $(nandobj)u-boot.lds -Ttext $(CONFIG_SYS_TEXT_BASE) $(LDFLAGS) \
14 14 $(LDFLAGS_FINAL)
15   -AFLAGS += -DCONFIG_NAND_SPL
16   -CFLAGS += -DCONFIG_NAND_SPL
  15 +asflags-y += -DCONFIG_NAND_SPL
  16 +ccflags-y += -DCONFIG_NAND_SPL
17 17  
18 18 SOBJS = start.o resetvec.o cache.o
19 19 COBJS = 44x_spd_ddr2.o nand_boot.o nand_ecc.o ndfc.o
20 20  
21   -SRCS := $(addprefix $(obj)/,$(SOBJS:.o=.S) $(COBJS:.o=.c))
22 21 OBJS := $(addprefix $(obj)/,$(SOBJS) $(COBJS))
23 22 __OBJS := $(SOBJS) $(COBJS)
24 23 LNDIR := $(nandobj)board/$(BOARDDIR)
25 24  
  25 +targets += $(__OBJS)
  26 +
26 27 all: $(nandobj)u-boot-spl.bin $(nandobj)u-boot-spl-16k.bin
27 28  
28 29 $(nandobj)u-boot-spl-16k.bin: $(nandobj)u-boot-spl
... ... @@ -36,7 +37,7 @@
36 37 -Map $(nandobj)u-boot-spl.map -o $@
37 38  
38 39 $(nandobj)u-boot.lds: $(LDSCRIPT)
39   - $(CPP) $(CPPFLAGS) $(LDPPFLAGS) -ansi -D__ASSEMBLY__ -P - <$^ >$@
  40 + $(CPP) $(cpp_flags) $(LDPPFLAGS) -ansi -D__ASSEMBLY__ -P - <$^ >$@
40 41  
41 42 # create symbolic links for common files
42 43  
nand_spl/board/amcc/sequoia/Makefile
... ... @@ -12,17 +12,18 @@
12 12 LDSCRIPT= $(TOPDIR)/nand_spl/board/$(BOARDDIR)/u-boot.lds
13 13 LDFLAGS := -T $(nandobj)u-boot.lds -Ttext $(CONFIG_SYS_TEXT_BASE) $(LDFLAGS) \
14 14 $(LDFLAGS_FINAL)
15   -AFLAGS += -DCONFIG_NAND_SPL
16   -CFLAGS += -DCONFIG_NAND_SPL
  15 +asflags-y += -DCONFIG_NAND_SPL
  16 +ccflags-y += -DCONFIG_NAND_SPL
17 17  
18 18 SOBJS = start.o init.o resetvec.o
19 19 COBJS = denali_data_eye.o nand_boot.o nand_ecc.o ndfc.o sdram.o
20 20  
21   -SRCS := $(addprefix $(obj)/,$(SOBJS:.o=.S) $(COBJS:.o=.c))
22 21 OBJS := $(addprefix $(obj)/,$(SOBJS) $(COBJS))
23 22 __OBJS := $(SOBJS) $(COBJS)
24 23 LNDIR := $(nandobj)board/$(BOARDDIR)
25 24  
  25 +targets += $(__OBJS)
  26 +
26 27 all: $(nandobj)u-boot-spl.bin $(nandobj)u-boot-spl-16k.bin
27 28  
28 29 $(nandobj)u-boot-spl-16k.bin: $(nandobj)u-boot-spl
... ... @@ -36,7 +37,7 @@
36 37 -Map $(nandobj)u-boot-spl.map -o $@
37 38  
38 39 $(nandobj)u-boot.lds: $(LDSCRIPT)
39   - $(CPP) $(CPPFLAGS) $(LDPPFLAGS) -ansi -D__ASSEMBLY__ -P - <$^ >$@
  40 + $(CPP) $(cpp_flags) $(LDPPFLAGS) -ansi -D__ASSEMBLY__ -P - <$^ >$@
40 41  
41 42 # create symbolic links for common files
42 43  
nand_spl/board/freescale/mpc8315erdb/Makefile
... ... @@ -13,18 +13,19 @@
13 13 LDSCRIPT= $(TOPDIR)/nand_spl/board/$(BOARDDIR)/u-boot.lds
14 14 LDFLAGS := -T $(nandobj)u-boot.lds -Ttext $(CONFIG_SYS_TEXT_BASE_SPL) \
15 15 $(LDFLAGS) $(LDFLAGS_FINAL)
16   -AFLAGS += -DCONFIG_NAND_SPL
17   -CFLAGS += -DCONFIG_NAND_SPL
  16 +asflags-y += -DCONFIG_NAND_SPL
  17 +ccflags-y += -DCONFIG_NAND_SPL
18 18  
19 19 SOBJS = start.o ticks.o
20 20 COBJS = nand_boot_fsl_elbc.o $(BOARD).o sdram.o ns16550.o spl_minimal.o \
21 21 time.o cache.o
22 22  
23   -SRCS := $(addprefix $(obj)/,$(SOBJS:.o=.S) $(COBJS:.o=.c))
24 23 OBJS := $(addprefix $(obj)/,$(SOBJS) $(COBJS))
25 24 __OBJS := $(SOBJS) $(COBJS)
26 25 LNDIR := $(nandobj)board/$(BOARDDIR)
27 26  
  27 +targets += $(__OBJS)
  28 +
28 29 all: $(nandobj)u-boot-spl.bin $(nandobj)u-boot-spl-16k.bin
29 30  
30 31 $(nandobj)u-boot-spl-16k.bin: $(nandobj)u-boot-spl
... ... @@ -38,7 +39,7 @@
38 39 -Map $(nandobj)u-boot-spl.map -o $@
39 40  
40 41 $(nandobj)u-boot.lds: $(LDSCRIPT)
41   - $(CPP) $(CPPFLAGS) $(LDPPFLAGS) -ansi -D__ASSEMBLY__ -P - <$^ >$@
  42 + $(CPP) $(cpp_flags) $(LDPPFLAGS) -ansi -D__ASSEMBLY__ -P - <$^ >$@
42 43  
43 44 # create symbolic links for common files
44 45  
nand_spl/board/freescale/mpc8536ds/Makefile
... ... @@ -15,18 +15,19 @@
15 15 LDSCRIPT= $(TOPDIR)/$(CPUDIR)/u-boot-nand_spl.lds
16 16 LDFLAGS := -T $(nandobj)u-boot-nand_spl.lds -Ttext $(CONFIG_SYS_TEXT_BASE_SPL) \
17 17 $(LDFLAGS) $(LDFLAGS_FINAL)
18   -AFLAGS += -DCONFIG_NAND_SPL
19   -CFLAGS += -DCONFIG_NAND_SPL
  18 +asflags-y += -DCONFIG_NAND_SPL
  19 +ccflags-y += -DCONFIG_NAND_SPL
20 20  
21 21 SOBJS = start.o resetvec.o
22 22 COBJS = cache.o cpu_init_early.o spl_minimal.o fsl_law.o law.o \
23 23 nand_boot.o nand_boot_fsl_elbc.o ns16550.o tlb.o tlb_table.o
24 24  
25   -SRCS := $(addprefix $(obj)/,$(SOBJS:.o=.S) $(COBJS:.o=.c))
26 25 OBJS := $(addprefix $(obj)/,$(SOBJS) $(COBJS))
27 26 __OBJS := $(SOBJS) $(COBJS)
28 27 LNDIR := $(nandobj)board/$(BOARDDIR)
29 28  
  29 +targets += $(__OBJS)
  30 +
30 31 all: $(nandobj)u-boot-spl.bin $(nandobj)u-boot-spl-16k.bin
31 32  
32 33 $(nandobj)u-boot-spl-16k.bin: $(nandobj)u-boot-spl
... ... @@ -40,7 +41,7 @@
40 41 -Map $(nandobj)u-boot-spl.map -o $@
41 42  
42 43 $(nandobj)u-boot-nand_spl.lds: $(LDSCRIPT)
43   - $(CPP) $(CPPFLAGS) $(LDPPFLAGS) -I$(nandobj)/board/$(BOARDDIR) \
  44 + $(CPP) $(cpp_flags) $(LDPPFLAGS) -I$(nandobj)/board/$(BOARDDIR) \
44 45 -ansi -D__ASSEMBLY__ -P - <$< >$@
45 46  
46 47 # create symbolic links for common files
nand_spl/board/freescale/mpc8569mds/Makefile
... ... @@ -15,18 +15,19 @@
15 15 LDSCRIPT= $(TOPDIR)/$(CPUDIR)/u-boot-nand_spl.lds
16 16 LDFLAGS := -T $(nandobj)u-boot-nand_spl.lds -Ttext $(CONFIG_SYS_TEXT_BASE_SPL) \
17 17 $(LDFLAGS) $(LDFLAGS_FINAL)
18   -AFLAGS += -DCONFIG_NAND_SPL
19   -CFLAGS += -DCONFIG_NAND_SPL
  18 +asflags-y += -DCONFIG_NAND_SPL
  19 +ccflags-y += -DCONFIG_NAND_SPL
20 20  
21 21 SOBJS = start.o resetvec.o
22 22 COBJS = cache.o cpu_init_early.o spl_minimal.o fsl_law.o law.o \
23 23 nand_boot.o nand_boot_fsl_elbc.o ns16550.o tlb.o tlb_table.o
24 24  
25   -SRCS := $(addprefix $(obj)/,$(SOBJS:.o=.S) $(COBJS:.o=.c))
26 25 OBJS := $(addprefix $(obj)/,$(SOBJS) $(COBJS))
27 26 __OBJS := $(SOBJS) $(COBJS)
28 27 LNDIR := $(nandobj)board/$(BOARDDIR)
29 28  
  29 +targets += $(__OBJS)
  30 +
30 31 all: $(nandobj)u-boot-spl.bin $(nandobj)u-boot-spl-16k.bin
31 32  
32 33 $(nandobj)u-boot-spl-16k.bin: $(nandobj)u-boot-spl
... ... @@ -40,7 +41,7 @@
40 41 -Map $(nandobj)u-boot-spl.map -o $@
41 42  
42 43 $(nandobj)u-boot-nand_spl.lds: $(LDSCRIPT)
43   - $(CPP) $(CPPFLAGS) $(LDPPFLAGS) -I$(nandobj)/board/$(BOARDDIR) \
  44 + $(CPP) $(cpp_flags) $(LDPPFLAGS) -I$(nandobj)/board/$(BOARDDIR) \
44 45 -ansi -D__ASSEMBLY__ -P - <$< >$@
45 46  
46 47 # create symbolic links for common files
nand_spl/board/freescale/mpc8572ds/Makefile
... ... @@ -15,18 +15,19 @@
15 15 LDSCRIPT= $(TOPDIR)/$(CPUDIR)/u-boot-nand_spl.lds
16 16 LDFLAGS := -T $(nandobj)u-boot-nand_spl.lds -Ttext $(CONFIG_SYS_TEXT_BASE_SPL) \
17 17 $(LDFLAGS) $(LDFLAGS_FINAL)
18   -AFLAGS += -DCONFIG_NAND_SPL
19   -CFLAGS += -DCONFIG_NAND_SPL
  18 +asflags-y += -DCONFIG_NAND_SPL
  19 +ccflags-y += -DCONFIG_NAND_SPL
20 20  
21 21 SOBJS = start.o resetvec.o
22 22 COBJS = cache.o cpu_init_early.o spl_minimal.o fsl_law.o law.o \
23 23 nand_boot.o nand_boot_fsl_elbc.o ns16550.o tlb.o tlb_table.o
24 24  
25   -SRCS := $(addprefix $(obj)/,$(SOBJS:.o=.S) $(COBJS:.o=.c))
26 25 OBJS := $(addprefix $(obj)/,$(SOBJS) $(COBJS))
27 26 __OBJS := $(SOBJS) $(COBJS)
28 27 LNDIR := $(nandobj)board/$(BOARDDIR)
29 28  
  29 +targets += $(__OBJS)
  30 +
30 31 all: $(nandobj)u-boot-spl.bin $(nandobj)u-boot-spl-16k.bin
31 32  
32 33 $(nandobj)u-boot-spl-16k.bin: $(nandobj)u-boot-spl
... ... @@ -40,7 +41,7 @@
40 41 -Map $(nandobj)u-boot-spl.map -o $@
41 42  
42 43 $(nandobj)u-boot-nand_spl.lds: $(LDSCRIPT)
43   - $(CPP) $(CPPFLAGS) $(LDPPFLAGS) -I$(nandobj)/board/$(BOARDDIR) \
  44 + $(CPP) $(cpp_flags) $(LDPPFLAGS) -I$(nandobj)/board/$(BOARDDIR) \
44 45 -ansi -D__ASSEMBLY__ -P - <$< >$@
45 46  
46 47 # create symbolic links for common files
nand_spl/board/freescale/p1023rds/Makefile
... ... @@ -11,18 +11,19 @@
11 11 LDSCRIPT= $(TOPDIR)/$(CPUDIR)/u-boot-nand_spl.lds
12 12 LDFLAGS := -T $(nandobj)u-boot-nand_spl.lds -Ttext $(CONFIG_SYS_TEXT_BASE_SPL) \
13 13 $(LDFLAGS) $(LDFLAGS_FINAL)
14   -AFLAGS += -DCONFIG_NAND_SPL
15   -CFLAGS += -DCONFIG_NAND_SPL
  14 +asflags-y += -DCONFIG_NAND_SPL
  15 +ccflags-y += -DCONFIG_NAND_SPL
16 16  
17 17 SOBJS = start.o resetvec.o
18 18 COBJS = cache.o cpu_init_early.o spl_minimal.o fsl_law.o law.o \
19 19 nand_boot.o nand_boot_fsl_elbc.o ns16550.o tlb.o tlb_table.o
20 20  
21   -SRCS := $(addprefix $(obj)/,$(SOBJS:.o=.S) $(COBJS:.o=.c))
22 21 OBJS := $(addprefix $(obj)/,$(SOBJS) $(COBJS))
23 22 __OBJS := $(SOBJS) $(COBJS)
24 23 LNDIR := $(nandobj)board/$(BOARDDIR)
25 24  
  25 +targets += $(__OBJS)
  26 +
26 27 all: $(nandobj)u-boot-spl.bin $(nandobj)u-boot-spl-16k.bin
27 28  
28 29 $(nandobj)u-boot-spl-16k.bin: $(nandobj)u-boot-spl
... ... @@ -36,7 +37,7 @@
36 37 -Map $(nandobj)u-boot-spl.map -o $@
37 38  
38 39 $(nandobj)u-boot-nand_spl.lds: $(LDSCRIPT)
39   - $(CPP) $(CPPFLAGS) $(LDPPFLAGS) -I$(nandobj)/board/$(BOARDDIR) \
  40 + $(CPP) $(cpp_flags) $(LDPPFLAGS) -I$(nandobj)/board/$(BOARDDIR) \
40 41 -ansi -D__ASSEMBLY__ -P - <$< >$@
41 42  
42 43 # create symbolic links for common files
nand_spl/board/freescale/p1_p2_rdb/Makefile
... ... @@ -15,18 +15,19 @@
15 15 LDSCRIPT= $(TOPDIR)/$(CPUDIR)/u-boot-nand_spl.lds
16 16 LDFLAGS := -T $(nandobj)u-boot-nand_spl.lds -Ttext $(CONFIG_SYS_TEXT_BASE_SPL) \
17 17 $(LDFLAGS) $(LDFLAGS_FINAL)
18   -AFLAGS += -DCONFIG_NAND_SPL
19   -CFLAGS += -DCONFIG_NAND_SPL
  18 +asflags-y += -DCONFIG_NAND_SPL
  19 +ccflags-y += -DCONFIG_NAND_SPL
20 20  
21 21 SOBJS = start.o resetvec.o
22 22 COBJS = cache.o cpu_init_early.o spl_minimal.o fsl_law.o law.o \
23 23 nand_boot.o nand_boot_fsl_elbc.o ns16550.o tlb.o tlb_table.o
24 24  
25   -SRCS := $(addprefix $(obj)/,$(SOBJS:.o=.S) $(COBJS:.o=.c))
26 25 OBJS := $(addprefix $(obj)/,$(SOBJS) $(COBJS))
27 26 __OBJS := $(SOBJS) $(COBJS)
28 27 LNDIR := $(nandobj)board/$(BOARDDIR)
29 28  
  29 +targets += $(__OBJS)
  30 +
30 31 all: $(nandobj)u-boot-spl.bin $(nandobj)u-boot-spl-16k.bin
31 32  
32 33 $(nandobj)u-boot-spl-16k.bin: $(nandobj)u-boot-spl
... ... @@ -40,7 +41,7 @@
40 41 -Map $(nandobj)u-boot-spl.map -o $@
41 42  
42 43 $(nandobj)u-boot-nand_spl.lds: $(LDSCRIPT)
43   - $(CPP) $(CPPFLAGS) $(LDPPFLAGS) -I$(nandobj)/board/$(BOARDDIR) \
  44 + $(CPP) $(cpp_flags) $(LDPPFLAGS) -I$(nandobj)/board/$(BOARDDIR) \
44 45 -ansi -D__ASSEMBLY__ -P - <$< >$@
45 46  
46 47 # create symbolic links for common files
nand_spl/board/sheldon/simpc8313/Makefile
... ... @@ -12,18 +12,19 @@
12 12 LDSCRIPT= $(TOPDIR)/nand_spl/board/$(BOARDDIR)/u-boot.lds
13 13 LDFLAGS := -T $(nandobj)u-boot.lds -Ttext $(CONFIG_SYS_TEXT_BASE_SPL) \
14 14 $(LDFLAGS) $(LDFLAGS_FINAL)
15   -AFLAGS += -DCONFIG_NAND_SPL
16   -CFLAGS += -DCONFIG_NAND_SPL
  15 +asflags-y += -DCONFIG_NAND_SPL
  16 +ccflags-y += -DCONFIG_NAND_SPL
17 17  
18 18 SOBJS = start.o ticks.o
19 19 COBJS = nand_boot_fsl_elbc.o $(BOARD).o sdram.o ns16550.o spl_minimal.o \
20 20 time.o cache.o
21 21  
22   -SRCS := $(addprefix $(obj)/,$(SOBJS:.o=.S) $(COBJS:.o=.c))
23 22 OBJS := $(addprefix $(obj)/,$(SOBJS) $(COBJS))
24 23 __OBJS := $(SOBJS) $(COBJS)
25 24 LNDIR := $(nandobj)board/$(BOARDDIR)
26 25  
  26 +targets += $(__OBJS)
  27 +
27 28 all: $(nandobj)u-boot-spl.bin $(nandobj)u-boot-spl-16k.bin
28 29  
29 30 $(nandobj)u-boot-spl-16k.bin: $(nandobj)u-boot-spl
... ... @@ -37,7 +38,7 @@
37 38 -Map $(nandobj)u-boot-spl.map -o $@
38 39  
39 40 $(nandobj)u-boot.lds: $(LDSCRIPT)
40   - $(CPP) $(CPPFLAGS) $(LDPPFLAGS) -ansi -D__ASSEMBLY__ -P - <$^ >$@
  41 + $(CPP) $(cpp_flags) $(LDPPFLAGS) -ansi -D__ASSEMBLY__ -P - <$^ >$@
41 42  
42 43 # create symbolic links for common files
43 44  
... ... @@ -5,7 +5,7 @@
5 5 # SPDX-License-Identifier: GPL-2.0+
6 6 #
7 7  
8   -# CFLAGS += -DDEBUG
  8 +#ccflags-y += -DDEBUG
9 9  
10 10 obj-$(CONFIG_CMD_NET) += arp.o
11 11 obj-$(CONFIG_CMD_NET) += bootp.o
post/lib_powerpc/fpu/Makefile
... ... @@ -5,21 +5,20 @@
5 5 # SPDX-License-Identifier: GPL-2.0+
6 6 #
7 7  
8   -obj-y += 20001122-1.o
9   -obj-y += 20010114-2.o
10   -obj-y += 20010226-1.o
11   -obj-y += 980619-1.o
12   -obj-y += acc1.o
13   -obj-y += compare-fp-1.o
14   -obj-y += fpu.o
15   -obj-y += mul-subnormal-single-1.o
16   -obj-y += darwin-ldouble.o
  8 +objs-before-objcopy := 20001122-1.o 20010114-2.o 20010226-1.o 980619-1.o \
  9 + acc1.o compare-fp-1.o fpu.o mul-subnormal-single-1.o darwin-ldouble.o
  10 +targets += $(objs-before-objcopy)
17 11  
18   -CFLAGS := $(shell echo $(CFLAGS) | sed s/-msoft-float//)
19   -CFLAGS += -mhard-float -fkeep-inline-functions
  12 +# remove -msoft-float flag
  13 +$(foreach m, $(objs-before-objcopy), $(eval CFLAGS_REMOVE_$m := -msoft-float))
  14 +ccflags-y := -mhard-float -fkeep-inline-functions
20 15  
21   -$(addprefix $(obj)/,$(obj-y)): $(obj)/%.o: $(src)/%.c
22   - $(CC) $(ALL_CFLAGS) -o $@.fp $< -c
23   - $(OBJCOPY) -R .gnu.attributes $@.fp $@
24   - rm -f $@.fp
  16 +# Do not delete intermidiate files (*.o)
  17 +.SECONDARY: $(call objectify, $(objs-before-objcopy))
  18 +
  19 +obj-y := $(objs-before-objcopy:.o=_.o)
  20 +
  21 +OBJCOPYFLAGS := -R .gnu.attributes
  22 +$(obj)/%_.o: $(obj)/%.o
  23 + $(call if_changed,objcopy)
scripts/Kbuild.include
... ... @@ -165,7 +165,7 @@
165 165 # Shorthand for $(Q)$(MAKE) -f scripts/Makefile.build obj=
166 166 # Usage:
167 167 # $(Q)$(MAKE) $(build)=dir
168   -build := -f $(if $(KBUILD_SRC),$(srctree)/)scripts/Makefile.build.tmp obj
  168 +build := -f $(if $(KBUILD_SRC),$(srctree)/)scripts/Makefile.build obj
169 169  
170 170 ###
171 171 # Shorthand for $(Q)$(MAKE) -f scripts/Makefile.modbuiltin obj=
scripts/Makefile.build
... ... @@ -2,7 +2,16 @@
2 2 # Building
3 3 # ==========================================================================
4 4  
5   -src := $(obj)
  5 +# Modified for U-Boot
  6 +ifeq ($(CONFIG_TPL_BUILD),y)
  7 + src := $(patsubst tpl/%,%,$(obj))
  8 +else
  9 + ifeq ($(CONFIG_SPL_BUILD),y)
  10 + src := $(patsubst spl/%,%,$(obj))
  11 + else
  12 + src := $(obj)
  13 + endif
  14 +endif
6 15  
7 16 PHONY := __build
8 17 __build:
... ... @@ -35,6 +44,11 @@
35 44  
36 45 include scripts/Kbuild.include
37 46  
  47 +# Added for U-Boot
  48 +# We must include config.mk after Kbuild.include
  49 +# so that some config.mk can use cc-option.
  50 +include config.mk
  51 +
38 52 # For backward compatibility check that these variables do not change
39 53 save-cflags := $(CFLAGS)
40 54  
41 55  
... ... @@ -115,14 +129,16 @@
115 129 include scripts/Makefile.host
116 130 endif
117 131  
118   -ifneq ($(KBUILD_SRC),)
  132 +# Uncommented for U-Boot
  133 +# We need to create output dicrectory for SPL and TPL even for in-tree build
  134 +#ifneq ($(KBUILD_SRC),)
119 135 # Create output directory if not already present
120 136 _dummy := $(shell [ -d $(obj) ] || mkdir -p $(obj))
121 137  
122 138 # Create directories for object files if directory does not exist
123 139 # Needed when obj-y := dir/file.o syntax is used
124 140 _dummy := $(foreach d,$(obj-dirs), $(shell [ -d $(d) ] || mkdir -p $(d)))
125   -endif
  141 +#endif
126 142  
127 143 ifndef obj
128 144 $(warning kbuild: Makefile.build is included improperly)
scripts/Makefile.lib
... ... @@ -101,12 +101,13 @@
101 101 modname_flags = $(if $(filter 1,$(words $(modname))),\
102 102 -D"KBUILD_MODNAME=KBUILD_STR($(call name-fix,$(modname)))")
103 103  
104   -orig_c_flags = $(KBUILD_CPPFLAGS) $(KBUILD_CFLAGS) $(KBUILD_SUBDIR_CCFLAGS) \
  104 +# U-Boot also uses $(CPPFLAGS)
  105 +orig_c_flags = $(KBUILD_CPPFLAGS) $(CPPFLAGS) $(KBUILD_CFLAGS) $(KBUILD_SUBDIR_CCFLAGS) \
105 106 $(ccflags-y) $(CFLAGS_$(basetarget).o)
106 107 _c_flags = $(filter-out $(CFLAGS_REMOVE_$(basetarget).o), $(orig_c_flags))
107   -_a_flags = $(KBUILD_CPPFLAGS) $(KBUILD_AFLAGS) $(KBUILD_SUBDIR_ASFLAGS) \
  108 +_a_flags = $(KBUILD_CPPFLAGS) $(CPPFLAGS) $(KBUILD_AFLAGS) $(KBUILD_SUBDIR_ASFLAGS) \
108 109 $(asflags-y) $(AFLAGS_$(basetarget).o)
109   -_cpp_flags = $(KBUILD_CPPFLAGS) $(cppflags-y) $(CPPFLAGS_$(@F))
  110 +_cpp_flags = $(KBUILD_CPPFLAGS) $(CPPFLAGS) $(cppflags-y) $(CPPFLAGS_$(@F))
110 111  
111 112 #
112 113 # Enable gcov profiling flags for a file, directory or for all files depending
113 114  
114 115  
... ... @@ -137,14 +138,15 @@
137 138 __cpp_flags = $(call flags,_cpp_flags)
138 139 endif
139 140  
140   -c_flags = -Wp,-MD,$(depfile) $(NOSTDINC_FLAGS) $(LINUXINCLUDE) \
  141 +# Modified for U-Boot: LINUXINCLUDE -> UBOOTINCLUDE
  142 +c_flags = -Wp,-MD,$(depfile) $(NOSTDINC_FLAGS) $(UBOOTINCLUDE) \
141 143 $(__c_flags) $(modkern_cflags) \
142 144 -D"KBUILD_STR(s)=\#s" $(basename_flags) $(modname_flags)
143 145  
144   -a_flags = -Wp,-MD,$(depfile) $(NOSTDINC_FLAGS) $(LINUXINCLUDE) \
  146 +a_flags = -Wp,-MD,$(depfile) $(NOSTDINC_FLAGS) $(UBOOTINCLUDE) \
145 147 $(__a_flags) $(modkern_aflags)
146 148  
147   -cpp_flags = -Wp,-MD,$(depfile) $(NOSTDINC_FLAGS) $(LINUXINCLUDE) \
  149 +cpp_flags = -Wp,-MD,$(depfile) $(NOSTDINC_FLAGS) $(UBOOTINCLUDE) \
148 150 $(__cpp_flags)
149 151  
150 152 ld_flags = $(LDFLAGS) $(ldflags-y)
... ... @@ -106,8 +106,7 @@
106 106  
107 107 # Add GCC lib
108 108 ifeq ("$(USE_PRIVATE_LIBGCC)", "yes")
109   -PLATFORM_LIBGCC = $(SPLTREE)/arch/$(ARCH)/lib/libgcc.o
110   -PLATFORM_LIBS := $(filter-out %/libgcc.o, $(filter-out -lgcc, $(PLATFORM_LIBS))) $(PLATFORM_LIBGCC)
  109 +PLATFORM_LIBS := $(SPLTREE)/arch/$(ARCH)/lib/lib.a
111 110 endif
112 111  
113 112 LIBS-y := $(sort $(LIBS-y))
... ... @@ -155,7 +154,7 @@
155 154 $(OBJTREE)/tools/mkimage -T omapimage -n byteswap \
156 155 -a $(CONFIG_SPL_TEXT_BASE) -d $< $@
157 156  
158   -$(objtree)/SPL : $(obj)/u-boot-spl.bin depend
  157 +$(objtree)/SPL : $(obj)/u-boot-spl.bin
159 158 $(MAKE) $(build)=spl/arch/arm/imx-common $@
160 159  
161 160 ALL-y += $(obj)/$(SPL_BIN).bin
162 161  
163 162  
164 163  
165 164  
... ... @@ -191,21 +190,25 @@
191 190 --start-group $(__LIBS) --end-group $(PLATFORM_LIBS) \
192 191 -Map $(SPL_BIN).map -o $(SPL_BIN)
193 192  
194   -$(obj)/$(SPL_BIN): depend $(START) $(LIBS) $(obj)/u-boot-spl.lds
  193 +$(obj)/$(SPL_BIN): $(START) $(LIBS) $(obj)/u-boot-spl.lds
195 194 $(GEN_UBOOT)
196 195  
197 196 $(START):
198 197 @:
199 198  
200   -$(LIBS): depend
201   - $(MAKE) $(build)=$(patsubst %/,%,$(dir $@))
  199 +$(LIBS):
  200 + $(Q)$(MAKE) $(build)=$(patsubst %/,%,$(dir $@))
202 201  
203   -$(obj)/u-boot-spl.lds: $(LDSCRIPT) depend
204   - $(CPP) $(CPPFLAGS) $(LDPPFLAGS) -I$(obj). -ansi -D__ASSEMBLY__ -P - < $< > $@
  202 +# FIX ME
  203 +cpp_flags := $(KBUILD_CPPFLAGS) $(CPPFLAGS) $(UBOOTINCLUDE) $(NOSTDINC_FLAGS)
205 204  
206   -depend: $(obj)/.depend
207   -.PHONY: depend
  205 +$(obj)/u-boot-spl.lds: $(LDSCRIPT) FORCE
  206 + $(CPP) $(cpp_flags) $(LDPPFLAGS) -I$(obj). -ansi -D__ASSEMBLY__ -P - < $< > $@
208 207  
209   -# defines $(obj).depend target
210   -include $(SRCTREE)/rules.mk
  208 +PHONY += FORCE
  209 +FORCE:
  210 +
  211 +# Declare the contents of the .PHONY variable as phony. We keep that
  212 +# information in a variable so we can use it in if_changed and friends.
  213 +.PHONY: $(PHONY)
... ... @@ -40,19 +40,19 @@
40 40  
41 41 hostprogs-$(CONFIG_LCD_LOGO) += bmp_logo$(SFX)
42 42 hostprogs-$(CONFIG_VIDEO_LOGO) += bmp_logo$(SFX)
43   -HOSTCFLAGS_bmp_logo$(SFX) := -pedantic
  43 +HOSTCFLAGS_bmp_logo$(SFX).o := -pedantic
44 44  
45 45 hostprogs-$(CONFIG_BUILD_ENVCRC) += envcrc$(SFX)
46 46 envcrc$(SFX)-objs := crc32.o env_embedded.o envcrc.o sha1.o
47 47  
48 48 hostprogs-$(CONFIG_CMD_NET) += gen_eth_addr$(SFX)
49   -HOSTCFLAGS_gen_eth_addr$(SFX) := -pedantic
  49 +HOSTCFLAGS_gen_eth_addr$(SFX).o := -pedantic
50 50  
51 51 hostprogs-$(CONFIG_CMD_LOADS) += img2srec$(SFX)
52   -HOSTCFLAGS_img2srec$(SFX) := -pedantic
  52 +HOSTCFLAGS_img2srec$(SFX).o := -pedantic
53 53  
54 54 hostprogs-$(CONFIG_XWAY_SWAP_BYTES) += xway-swap-bytes$(SFX)
55   -HOSTCFLAGS_xway-swap-bytes$(SFX) := -pedantic
  55 +HOSTCFLAGS_xway-swap-bytes$(SFX).o := -pedantic
56 56  
57 57 hostprogs-y += mkenvimage$(SFX)
58 58 mkenvimage$(SFX)-objs := crc32.o mkenvimage.o os_support.o
... ... @@ -97,7 +97,7 @@
97 97 HOSTLOADLIBES_mkimage$(SFX) := -lssl -lcrypto
98 98 # Add CONFIG_MXS into host CFLAGS, so we can check whether or not register
99 99 # the mxsimage support within tools/mxsimage.c .
100   -HOSTCFLAGS += -DCONFIG_MXS
  100 +HOSTCFLAGS_mxsimage.o += -DCONFIG_MXS
101 101 endif
102 102  
103 103 ifdef CONFIG_FIT_SIGNATURE
104 104  
... ... @@ -111,11 +111,11 @@
111 111  
112 112 hostprogs-$(CONFIG_EXYNOS5250) += mkexynosspl$(SFX)
113 113 hostprogs-$(CONFIG_EXYNOS5420) += mkexynosspl$(SFX)
114   -HOSTCFLAGS_mkexynosspl$(SFX) := -pedantic
  114 +HOSTCFLAGS_mkexynosspl$(SFX).o := -pedantic
115 115  
116 116 hostprogs-$(CONFIG_MX23) += mxsboot$(SFX)
117 117 hostprogs-$(CONFIG_MX28) += mxsboot$(SFX)
118   -HOSTCFLAGS_mxsboot$(SFX) := -pedantic
  118 +HOSTCFLAGS_mxsboot$(SFX).o := -pedantic
119 119  
120 120 hostprogs-$(CONFIG_NETCONSOLE) += ncb$(SFX)
121 121 hostprogs-$(CONFIG_SHA1_CHECK_UB_IMG) += ubsha1$(SFX)
... ... @@ -137,7 +137,7 @@
137 137  
138 138 # Don't build by default
139 139 #hostprogs-$(CONFIG_PPC) += mpc86x_clk$(SFX)
140   -#HOSTCFLAGS_mpc86x_clk$(SFX) := -pedantic
  140 +#HOSTCFLAGS_mpc86x_clk$(SFX).o := -pedantic
141 141  
142 142 always := $(hostprogs-y)
143 143  
... ... @@ -164,11 +164,6 @@
164 164  
165 165 endif # !LOGO_BMP
166 166  
167   -# now $(obj) is defined
168   -HOSTSRCS += $(addprefix $(SRCTREE)/,$(EXT_OBJ_FILES-y:.o=.c))
169   -HOSTSRCS += $(addprefix $(SRCTREE)/tools/,$(OBJ_FILES-y:.o=.c))
170   -HOSTSRCS += $(addprefix $(SRCTREE)/lib/libfdt/,$(LIBFDT_OBJ_FILES-y:.o=.c))
171   -
172 167 #
173 168 # Use native tools and options
174 169 # Define __KERNEL_STRICT_NAMES to prevent typedef overlaps
... ... @@ -183,7 +178,7 @@
183 178 -D__KERNEL_STRICT_NAMES \
184 179 -D_GNU_SOURCE
185 180  
186   -all: $(LOGO-y)
  181 +__build: $(LOGO-y)
187 182  
188 183 subdir-y := kernel-doc
189 184