@ -203,34 +203,6 @@ VENDOR=
#########################################################################
# The "tools" are needed early, so put this first
# Don't include stuff already done in $(LIBS)
# The "examples" conditionally depend on U-Boot (say, when USE_PRIVATE_LIBGCC
# is "yes"), so compile examples after U-Boot is compiled.
SUBDIR_TOOLS = tools
SUBDIRS = $( SUBDIR_TOOLS)
.PHONY : $( SUBDIRS ) $( VERSION_FILE ) $( TIMESTAMP_FILE )
i f e q ( i n c l u d e / c o n f i g . m k , $( wildcard include /config .mk ) )
# Include autoconf.mk before config.mk so that the config options are available
# to all top level build files. We need the dummy all: target to prevent the
# dependency target in autoconf.mk.dep from being the default.
all :
s i n c l u d e i n c l u d e / a u t o c o n f . m k . d e p
s i n c l u d e i n c l u d e / a u t o c o n f . m k
SUBDIR_EXAMPLES-y := examples/standalone
SUBDIR_EXAMPLES-$(CONFIG_API) += examples/api
i f n d e f C O N F I G _ S A N D B O X
SUBDIRS += $( SUBDIR_EXAMPLES-y)
e n d i f
# load ARCH, BOARD, and CPU configuration
i n c l u d e i n c l u d e / c o n f i g . m k
export ARCH CPU BOARD VENDOR SOC
# set default to nothing for native builds
i f e q ( $( HOSTARCH ) , $( ARCH ) )
CROSS_COMPILE ?=
@ -377,15 +349,6 @@ CHECK = sparse
CHECKFLAGS := -D__linux__ -Dlinux -D__STDC__ -Dunix -D__unix__ \
-Wbitwise -Wno-return-void -D__CHECK_ENDIAN__ $( CF)
# Use UBOOTINCLUDE when you must reference the include/ directory.
# Needed to be compatible with the O= option
UBOOTINCLUDE :=
i f n e q ( $( OBJTREE ) , $( SRCTREE ) )
UBOOTINCLUDE += -I$( OBJTREE) /include
e n d i f
UBOOTINCLUDE += -I$( srctree) /include \
-I$( srctree) /arch/$( ARCH) /include
KBUILD_CPPFLAGS := -D__KERNEL__
KBUILD_CFLAGS := -Wall -Wstrict-prototypes \
@ -396,6 +359,7 @@ KBUILD_AFLAGS := -D__ASSEMBLY__
U_BOOT_VERSION = $( VERSION) $( if $( PATCHLEVEL) ,.$( PATCHLEVEL) $( if $( SUBLEVEL) ,.$( SUBLEVEL) ) ) $( EXTRAVERSION)
export VERSION PATCHLEVEL SUBLEVEL U_BOOT_VERSION
export ARCH CPU BOARD VENDOR SOC
export CONFIG_SHELL HOSTCC HOSTCFLAGS HOSTLDFLAGS CROSS_COMPILE AS LD CC
export CPP AR NM LDR STRIP OBJCOPY OBJDUMP
export MAKE AWK
@ -428,65 +392,84 @@ scripts_basic:
# To avoid any implicit rule to kick in, define an empty command.
scripts/basic/% : scripts_basic ;
# To make sure we do not include .config for any of the *config targets
# catch them early, and hand them over to scripts/kconfig/Makefile
# It is allowed to specify more targets when calling make, including
# mixing *config targets and build targets.
# For example 'make oldconfig all'.
# Detect when mixed targets is specified, and make a second invocation
# of make so .config is not included in this case either (for *config).
no-dot-config-targets := clean clobber mrproper distclean \
cscope TAGS %tags help %docs check% coccicheck \
backup
config-targets := 0
mixed-targets := 0
dot-config := 1
i f n e q ( $( filter $ ( no -dot -config -targets ) , $ ( MAKECMDGOALS ) ) , )
ifeq ( $( filter-out $( no-dot-config-targets) , $( MAKECMDGOALS) ) ,)
dot-config := 0
endif
e n d i f
KBUILD_CFLAGS += -Os #-fomit-frame-pointer
i f d e f B U I L D _ T A G
KBUILD_CFLAGS += -DBUILD_TAG= '"$(BUILD_TAG)"'
i f e q ( $( KBUILD_EXTMOD ) , )
ifneq ( $( filter config %config,$( MAKECMDGOALS) ) ,)
config-targets := 1
ifneq ( $( filter-out config %config,$( MAKECMDGOALS) ) ,)
mixed-targets := 1
endif
endif
e n d i f
KBUILD_CFLAGS += $( call cc-option,-fno-stack-protector)
i f e q ( $( mixed -targets ) , 1 )
# ===========================================================================
# We're called with mixed targets (*config and build targets).
# Handle them one by one.
KBUILD_CFLAGS += -g
# $(KBUILD_AFLAGS) sets -g, which causes gcc to pass a suitable -g<format>
# option to the assembler.
KBUILD_AFLAGS += -g
% :: FORCE
$( Q) $( MAKE) -C $( srctree) KBUILD_SRC = $@
NOSTDINC_FLAGS += -nostdinc -isystem $( shell $( CC) -print-file-name= include)
CHECKFLAGS += $( NOSTDINC_FLAGS)
e l s e
i f e q ( $( config -targets ) , 1 )
# ===========================================================================
# *config targets only - make sure prerequisites are updated, and descend
# in scripts/kconfig to make the *config target
# Report stack usage if supported
KBUILD_CFLAGS += $( call cc-option,-fstack-usage)
# Read arch specific Makefile to set KBUILD_DEFCONFIG as needed.
# KBUILD_DEFCONFIG may point out an alternative default configuration
# used for 'make defconfig'
KBUILD_CFLAGS += $( call cc-option,-Wno-format-nonliteral)
%_config ::
@$( MKCONFIG) -A $( @:_config= )
# turn jbsr into jsr for m68k
i f e q ( $( ARCH ) , m 6 8 k )
i f e q ( $( findstring 3.4,$ ( shell $ ( CC ) --version ) ) , 3 . 4 )
KBUILD_AFLAGS += -Wa,-gstabs,-S
e n d i f
e n d i f
e l s e
# ===========================================================================
# Build targets only - this includes vmlinux, arch specific targets, clean
# targets and others. In general all targets except *config targets.
# load other configuration
i n c l u d e $( TOPDIR ) / c o n f i g . m k
# load ARCH, BOARD, and CPU configuration
- i n c l u d e i n c l u d e / c o n f i g . m k
i f n e q ( $( CONFIG_SYS_TEXT_BASE ) , )
KBUILD_CPPFLAGS += -DCONFIG_SYS_TEXT_BASE= $( CONFIG_SYS_TEXT_BASE)
e n d i f
i f e q ( $( dot -config ) , 1 )
# Read in config
- i n c l u d e i n c l u d e / a u t o c o n f . m k
- i n c l u d e i n c l u d e / a u t o c o n f . m k . d e p
export CONFIG_SYS_TEXT_BASE
# load other configuration
i n c l u d e $( srctree ) / c o n f i g . m k
LDFLAGS_u-boot += -T u-boot.lds $( LDFLAGS_FINAL)
i f n e q ( $( CONFIG_SYS_TEXT_BASE ) , )
LDFLAGS_u-boot += -Ttext $( CONFIG_SYS_TEXT_BASE)
i f e q ( $( wildcard include /config .mk ) , )
$( error "System not configured - see README ")
e n d i f
# Targets which don't build the source code
NON_BUILD_TARGETS = backup clean clobber distclean mrproper unconfig %_config
# Only do the generic board check when actually building, not configuring
i f e q ( $( filter $ ( NON_BUILD_TARGETS ) ,$ ( MAKECMDGOALS ) ) , )
i f e q ( $( __HAVE_ARCH_GENERIC_BOARD ) , )
i f n e q ( $( CONFIG_SYS_GENERIC_BOARD ) , )
CHECK_GENERIC_BOARD = $( error Your architecture does not support generic board. \
$( error Your architecture does not support generic board . \
P l e a s e u n d e f i n e d C O N F I G _ S Y S _ G E N E R I C _ B O A R D i n y o u r b o a r d c o n f i g f i l e )
e n d i f
e n d i f
e n d i f
# FIX ME
cpp_flags := $( KBUILD_CPPFLAGS) $( CPPFLAGS) $( UBOOTINCLUDE) $( NOSTDINC_FLAGS)
c_flags := $( KBUILD_CFLAGS) $( cpp_flags)
# If board code explicitly specified LDSCRIPT or CONFIG_SYS_LDSCRIPT, use
# that (or fail if absent). Otherwise, search for a linker script in a
@ -526,6 +509,73 @@ $(error could not find linker script)
endif
e n d i f
e l s e
e n d i f # $(dot-config)
KBUILD_CFLAGS += -Os #-fomit-frame-pointer
i f d e f B U I L D _ T A G
KBUILD_CFLAGS += -DBUILD_TAG= '"$(BUILD_TAG)"'
e n d i f
KBUILD_CFLAGS += $( call cc-option,-fno-stack-protector)
KBUILD_CFLAGS += -g
# $(KBUILD_AFLAGS) sets -g, which causes gcc to pass a suitable -g<format>
# option to the assembler.
KBUILD_AFLAGS += -g
# Report stack usage if supported
KBUILD_CFLAGS += $( call cc-option,-fstack-usage)
KBUILD_CFLAGS += $( call cc-option,-Wno-format-nonliteral)
# turn jbsr into jsr for m68k
i f e q ( $( ARCH ) , m 6 8 k )
i f e q ( $( findstring 3.4,$ ( shell $ ( CC ) --version ) ) , 3 . 4 )
KBUILD_AFLAGS += -Wa,-gstabs,-S
e n d i f
e n d i f
i f n e q ( $( CONFIG_SYS_TEXT_BASE ) , )
KBUILD_CPPFLAGS += -DCONFIG_SYS_TEXT_BASE= $( CONFIG_SYS_TEXT_BASE)
e n d i f
export CONFIG_SYS_TEXT_BASE
# Use UBOOTINCLUDE when you must reference the include/ directory.
# Needed to be compatible with the O= option
UBOOTINCLUDE :=
i f n e q ( $( OBJTREE ) , $( SRCTREE ) )
UBOOTINCLUDE += -I$( OBJTREE) /include
e n d i f
UBOOTINCLUDE += -I$( srctree) /include \
-I$( srctree) /arch/$( ARCH) /include
NOSTDINC_FLAGS += -nostdinc -isystem $( shell $( CC) -print-file-name= include)
CHECKFLAGS += $( NOSTDINC_FLAGS)
# FIX ME
cpp_flags := $( KBUILD_CPPFLAGS) $( CPPFLAGS) $( UBOOTINCLUDE) $( NOSTDINC_FLAGS)
c_flags := $( KBUILD_CFLAGS) $( cpp_flags)
# The "tools" are needed early, so put this first
# Don't include stuff already done in $(LIBS)
# The "examples" conditionally depend on U-Boot (say, when USE_PRIVATE_LIBGCC
# is "yes"), so compile examples after U-Boot is compiled.
SUBDIR_TOOLS = tools
SUBDIRS = $( SUBDIR_TOOLS)
.PHONY : $( SUBDIRS ) $( VERSION_FILE ) $( TIMESTAMP_FILE )
SUBDIR_EXAMPLES-y := examples/standalone
SUBDIR_EXAMPLES-$(CONFIG_API) += examples/api
i f n d e f C O N F I G _ S A N D B O X
SUBDIRS += $( SUBDIR_EXAMPLES-y)
e n d i f
#########################################################################
# U-Boot objects....order is important (i.e. start must be first)
@ -675,6 +725,11 @@ endif
e n d i f
e n d i f
LDFLAGS_u-boot += -T u-boot.lds $( LDFLAGS_FINAL)
i f n e q ( $( CONFIG_SYS_TEXT_BASE ) , )
LDFLAGS_u-boot += -Ttext $( CONFIG_SYS_TEXT_BASE)
e n d i f
all : $( ALL -y ) $( SUBDIR_EXAMPLES -y )
u-boot.dtb : checkdtc u -boot
@ -867,11 +922,34 @@ $(OBJS):
$(LIBS) : depend $( SUBDIR_TOOLS ) scripts_basic
$( Q) $( MAKE) $( build) = $( patsubst %/,%,$( dir $@ ) )
$(SUBDIRS) : depend scripts_basic
$(SUBDIRS) : scripts_basic $( TIMESTAMP_FILE ) $( VERSION_FILE )
$( Q) $( MAKE) $( build) = $@
$(SUBDIR_EXAMPLES-y) : u -boot
#
# Auto-generate the autoconf.mk file (which is included by all makefiles)
#
# This target actually generates 2 files; autoconf.mk and autoconf.mk.dep.
# the dep file is only include in this top level makefile to determine when
# to regenerate the autoconf.mk file.
quiet_cmd_autoconf_dep = GEN $@
cmd_autoconf_dep = $( CC) -x c -DDO_DEPS_ONLY -M $( c_flags) \
-MQ include/autoconf.mk $( srctree) /include/common.h > $@ || rm $@
include/autoconf.mk.dep : include /config .h include /common .h
$( call cmd,autoconf_dep)
quiet_cmd_autoconf = GEN $@
cmd_autoconf = \
$( CPP) $( c_flags) -DDO_DEPS_ONLY -dM $( srctree) /include/common.h > $@ .tmp && \
sed -n -f $( srctree) /tools/scripts/define2mk.sed $@ .tmp > $@ ; \
rm $@ .tmp
include/autoconf.mk : include /config .h
$( call cmd,autoconf)
u-boot.lds : $( LDSCRIPT ) depend
$( CPP) $( cpp_flags) $( LDPPFLAGS) -ansi -D__ASSEMBLY__ -P - <$< >$@
@ -948,29 +1026,6 @@ checkdtc:
false; \
fi
#
# Auto-generate the autoconf.mk file (which is included by all makefiles)
#
# This target actually generates 2 files; autoconf.mk and autoconf.mk.dep.
# the dep file is only include in this top level makefile to determine when
# to regenerate the autoconf.mk file.
quiet_cmd_autoconf_dep = GEN $@
cmd_autoconf_dep = $( CC) -x c -DDO_DEPS_ONLY -M $( c_flags) \
-MQ include/autoconf.mk $( srctree) /include/common.h > $@ || rm $@
include/autoconf.mk.dep : include /config .h include /common .h
$( call cmd,autoconf_dep)
quiet_cmd_autoconf = GEN $@
cmd_autoconf = \
$( CPP) $( c_flags) -DDO_DEPS_ONLY -dM $( srctree) /include/common.h > $@ .tmp && \
sed -n -f $( srctree) /tools/scripts/define2mk.sed $@ .tmp > $@ ; \
rm $@ .tmp
include/autoconf.mk : include /config .h
$( call cmd,autoconf)
quiet_cmd_offsets = GEN $@
cmd_offsets = $( srctree) /tools/scripts/make-asm-offsets $< $@
@ -1003,17 +1058,6 @@ $(CPUDIR)/$(SOC)/asm-offsets.s: include/config.h
$( call cmd,soc_asm-offsets.s)
#########################################################################
e l s e # !config.mk
a l l u - b o o t . h e x u - b o o t . s r e c u - b o o t . b i n \
u - b o o t . i m g u - b o o t . d i s u - b o o t \
$( filter -out tools ,$ ( SUBDIRS ) ) \
depend dep tags ctags etags cscope System.map :
@echo "System not configured - see README" >& 2
@ exit 1
tools : $( VERSION_FILE ) $( TIMESTAMP_FILE )
$( MAKE) $( build) = $@ all
e n d i f # config.mk
# ARM relocations should all be R_ARM_RELATIVE (32-bit) or
# R_AARCH64_RELATIVE (64-bit).
@ -1066,15 +1110,6 @@ include/license.h: tools/bin2header COPYING
cat COPYING | gzip -9 -c | ./tools/bin2header license_gzip > include/license.h
#########################################################################
unconfig :
@rm -f include/config.h include/config.mk \
board/*/config.tmp board/*/*/config.tmp \
include/autoconf.mk include/autoconf.mk.dep \
include/spl-autoconf.mk \
include/tpl-autoconf.mk
%_config :: unconfig
@$( MKCONFIG) -A $( @:_config= )
#########################################################################
@ -1151,8 +1186,14 @@ clobber: clean
@rm -f dts/*.tmp
@rm -f $( addprefix spl/, u-boot-spl.ais, u-boot-spl-pad.ais)
m r p r o p e r \
distclean : clobber unconfig
mrproper : clobber
@rm -f include/config.h include/config.mk \
board/*/config.tmp board/*/*/config.tmp \
include/autoconf.mk include/autoconf.mk.dep \
include/spl-autoconf.mk \
include/tpl-autoconf.mk
distclean : mrproper
i f n e q ( $( OBJTREE ) , $( SRCTREE ) )
rm -rf *
e n d i f
@ -1163,6 +1204,9 @@ backup:
#########################################################################
e n d i f #ifeq ($(config-targets),1)
e n d i f #ifeq ($(mixed-targets),1)
e n d i f # skip-makefile
PHONY += FORCE