关键词:
#
# (C) Copyright 2000-2006
# Wolfgang Denk, DENX Software Engineering, [email protected]
#
# See file CREDITS for list of people who contributed to this
# project.
#
# This program is 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.
#
# This program is distributed in the hope that it will 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 have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 59 Temple Place, Suite 330, 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 =
#
# When cross-compiling on NetBSD, we have to define __PPC__ or else we
# will pick up a va_list declaration that is incompatible with the
# actual argument lists emitted by the compiler.
#
# [Tested on NetBSD/i386 1.5 + cross-powerpc-netbsd-1.3]
ifeq ($(ARCH),ppc)
ifeq ($(CROSS_COMPILE),powerpc-netbsd-)
PLATFORM_CPPFLAGS+= -D__PPC__
endif
ifeq ($(CROSS_COMPILE),powerpc-openbsd-)
PLATFORM_CPPFLAGS+= -D__PPC__
endif
endif
ifeq ($(ARCH),arm)
ifeq ($(CROSS_COMPILE),powerpc-netbsd-)
PLATFORM_CPPFLAGS+= -D__ARM__
endif
ifeq ($(CROSS_COMPILE),powerpc-openbsd-)
PLATFORM_CPPFLAGS+= -D__ARM__
endif
endif
#########################################################################
CONFIG_SHELL := $(shell if [ -x "$$BASH" ]; then echo $$BASH; else if [ -x /bin/bash ]; then echo /bin/bash; else echo sh; fi ; fi)
ifeq ($(HOSTOS)-$(HOSTARCH),darwin-ppc)
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 are 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
ifdef ARCH
sinclude $(TOPDIR)/$(ARCH)_config.mk # include architecture dependend rules
endif
ifdef CPU
sinclude $(TOPDIR)/cpu/$(CPU)/config.mk # include CPU specific rules
endif
ifdef SOC
sinclude $(TOPDIR)/cpu/$(CPU)/$(SOC)/config.mk # include SoC specific rules
endif
ifdef VENDOR
BOARDDIR = $(VENDOR)/$(BOARD)
else
BOARDDIR = $(BOARD)
endif
ifdef BOARD
sinclude $(TOPDIR)/board/$(BOARDDIR)/config.mk # include board specific rules
endif
#########################################################################
ifneq (,$(findstring s,$(MAKEFLAGS)))
ARFLAGS = cr
else
ARFLAGS = crv
endif
RELFLAGS= $(PLATFORM_RELFLAGS)
DBGFLAGS= -g # -DDEBUG
OPTFLAGS= -Os #-fomit-frame-pointer
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 ($(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 have to be placed behind -Wall -- that‘s why it is 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 $(LDSCRIPT) $(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 each other)
#
# So far, this is used only by tools/gdb/Makefile.
ifeq ($(HOSTOS)-$(HOSTARCH),darwin-ppc)
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
ifeq ($(PCI_CLOCK),PCI_66M)
CFLAGS := $(CFLAGS) -DPCI_66M
endif
#########################################################################
export CONFIG_SHELL HPATH HOSTCC HOSTCFLAGS CROSS_COMPILE
AS LD CC CPP AR NM STRIP OBJCOPY OBJDUMP
MAKE
export TEXT_BASE PLATFORM_CPPFLAGS PLATFORM_RELFLAGS CPPFLAGS CFLAGS AFLAGS
#########################################################################
ifndef REMOTE_BUILD
%.s: %.S
$(CPP) $(AFLAGS) -o [email protected] $<
%.o: %.S
$(CC) $(AFLAGS) -c -o [email protected] $<
%.o: %.c
$(CC) $(CFLAGS) -c -o [email protected] $<
else
$(obj)%.s: %.S
$(CPP) $(AFLAGS) -o [email protected] $<
$(obj)%.o: %.S
$(CC) $(AFLAGS) -c -o [email protected] $<
$(obj)%.o: %.c
$(CC) $(CFLAGS) -c -o [email protected] $<
endif
#########################################################################
嵌入式linux核心课程2.uboot和系统移植-第4部分-2.4.uboot配置和编译过程详解
...boot配置和编译过程详解》第一部分、章节目录2.4.1.uboot主Makefile分析12.4.2.uboot主Makefile分析22.4.3.uboot主Makefile分析32.4.4.uboot主Makefile分析42.4.5.uboot主Makefile分析52.4.6.uboot主Makefile分析62.4.7.uboot配置过程详解12.4.8.uboot配置过程详解22.4.9... 查看详情
嵌入式开发(s5pv210)——u-boot的顶层config.mk分析(代码片段)
...路径等,但是config.mk的配置是建立在顶层mkconfig、主Makefile等配置之上的。2、config.mk的调用#loadotherconfigurationinclude$(TOPDI 查看详情
子目录makefile分析(代码片段)
1.前言 鸿蒙暂时支持以下几种文件系统,以fat文件系统为例,看看fat文件系统是如何被编译到鸿蒙系统中,进而支持fat文件系统的。 2.fat目录下的Makfile文件include$(LITEOSTOPDIR)/config.mk#包含顶层目... 查看详情
顶层目录下的config.mk文件分析
顶层目录下的config.mk文件主要完成如下功能的配置:1、确定生成可执行文件过程中需要的各种工具,如编译器(arm-linux-gcc)、连接器(arm-linux-ld)、反汇编器(arm-linux-objdump)等2、确定CPU、板相关的配置文件,存在于各个目录下的config.... 查看详情
u-boot主makefile详尽分析
U-boot主Makefile详尽分析主Makefile位于uboot源码的根目录下,其内容主要结构为:1.确定版本号及主机信息(23至48行)2.实现静默编译功能(48至55行)3.设置各种路径(56至123行)4.设置编译工具链(124至186行,大部分在config.mk内)5.... 查看详情
u-boot全面分析
uboot主Makefile分析1ubootversion确定(Makefile的24-29行)HOSTARCH和HOSTOS(Makefile的31-43行)静默编译(50-54行)2种编译方法(原地编译和单独输出文件夹编译)编译方法实践两种编译的实现(Makefile的78-123行)include$(obj)include/config.mk... 查看详情
uboot移植之九鼎提供的uboot的文件分析
....gitignore:git管理工具相关的文件。(2)arm_config.mk:一个Makefile文件,将来会被Makefile里面的某句代码调用。(3)CHANGELOG、Changelog_Samsung、CHANGELOG-before-U-Boot-1.1.5:三个CHANELOG文件,其实就是该版本的uboot的变迁记录。(4)config.mk... 查看详情
顶层makefile分析(代码片段)
1.顶层目录下的Makefile OpenHarmony/kernel/liteos_a/Makefile-include$(LITEOSTOPDIR)/tools/build/config.mk#包含kernel/liteos_a/tools/build/config.mkLITEOS_TARGET=liteosLITEOS_PLATFORM_BASE=$(LITE 查看详情
[makefile]递归编译的makefile的实现(代码片段)
...p://www.linuxidc.com/Linux/2017-01/139702.htm 最近写了一个递归Makefile,目的是既可以实现子模块的单独编译,也可以不做任何修改就和整个程序的整体进行无缝衔接的编译。具体的思路是借助第三方文件,将子模块编译好的.o文件的... 查看详情
uboot主makefile之9——2589行x210_sd_config目标
101MKCONFIG :=$(SRCTREE)/mkconfig2589x210_sd_config:unconfig2590@$(MKCONFIG)$(@:_config=)arms5pc11xx210samsungs5pc1102591@echo"TEXT_BASE=0xc3e00000">$(obj)board/samsung/x210/config.mk第25 查看详情
uboot主makefile分析(代码片段)
一.Makefile配置 1.1.makexxx_config 1.1.1.笔者实验时是make x210_sd_config a. x210_sd_config是Makefile下的一个目标 1.2.1. x210_sd_config相关代码分析 a.@表示静默执行 b.MKCONFIG是Mak... 查看详情
mosquitto---config.mk
...在解压压缩包后生成的文件夹中我们可以找到mosquitto主要配置文件config.mk这个文件的主要内容: #是否支持tcpd/libwrap功能. #WITH_WRAP:=yes #是否开启SSL/TLS支持 & 查看详情
主目录makefile分析(代码片段)
... 这4个用.分隔开共同构成了最终的版本号。 Makefile中的版本号最终生成了 查看详情
makefile文件
makefile(mk)文件,一旦写好,只需一个make命令,整个工程完全自动编译。注意MK文件每一行结束之后不要有多余的空格字符,比如说换行符后面多了空字符会有“**commandscommencebeforefirsttarget”1、LOCAL_PATH:=$(callmy-dir... 查看详情
linux系统移植:u-boot顶层makefile分析(上)(代码片段)
目录Linux系统移植:U-Boot顶层Makefile分析(上)一、版本号二、传递变量到子make三、命令输出四、静默输出五、编译输出目录六、代码检查七、模块编译八、获取主机架构和系统九、设置目标架构、交叉编译器和配置... 查看详情
如何配置uboot
...际上是指向了一条更长的指令这条指令在uboot根目录下的makefile中自己定义的,跟你的开发板相关;s3c2440_config:unconfig@$(MKCONFIG)$(@:_config=)armarm920ts3c2440NULLs3c24x0这条指令指向的执行文件是MKCONFIG通过阅读MKCONFIG文件源码我们可以看... 查看详情
u-boot顶层目录config.mk分析
1.设置obj与srcifneq($(OBJTREE),$(SRCTREE))ifeq($(CURDIR),$(SRCTREE))dir:=elsedir:=$(subst$(SRCTREE)/,,$(CURDIR))endifobj:=$(if$(dir),$(OBJTREE)/$(dir)/,$(OBJTREE)/)src:=$(if$(dir),$(SRCTREE)/$(dir)/,$(SR 查看详情
androidmakefile中是如何识别target_product的
...eric的那如何编译特定产品的Android呢?这就需要查看AndroidMakefile是如何解析环境变量TARGET_PRODUCT的。AndroidMakefile的引用关系是这样的Makefile->build/core/main.mk->build/core/config.mk->build/core/envsetup.mk->build/core/product_config.mk在build/cor... 查看详情