blob: 4ea5a14a094582c90e114608fb60cadd99d77bb0 [file] [log] [blame]
yu.dongc33b3072024-08-21 23:14:49 -07001#
2# Copyright Statement:
3# --------------------
4# This software is protected by Copyright and the information contained
5# herein is confidential. The software may not be copied and the information
6# contained herein may not be used or disclosed except with the written
7# permission of MediaTek Inc. (C) 2005
8#
9# BY OPENING THIS FILE, BUYER HEREBY UNEQUIVOCALLY ACKNOWLEDGES AND AGREES
10# THAT THE SOFTWARE/FIRMWARE AND ITS DOCUMENTATIONS ("MEDIATEK SOFTWARE")
11# RECEIVED FROM MEDIATEK AND/OR ITS REPRESENTATIVES ARE PROVIDED TO BUYER ON
12# AN "AS-IS" BASIS ONLY. MEDIATEK EXPRESSLY DISCLAIMS ANY AND ALL WARRANTIES,
13# EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE IMPLIED WARRANTIES OF
14# MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE OR NONINFRINGEMENT.
15# NEITHER DOES MEDIATEK PROVIDE ANY WARRANTY WHATSOEVER WITH RESPECT TO THE
16# SOFTWARE OF ANY THIRD PARTY WHICH MAY BE USED BY, INCORPORATED IN, OR
17# SUPPLIED WITH THE MEDIATEK SOFTWARE, AND BUYER AGREES TO LOOK ONLY TO SUCH
18# THIRD PARTY FOR ANY WARRANTY CLAIM RELATING THERETO. MEDIATEK SHALL ALSO
19# NOT BE RESPONSIBLE FOR ANY MEDIATEK SOFTWARE RELEASES MADE TO BUYER'S
20# SPECIFICATION OR TO CONFORM TO A PARTICULAR STANDARD OR OPEN FORUM.
21#
22# BUYER'S SOLE AND EXCLUSIVE REMEDY AND MEDIATEK'S ENTIRE AND CUMULATIVE
23# LIABILITY WITH RESPECT TO THE MEDIATEK SOFTWARE RELEASED HEREUNDER WILL BE,
24# AT MEDIATEK'S OPTION, TO REVISE OR REPLACE THE MEDIATEK SOFTWARE AT ISSUE,
25# OR REFUND ANY SOFTWARE LICENSE FEES OR SERVICE CHARGE PAID BY BUYER TO
26# MEDIATEK FOR SUCH MEDIATEK SOFTWARE AT ISSUE.
27#
28# THE TRANSACTION CONTEMPLATED HEREUNDER SHALL BE CONSTRUED IN ACCORDANCE
29# WITH THE LAWS OF THE STATE OF CALIFORNIA, USA, EXCLUDING ITS CONFLICT OF
30# LAWS PRINCIPLES. ANY DISPUTES, CONTROVERSIES OR CLAIMS ARISING THEREOF AND
31# RELATED THERETO SHALL BE SETTLED BY ARBITRATION IN SAN FRANCISCO, CA, UNDER
32# THE RULES OF THE INTERNATIONAL CHAMBER OF COMMERCE (ICC).
33SHELL:=/bin/bash
34# *************************************************************************
35# Build path, directories
36# *************************************************************************
37ifndef MODIS_CONFIG
38 MODIS_CONFIG := FALSE
39endif
40
41FIXPATH := .
42BUILDDIR := $(strip $(FIXPATH))/build
43RELDIR := $(strip $(FIXPATH))/mtk_rel
44UNIVERSAL_COMMON := ../common
45MAKE_COMMON := make/common
46CCACHE := ./mtk_tools/ccache/3.7.5/linux/ccache
47
48PROJDIR := $(strip $(BUILDDIR))/$(strip $(PROJECT_NAME))/$(strip $(FLAVOR))
49CUS_MTK_REL := $(strip $(RELDIR))/$(strip $(ORIGINAL_PROJECT_NAME))/$(strip $(ORIGINAL_FLAVOR))/TARGET
50ifeq ($(strip $(MODIS_CONFIG)),TRUE)
51 ifeq ($(strip $(call uc,$(UE_SIMULATOR))),TRUE)
52 MODIS_UESIM := UESim
53 CUS_MTK_REL := $(strip $(RELDIR))/$(strip $(ORIGINAL_PROJECT_NAME))/$(strip $(ORIGINAL_FLAVOR))/UESIM
54 else
55 MODIS_UESIM := MoDIS
56 CUS_MTK_REL := $(strip $(RELDIR))/$(strip $(ORIGINAL_PROJECT_NAME))/$(strip $(ORIGINAL_FLAVOR))/MODIS
57 endif
58 TARGET_MODIS_UESIM := $(MODIS_UESIM)
59else
60 TARGET_MODIS_UESIM := target
61endif
62DSP_MTK_REL := $(strip $(RELDIR))/$(strip $(ORIGINAL_PROJECT_NAME))/$(strip $(ORIGINAL_FLAVOR))
63PROJ_INTERNAL_DIR := $(subst build/,build_internal/,$(PROJDIR))
64
65include $(strip $(PROJDIR))/Custom.bld
66
67TARGDIR := $(strip $(PROJDIR))/bin
68TMPDIR := $(strip $(PROJDIR))/tmp
69CUSTPACKDIR := $(strip $(PROJDIR))/custpack
70BUILD_RELDIR := $(strip $(PROJDIR))/rel
71
72OBJSDIR := $(strip $(TARGDIR))/obj
73RULESDIR := $(strip $(TARGDIR))/dep
74COMPLIBDIR := $(strip $(TARGDIR))/lib
75COMPLOGDIR := $(strip $(TARGDIR))/log
76MODULEINFODIR := $(strip $(TARGDIR))/module
77
78GEN_MCDDIR := $(strip $(PROJDIR))/modem/mcd
79GEN_SCSIDIR := $(strip $(PROJDIR))/modem/scsi
80GEN_L4DIR := $(strip $(BUILD_RELDIR))/L4
81GEN_MMIDIR := $(strip $(BUILD_RELDIR))/BASIC
82
83CUS_MTK_LIB := $(strip $(CUS_MTK_REL))/lib
84REL_L4DIR := $(strip $(CUS_MTK_REL))/L4
85REL_MMIDIR := $(strip $(CUS_MTK_REL))/BASIC
86REL_MCDDIR := $(strip $(CUS_MTK_REL))/modem/mcd
87REL_SCSIDIR := $(strip $(CUS_MTK_REL))/modem/scsi
88
89BUILD_L4DIR := $(strip $(GEN_L4DIR))
90
91PRE_CODEGEN_DIR := $(strip $(TMPDIR))/pre_codegen
92
93ALL_MOD_DIR := $(strip $(TARGDIR))
94ifeq ($(strip $(CUSTOM_RELEASE)),TRUE)
95 ALL_MOD_DIR := $(strip $(CUS_MTK_REL))/BASIC
96 BUILD_L4DIR := $(strip $(REL_L4DIR))
97endif
98
99GEN_ASDIR := $(strip $(PROJDIR))
100ifeq ($(strip $(CUSTOM_RELEASE)),TRUE)
101 GEN_ASDIR := $(strip $(CUS_MTK_REL))
102endif
103
104GEN_SSDIR := $(strip $(PROJDIR))/rel/L4/csm/ss
105REL_SSDIR := $(strip $(CUS_MTK_REL))/L4/csm/ss
106BUILD_SSDIR := $(strip $(GEN_SSDIR))
107
108ifeq ($(strip $(CUSTOM_RELEASE)),TRUE)
109BUILD_SSDIR := $(strip $(REL_SSDIR))
110endif
111
112TARGNAME := $(strip $(PROJECT_NAME))_$(strip $(SUB_BOARD_VER))_$(strip $(PLATFORM))_$(strip $(CHIP_VER))
113
114TSTDIR := service/dhl
115TSTDIR_SEC := protocol/lte_sec/dhl
116LOGGING_DATABASE := interface/service/logging_database
117BUILD_TSTDIR := $(strip $(PROJDIR))/dhl
118BUILD_TSTDIR_SEC := $(strip $(PROJDIR))/dhl/lte_sec
119BUILD_TSTDIR_4G := $(strip $(PROJDIR))/dhl/4g
120
121TST_DB := $(strip $(TSTDIR))/database
122TST_DB_SEC := $(strip $(TSTDIR_SEC))/database
123CODE_GEN_LOG := $(strip $(COMPLOGDIR))/codegen.log
124BUILD_TST_DB := $(BUILD_TSTDIR)/database
125BUILD_TST_DB_SEC := $(BUILD_TSTDIR_SEC)/database
126BUILD_TST_DB_4G := $(BUILD_TSTDIR_4G)/database
127
128MDDBINFOCUSTOMPREFIX := MDDB_$(strip $(PLATFORM))_$(strip $(CHIP_VER))
129MODIS_TST_DB := $(strip $(TST_DB))
130MODIS_TST_DB_SEC := $(strip $(TST_DB_SEC))
131MODISBUILD_TST_DB := $(strip $(BUILD_TST_DB))
132MODISBUILD_TST_DB_SEC := $(strip $(BUILD_TST_DB_SEC))
133MODISBUILD_TST_DB_4G := $(strip $(BUILD_TST_DB_4G))
134
135CUSTOMIZATION := $(LOGGING_DATABASE)/XDD/Customization
136DBFINI_DIR := $(LOGGING_DATABASE)/XDD/DSP
137ICDINI_DIR := $(LOGGING_DATABASE)/XDD/ICD
138DBF_INPUT_PATH := $(strip $(MODISBUILD_TST_DB))/dbf
139
140MODIS_RULESDIR := $(strip $(RULESDIR))
141ADT_RULESDIR := $(strip $(PROJ_INTERNAL_DIR))/l1ADT
142CGEN_L1_OUTDIR := $(strip $(PROJ_INTERNAL_DIR))/l1trace
143CODEGEN_DEP := $(MODIS_RULESDIR)/codegen_dep
144PREGEN_DEP := $(MODIS_RULESDIR)/pregen_dep
145POSTGEN_DEP := $(MODIS_RULESDIR)/postgen_dep
146DBG_INFO_VERNO := $(call uc,$(subst .,_,$(VERNO)))
147
148ifeq ($(strip $(COMPILER)),GCC)
149 CGEN_DEF_FILE = Tgt_Cnf_GCC
150else
151 CGEN_DEF_FILE = Tgt_Cnf
152endif
153
154BUILD_SYSDIR := $(strip $(PROJDIR))/custom/system
155BUILD_CODEGENDIR := $(strip $(PROJDIR))/custom/driver/drv_gen
156
157NOT_REMOVAL_DIR_FILE := $(strip $(MAKE_COMMON))/NotRemovalCodeDir.def
158
159# Settings for emigen
160FLASH_OPTIONS_HDR := custom/driver/common/flash_opt.h
161CUSTOM_FLASH_C := custom/driver/common/custom_flash.c
162CUSTOM_EMI_H := $(strip $(BUILD_SYSDIR))/custom_EMI.h
163CUSTOM_EMI_RELEASE_H := $(strip $(BUILD_SYSDIR))/custom_EMI_release.h
164CUSTOM_EMI_C := $(strip $(BUILD_SYSDIR))/custom_EMI.c
165CUSTOM_FLASH_NORFDM5_C := $(strip $(BUILD_SYSDIR))/custom_flash_norfdm5.c
166MEMORY_DEVICE_HDR := $(strip $(BUILD_SYSDIR))/custom_MemoryDevice.h
167
168EMI_GENERATOR := ./tools/emigenMD.pl
169FLASHFILE := $(strip $(TMPDIR))/~flash_cfg_tmp.c
170
171# Setting for MK IMAGE
172MCU_DRDI_MK_IMAGE_CFG := ./tools/MKImage/img_hdr_md1drdi.cfg
173MCU_MK_IMAGE_CFG := ./tools/MKImage/img_hdr_md1rom.cfg
174MCU_MK_IMAGE_TOOL := ./tools/MKImage/mkimage
175
176EAS_FOLDER := protocol/eas
177NRAS_FOLDER := protocol/nras
178UAS_FDD_FOLDER := protocol/3g/urr/urr_fdd
179UAS_TDD_FOLDER := protocol/3g/urr/urr_tdd
180LAS_FOLDER := protocol/2g/las
181GAS_FDD_FOLDER := protocol/2g/gas
182GAS_TDD_FOLDER := protocol/2g/gas_tdd
183FLC_FOLDER := protocol/l2_utility/flc2_v2
184PPP_FOLDER := middleware/ppp_v2
185SCSI_FOLDER := protocol/as_utility/scsi
186SLEEPDRV_FOLDER := driver/sleep_drv
187DVFSDRV_FOLDER := driver/dvfs_drv
188
189ifeq ($(strip $(call uc,$(UE_SIMULATOR))),TRUE)
190ifeq ($(strip $(U4G_ADAPTOR_SUPPORT)),TRUE)
191EL1_FOLDER := protocol/lte_sec/smt/u4gHlAdaptor/el1b
192else
193EL1_FOLDER := l1/el1/el1c
194endif
195else
196EL1_FOLDER := l1/el1/el1c
197endif
198
199# Do not support new mmi feature file architecture
200PURE_VERNO := $(subst .,_, $(call uc,$(VERNO)))
201
202MDDBMETA := MDDB.META_$(strip $(PLATFORM))_$(strip $(CHIP_VER))_$(strip $(PURE_VERNO)).EDB
203MDDBMETA_V12 := Internal_meta_db_v12_for_Debug.EDB
204MDDBMETADATABASEXML := MDDB.META.ODB_$(strip $(PLATFORM))_$(strip $(CHIP_VER))_$(strip $(PURE_VERNO)).XML
205MDDBINFOCUSTOMSRCP := MDDB_InfoCustomAppSrcP_$(strip $(PLATFORM))_$(strip $(CHIP_VER))_$(strip $(PURE_VERNO)).EDB
206NEWTARGNAME := $(strip $(PROJECT_NAME))_MDBIN_$(strip $(SUB_BOARD_VER))_$(strip $(PLATFORM))_$(strip $(CHIP_VER)).$(strip $(PURE_VERNO))
207CHECKBINFILE := $(strip $(PROJECT_NAME))_MDBIN_$(strip $(SUB_BOARD_VER))_$(strip $(PLATFORM))_$(strip $(CHIP_VER))
208
209VERNODIR := $(strip $(PROJDIR))/verno
210LOG := $(strip $(TARGDIR))/link.log
211COMPLOGDIR := $(strip $(TARGDIR))/log
212INFOLOG := $(strip $(COMPLOGDIR))/info.log
213INFOMAKELOG := $(strip $(COMPLOGDIR))/infomake.log
214MCDDLL_INFOLOG := $(strip $(COMPLOGDIR))/mcddll_info.log
215MCDDLL_UPDATE_LOG := $(strip $(COMPLOGDIR))/mcddll_update.log
216LTE_SRC_FDR := lte_src
217
218ifneq ($(wildcard $(LTE_SRC_FDR)),)
219LTE_SRC_PATH := $(strip $(LTE_SRC_FDR))
220else
221LTE_SRC_PATH := .
222endif
223
224ifeq ($(strip $(DEMO_PROJECT)),TRUE)
225VERNOFILE := $(strip $(MAKE_COMMON))/Verno.bld
226else
227VERNOFILE :=
228endif
229
230SLIM_BRANCH := $(call uc,$(strip $(BRANCH)))
231BRANCH += $(call uc,$(strip $(PROJECT_NAME)))
232# *************************************************************************
233# Set defaul value to eliminate "option not define" warning
234# *************************************************************************
235BM_NEW = FALSE
236
237INSIDE_MTK = 0
238ifeq ($(strip $(call uc,$(MTK_INTERNAL))),TRUE)
239 INSIDE_MTK = 1
240endif
241
242DEFAULT_CUSTOMER = MTK MTK_RF PLUTO
243ifneq ($(filter $(call uc,$(strip $(PROJECT_NAME))),$(strip $(DEFAULT_CUSTOMER))),)
244 SCATTERNAME = scat$(strip $(PLATFORM)).txt
245else
246 SCATTERNAME = scat$(strip $(PROJECT_NAME)).txt
247endif
248
249SCATTERFILE := $(subst scat,lds,$(strip $(BUILD_SYSDIR))/$(strip $(SCATTERNAME)))
250SCATTERFILE_PATH := $(subst scat,lds,$(strip $(FIXPATH))/custom/system/Specific_LDS)
251COPRO_SCATTERFILE := $(subst scat,lds,$(strip $(COPRO_SYSDIR))/$(strip $(SCATTERNAME)))
252BL_SCATTERFILE := $(subst scat,lds,$(strip $(BUILD_SYSDIR))/scatBL_$(strip $(PLATFORM)).txt)
253
254SCATTERFILE_FLASHTOOL := $(subst .txt,_flashtool.txt,$(strip $(SCATTERFILE)))
255SCATTERFILE_FLASHTOOL_NAME := $(filter %.txt,$(subst /, ,$(SCATTERFILE_FLASHTOOL)))
256
257# *************************************************************************
258# Implicit Rules and Compiler Options
259# *************************************************************************
260BIN_FILE = $(strip $(NEWTARGNAME)).bin
261IMG_FILE = $(strip $(TARGNAME)).elf
262GDB_TMP_FILE = $(strip $(TARGNAME)).elf.gdb-index
263GDB_FILE = $(strip $(TARGNAME)).elf.gdb-index.elf
264SYM_FILE = $(strip $(TARGNAME)).sym
265MAP_FILE = $(strip $(TARGNAME)).map
266ifeq ($(strip $(COMPILER)),GCC)
267LIS_FILE = $(strip $(TARGNAME)).map
268else
269LIS_FILE = $(strip $(TARGNAME)).lis
270endif
271DRDI_BIN_FILE := DRDI.bin
272
273# *************************************************************************
274# Settings for DSP
275# *************************************************************************
276DSPDIR := $(strip $(RELDIR))/$(strip $(ORIGINAL_PROJECT_NAME))/$(strip $(ORIGINAL_FLAVOR))/dsp_rel
277BUILD_DSPDIR := $(strip $(TARGDIR))/dsp
278ifeq ($(strip $(RELEASE_PACKAGE)),REL_INTERNAL)
279DSP_DEFAULT_DBF := DSP_Default.dbf
280else
281DSP_DEFAULT_DBF := DSP_Default_external.dbf
282endif
283ifeq ($(strip $(CUSTOM_RELEASE)),TRUE)
284DSP_DBF := $(DSPDIR)/$(strip $(DSP_PROJECT))/$(strip $(DSP_FLAVOR))/final_bin/xml/$(strip $(DSP_DEFAULT_DBF))
285else
286DSP_DBF := $(strip $(MODISBUILD_TST_DB))/dbf/$(strip $(DSP_DEFAULT_DBF))
287endif
288DSP_INFO_FILE := label.ini
289DSP_VER := $(strip $(PLATFORM))_$(subst .,_,$(call uc,$(strip $(VERNO))))
290BUILD_DSPDIR := $(strip $(TARGDIR))/dsp
291DSP_REL_DIR := dsp_rel
292
293DSP_FINAL_BIN_NAME := $(strip $(DSP_PROJECT))_$(strip $(DSP_FLAVOR))_DSP_FINAL_BIN.zip
294ifeq ($(strip $(CUSTOM_RELEASE)),TRUE)
295DBF_INPUT_PATH := $(DSPDIR)/$(strip $(DSP_PROJECT))/$(strip $(DSP_FLAVOR))/final_bin/xml
296endif
297
298# *************************************************************************
299# Settings for Guardian
300# *************************************************************************
301ifndef PARTIAL_SOURCE
302PARTIAL_SOURCE := FALSE
303endif
304
305# *************************************************************************
306# File setting for linux/win
307# *************************************************************************
308ifeq ($(strip $(OS_VERSION)),MSWin32)
309 CGEN := $(strip $(FIXPATH))\tools\CGenTool\Cgen.exe
310 POSTGEN := $(strip $(FIXPATH))\tools\PostGen\PostGen.exe
311 DB_CONVERTER := $(strip $(FIXPATH))\tools\PostGen\Converter\DBv12_Converter.exe
312 DRV_GEN := $(FIXPATH)\custom\driver\drv\Drv_Tool\DrvGen.exe
313 MBL_COMPOSER := .\tools\MBL_Composer.exe
314 DBG_INFOGEN := .\tools\DbgInfoGen.exe
315 UPDATE_IMG := .\tools\update_img.exe
316 HEADER_TEMP := $(subst /,\,$(strip $(PROJDIR)))\header_temp
317 HTOGETHER := .\tools\hTogether\htogether_list.bat
318 MinGWDir := .\mtk_tools\MinGW\win
319else
320 CGEN := $(strip $(FIXPATH))/tools/CGenTool/Cgen
321 POSTGEN := $(strip $(FIXPATH))/tools/PostGen/PostGen
322 DB_CONVERTER := $(strip $(FIXPATH))/tools/PostGen/Converter/DBv12_Converter
323 DRV_GEN := $(FIXPATH)/custom/driver/drv/Drv_Tool/DrvGen
324 MBL_COMPOSER := ./tools/MBL_Composer
325 DBG_INFOGEN := ./tools/DbgInfo/DbgInfoGen
326 UPDATE_IMG := ./tools/update_img
327 HEADER_TEMP := $(strip $(PROJDIR))/header_temp
328 HTOGETHER := ./tools/hTogether/htogether_list.sh
329 MinGWDir := /mtkoss/mingw/6.2.1
330endif
331
332# *************************************************************************
333# MD_OFFLOAD_COPRO settings
334# *************************************************************************
335L1CORE_SCATTERFILE := $(strip $(L1CORE_SYSDIR))/lds$(strip $(PROJECT_NAME))_$(strip $(FLAVOR)).txt
336L1CORE_MAP_FILE := $(strip $(L1CORE_TARGDIR))/$(strip $(L1CORE_TARGNAME_L)).map
337L1CORE_SYM_FILE := $(strip $(L1CORE_TARGDIR))/$(strip $(L1CORE_TARGNAME_L)).sym