CONFIG.MK analysis of Uboot top layer

Source: Internet
Author: User

#
# (C) Copyright 2000-2006
# Wolfgang Denk, DENX software Engineering, [email protected]
#
# See file CREDITS for list of people who contributed to this
# project.
#
# is the free software; You can redistribute it and/or
# Modify it under the terms of the GNU general public License as
# published by the free software Foundation; Either version 2 of
# The License, or (at your option) any later version.
#
# distributed in the hope that it'll be useful,
# but without any WARRANTY; Without even the implied warranty of
# merchantability or FITNESS for A particular PURPOSE. See the
# GNU general public License for more details.
#
# You should has received a copy of the GNU general public License
# along with the program; If not, write to the free software
# Foundation, Inc., Temple Place, Suite Boston,
# MA 02111-1307 USA
#

#########################################################################

Ifneq ($ (Objtree), $ (srctree))
Ifeq ($ (CURDIR), $ (srctree))
Dir: =
Else
Dir: = $ (subst $ (srctree)/,,$ (CURDIR))
endif

OBJ: = $ (if $ (dir), $ (objtree)/$ (dir)/,$ (objtree)/)
SRC: = $ (if $ (dir), $ (srctree)/$ (dir)/,$ (srctree)/)

$ (Shell mkdir-p $ (obj))
Else
Obj: =
SRC: =
endif

# Clean the slate ...
Platform_relflags =
Platform_cppflags =
Platform_ldflags =

#########################################################################

Ifeq ($ (Hostos), Darwin)
hostcc= cc
Else
hostcc= GCC
endif
hostcflags=-wall-wstrict-prototypes-o2-fomit-frame-pointer
hoststrip= Strip

#########################################################################
#
# Option Checker (courtesy Linux kernel) to ensure
# only supported compiler options is used
#
Cc-option = $ (Shell if $ (CC) $ (CFLAGS) $ (1)-s-o/dev/null-xc/dev/null \
>/dev/null 2>&1; Then echo "$ (1)"; else echo "$ (2)"; Fi;)

#
# Include The Make variables (CC, etc ...)

#相关的编译文件
#
As= $ (cross_compile) as
Ld= $ (cross_compile) LD
Cc= $ (cross_compile) gcc
Cpp= $ (CC)-E
Ar= $ (cross_compile) AR
Nm= $ (cross_compile) NM
Ldr= $ (cross_compile) LDR
Strip= $ (cross_compile) STRIP
Objcopy = $ (cross_compile) objcopy
OBJDUMP = $ (cross_compile) OBJDUMP
Ranlib= $ (cross_compile) Ranlib

#########################################################################

# Load Generated Board configuration
Sinclude $ (objtree)/include/autoconf.mk

Ifdefarch
Sinclude $ (Topdir)/lib_$ (ARCH)/config.mk# include architecture dependend rules
endif
Ifdefcpu
Sinclude $ (Topdir)/cpu/$ (CPU)/config.mk# include cpuspecific rules
endif
Ifdefsoc
Sinclude $ (Topdir)/cpu/$ (CPU)/$ (SOC)/config.mk# include socspecific rules
endif
Ifdefvendor
Boarddir = $ (VENDOR)/$ (BOARD)
Else
Boarddir = $ (BOARD)
endif
Ifdefboard
Sinclude $ (Topdir)/board/$ (boarddir)/config.mk# include board specific rules
endif

#########################################################################

IFNEQ (, $ (findstring s,$ (makeflags)))//In $ (makeflags) Find out if there is an S character
Arflags = CR//Don't quite understand the meaning of these two items
Else
Arflags = CRV
endif
Relflags= $ (platform_relflags)
Dbgflags=-G #-ddebug Debug Options
optflags=-os #-fomit-frame-pointer Optimization options
Ifndef Ldscript
#LDSCRIPT: = $ (Topdir)/board/$ (boarddir)/u-boot.lds.debug
Ifeq ($ (config_nand_u_boot), y)
Ldscript: = $ (Topdir)/board/$ (boarddir)/u-boot-nand.lds
Else
Ldscript: = $ (Topdir)/board/$ (boarddir)/u-boot.lds
endif
endif
Objcflags + =--gap-fill=0xff

Gccincdir: = $ (Shell $ (CC)-print-file-name=include)

Cppflags: = $ (dbgflags) $ (optflags) $ (relflags) \
-d__kernel__

Ifneq ($ (boot_media),)
Boot_media_macro = boot_media_$ (Shell echo $ (Boot_media) | tr ' [A-z] ' [A-z] ')
Cppflags + =-d$ (Boot_media_macro)
endif

Ifneq ($ (text_base),)
Cppflags + =-dtext_base=$ (text_base)
endif

Ifneq ($ (Objtree), $ (srctree))
Cppflags + =-i$ (objtree)/include2-i$ (objtree)/include
endif

Cppflags + =-i$ (topdir)/include
Cppflags + =-fno-builtin-ffreestanding-nostdinc\
-isystem $ (Gccincdir)-pipe $ (platform_cppflags)

Ifdef Build_tag
CFLAGS: = $ (cppflags)-wall-wstrict-prototypes \
-dbuild_tag= ' "$ (build_tag)" '
Else
CFLAGS: = $ (cppflags)-wall-wstrict-prototypes
endif

CFLAGS + = $ (call cc-option,-fno-stack-protector)

# Avoid trigraph warnings while parsing pci.h (produced by NIOS gcc-2.9)
# This option has to been placed Behind-wall--that's why it's here
Ifeq ($ (ARCH), Nios)
Ifeq ($ (findstring 2.9,$ (Shell $ (CC)--version)), 2.9)
CFLAGS: = $ (cppflags)-wall-wno-trigraphs
endif
endif

# $ (cppflags) sets-g, which causes GCC to pass a suitable-g<format>
# option to the assembler.
Aflags_debug: =

# turn JBSR into JSR for m68k
Ifeq ($ (ARCH), m68k)
Ifeq ($ (findstring 3.4,$ (Shell $ (CC)--version)), 3.4)
Aflags_debug: =-wa,-gstabs,-s
endif
endif

Aflags: = $ (Aflags_debug)-d__assembly__ $ (cppflags)

Ldflags + =-bstatic-t $ (obj) U-boot.lds $ (platform_ldflags)
Ifneq ($ (text_base),)
Ldflags + =-ttext $ (text_base)
endif

# location of a usable BFD library, where we define "usable" as
# "Built for ${host}, supports ${target}". Sensible values are
#-When cross-compiling:the root of the cross-environment
#-LINUX/PPC (native):/usr
#-NETBSD/PPC (native): You lose ... (must extract these from the
# binutils build directory, plus the native and u-boot include
# files don ' t like all other)
#
# So far, this is used only by Tools/gdb/makefile.

Ifeq ($ (Hostos), Darwin)
Bfd_root_dir =/usr/local/tools
Else
Ifeq ($ (Hostarch), $ (ARCH))
# native
Bfd_root_dir =/USR
Else
#BFD_ROOT_DIR =/linuxppc/cdk# linux/i386
#BFD_ROOT_DIR =/usr/pkg/cross# netbsd/i386
Bfd_root_dir =/OPT/POWERPC
endif
endif

#########################################################################

EXPORTHOSTCC hostcflags cross_compile \
As LD CC CPP AR NM STRIP objcopy OBJDUMP make
Exporttext_base platform_cppflags platform_relflags cppflags CFLAGS aflags

#########################################################################

# Allow boards to use custom optimize flags on a per dir/file basis
Bcurdir: = $ (Notdir $ (CURDIR))
$ (obj)%.s:%. S
$ (CPP) $ (aflags) $ (aflags_$ (@F)) $ (aflags_$ (bcurdir))-o [email protected] $<
$ (obj)%.o:%. S
$ (CC) $ (aflags) $ (aflags_$ (@F)) $ (aflags_$ (bcurdir))-o [email protected] $<-C
$ (obj)%.o:%.c
$ (CC) $ (CFLAGS) $ (cflags_$ (@F)) $ (cflags_$ (bcurdir))-o [email protected] $<-C
$ (obj)%.i:%.c
$ (CPP) $ (CFLAGS) $ (cflags_$ (@F)) $ (cflags_$ (bcurdir))-o [email protected] $<-C
$ (obj)%.s:%.c
$ (CC) $ (CFLAGS) $ (cflags_$ (@F)) $ (cflags_$ (bcurdir))-o [email protected] $<-c-s

#########################################################################

CONFIG.MK analysis of Uboot top layer

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.