📄 inc.makefile
字号:
################################################################# Copyright (c) 2001 Sigma Designs Inc. All rights reserved. ## Author : Julien Soulier ## Date : 06-19-2001 ## ## This is the base makefile for all realmagic projects ## ################################################################################################### Project specific variables ## ################################ifdef RUA_DIRifeq '$(filter -I$(RUA_DIR),$(RMCFLAGS))' ''RMCFLAGS += -I$(RUA_DIR)endifendififndef MAKEFILE_NAMEMAKEFILE_NAME = Makefileendif ifndef LOCAL_MAKEFILELOCAL_MAKEFILE = $(MAKEFILE_NAME)endififndef CCOMPILERCCOMPILER := gccendififndef CXXCOMPILERCXXCOMPILER := g++endififndef LDTOOLLDTOOL := ldendifCC := $(CCACHE) $(CROSS)$(CCOMPILER)CXX := $(CCACHE) $(CROSS)$(CXXCOMPILER)LD := $(CROSS)$(LDTOOL)OBJCOPY := $(CROSS)objcopyAR := $(CROSS)arifndef LINKER# must be = and not :=LINKTOOL = $(CROSS)$(CXXCOMPILER)# LINKTOOL used to be defined a $(CC). However, that makes LINKTOOL ccacheable, # which is nonsensical, because ccache only caches compilation, not linking.elseLINKTOOL := $(CROSS)$(LINKER)endifLOCALDIR = $(shell pwd)ifeq "$(TARGET_TYPE)" "MICROCODE"ifndef SPASMifndef SPASM_VERSIONSPASM_VERSION := 3.0.4endifSPASM := /utils/em8xxx/spasm/$(SPASM_VERSION)/bin/spasmendif # SPASMifndef SPBINifndef SPBIN_VERSIONSPBIN_VERSION := 1.2.16cendifSPBIN := /utils/em8xxx/spbin/$(SPBIN_VERSION)/bin/spbinendif # SPBINifndef SPADEifndef SPADE_VERSIONSPADE_VERSION := 1.4endifSPADE := /utils/em8xxx/spade/$(SPADE_VERSION)/spadeendif # SPADEendif # "$(TARGET_TYPE)" "MICROCODE"MAKEARGS = -f $(MAKEFILE_NAME) ## the -f option is not passed through MAKEFLAGS# Bug 7386: newer kernels disable all implicit rules and variables in the main linux MakefileMAKEFLAGS := $(filter-out -rR,$(MAKEFLAGS))PREPROCESSORFLAGS += $(RMCFLAGS) -I. -D_REENTRANTifdef base_dirifeq '$(filter -I$(base_dir), $(PREPROCESSORFLAGS))' ''PREPROCESSORFLAGS += -I$(base_dir)endifendif########################### Compilation options ###########################SPASMFLAGS += -q -D__ASSEMBLY__=1SPBINFLAGS += -l -p -m -sa -od 0x10000SPADEFLAGS += -stripifneq '$(filter -DWITH_UCODE_BOOTLOADER=1, $(RMCFLAGS))' ''SPBINFLAGS += -cendif# It has to be a = not a :=ASFLAGS = $(KERNELSTYLE) $(PREPROCESSORFLAGS) -D__ASSEMBLY__=1ifneq '$(filter withthreads, $(COMPILKIND))' ''PREPROCESSORFLAGS += -DWITH_THREADS=1LDFLAGS += -lpthread endififneq '$(filter withdl, $(COMPILKIND))' ''EXEFLAGS += -ldl -rdynamicendififneq '$(filter kernel, $(COMPILKIND))' '' ## kernel compilationPREPROCESSORFLAGS += -D__KERNEL__ -DMODULE -DEXPORT_SYMTABifneq '$(filter uclinux, $(COMPILKIND))' '' ## uCLinux compilationifeq '$(filter -DEM86XX_MODE=EM86XX_MODEID_STANDALONE, $(RMCFLAGS))' ''# this gets triggered during release. To be explored and corrected.#$(error Error: invalid combination: COMPILKIND = uclinux without EM86XX_MODEID_STANDALONE)endififndef MUM_KI ifndef UCLINUX_KERNEL ifneq '$(filter -DEM86XX_CHIP=EM86XX_CHIPID_TANGO2, $(RMCFLAGS))' '' UCLINUX_KERNEL := /utils/thirdparty/kernelsrc/linux-mips else # ! EM86XX_CHIPID_TANGO2 ifneq '$(filter -DEM86XX_CHIP=EM86XX_CHIPID_TANGO15, $(RMCFLAGS))' ''UCLINUX_KERNEL := /utils/thirdparty/kernelsrc/linux-arm-tango15 else ifneq '$(filter -DEM86XX_CHIP=EM86XX_CHIPID_TANGOLIGHT, $(RMCFLAGS))' ''UCLINUX_KERNEL := /utils/thirdparty/kernelsrc/linux-arm-tangolight else UCLINUX_KERNEL := /utils/thirdparty/kernelsrc/linux-arm endif # EM86XX_CHIPID_TANGOLIGHT endif # EM86XX_CHIPID_TANGO15 endif # EM86XX_CHIPID_TANGO2$(warning Notice: neither MUM_KI nor UCLINUX_KERNEL are defined. Defaulting UCLINUX_KERNEL to $(UCLINUX_KERNEL).) endif # UCLINUX_KERNELMUM_KI := -I$(UCLINUX_KERNEL)/includeendif # MUM_KIifndef KERNELSTYLEifneq "$(filter -DEM86XX_CHIP=EM86XX_CHIPID_TANGO2,$(RMCFLAGS))" ""KERNELSTYLE= \ -fomit-frame-pointer \ -fno-strict-aliasing \ -fno-common \ -G 0 \ -mno-abicalls \ -fno-pic \ -finline-limit=100000 \ -mabi=32 \ -mips32r2 -Wa,-mips32r2 -Wa,--trap \ -fno-builtin \ -mlong-calls \ -pipe elseKERNELSTYLE= \ -fomit-frame-pointer \ -fno-strict-aliasing \ -fno-common \ -pipe \ -fno-builtinendif # tango2 alternativePREPROCESSORFLAGS += -D__linux__endifelse # no uclinuxifeq '$(filter -DEM86XX_MODE=EM86XX_MODEID_WITHHOST, $(RMCFLAGS))' ''# this gets triggered during release. To be explored and corrected.#$(error Error: invalid combination: COMPILKIND != uclinux without EM86XX_MODEID_WITHHOST)endififndef MUM_KI ifndef LINUX_KERNELMUM_KI := -I/usr/src/linux-$(shell uname -r)/include -I/usr/src/linux-2.4/include$(warning Notice: neither MUM_KI nor LINUX_KERNEL are defined. Defaulting MUM_KI to $(MUM_KI).) else # LINUX_KERNELMUM_KI := -I$(LINUX_KERNEL)/include endif # LINUX_KERNELendif # MUM_KIifndef KERNELSTYLEKERNELSTYLE= \ -fomit-frame-pointer \ -fno-strict-aliasing \ -fno-common \ -mpreferred-stack-boundary=2 \ -pipe endifendif # linux/uclinux alternative done## Switch for fascist warnings.ifndef DISABLE_WARNINGSCWARNINGS+= \ -Wno-import \ -Wunused \ -Wimplicit \ -Wmain \ -Wreturn-type \ -Wswitch \ -Wtrigraphs \ -Wchar-subscripts \ -Wparentheses \ -Wcast-align \ -Wuninitialized -O \ -WerrorelseCWARNINGS+= -O2endifCFLAGS += $(KERNELSTYLE) $(MUM_KI)else # user compilation## Switch for fascist warnings.ifndef DISABLE_WARNINGSCOMMONWARNINGS+= \ -Wundef \ -Wall \ -Wchar-subscripts \ -Wsign-compare \ -Wuninitialized -O \ -Wno-missing-braces \ -Werror CWARNINGS:=$(COMMONWARNINGS) -Wnested-externs -Wmissing-declarations -Wmissing-prototypesCXXWARNINGS:=$(COMMONWARNINGS) -fcheck-new else# For code that is compiled with DISABLE_WARNINGS=1 (Usually 3rd party) and with the# GCC4 MIPS toolchain we want to deactivate warnings related to the signedness of pointers.ifneq '$(filter -DGCC4_TOOLCHAIN, $(RMCFLAGS))' ''CWARNINGS+=-Wno-pointer-signendifendif### if libc heades are neededifndef USE_STD_LIB PREPROCESSORFLAGS += -nostdincendif# If standalone, we may need to enable XIP settingsifneq '$(filter -DEM86XX_MODE=EM86XX_MODEID_STANDALONE, $(RMCFLAGS))' ''ifneq '$(filter -DWITH_XIP=1, $(RMCFLAGS))' ''ifeq '$(filter -DINIRQHANDLER=1, $(RMCFLAGS))' ''CFLAGS += -D__PIC__ -fpic -msingle-pic-baseCXXFLAGS += -D__PIC__ -fpic -msingle-pic-baseLDFLAGS += -fpic -msingle-pic-base OBJECTFLAGS += -q endifendifendifendif # kernel/user alternative done## Switch to release/debug compilation ### The macro to do this is called ``_DEBUG'' to fit how Windows does. Sorry.# Additionally, the C specification says that assert is defined to a nop# if and only if NDEBUG is defined. We don't want assertions in release# code.ifneq '$(filter release, $(COMPILKIND))' ''PREPROCESSORFLAGS += -U_DEBUG -DNDEBUGCFLAGS += -O2CXXFLAGS += -O2elsePREPROCESSORFLAGS += -D_DEBUG=1 -UNDEBUGifeq '$(filter kernel, $(COMPILKIND))' '' # -g only in user compilationsifeq "$(CCOMPILER)" "gcc"ifeq "$(CROSS)" ""CFLAGS += -gdwarf-2
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -