blob: 3d23159a5732ea8fd2d578d8ca940d4201ee43ce [file] [log] [blame]
lh9ed821d2023-04-07 01:36:19 -07001
2ifeq ($(DCXO), yes)
3LIBPS_PATH=$(LIB_DIR)/libps/$(RF_TYPE)_$(MODEM_TYPE)_dcxo
4else
5LIBPS_PATH=$(LIB_DIR)/libps/$(RF_TYPE)_$(MODEM_TYPE)
6endif
7
8libps_libs =
9libps_libs_lto =
10libps_libs_nolto =
11ifneq ($(USE_CPPS_KO),yes)
12libps_libs_nolto += $(LIBPS_PATH)/appstart/appstart.o
13endif
14
15
16libps_libs_nolto += $(LIBPS_PATH)/appstart/appstart.a
17libps_libs_nolto += $(wildcard $(LIBPS_PATH)/gsml1/*.a)
18
19ifeq ($(USE_ENABLE_LTO),yes)
20 libps_libs_lto += $(wildcard $(LIBPS_PATH)/plat/*.o)
21 libps_libs_lto += $(wildcard $(LIBPS_PATH)/drv/*.o)
22 libps_libs_nolto += $(LIBPS_PATH)/drv/audio_process.a
23 libps_libs_lto += $(wildcard $(LIBPS_PATH)/phy/*.o)
24 libps_libs_lto += $(wildcard $(LIBPS_PATH)/tools/*.o)
25 libps_libs_lto += $(wildcard $(LIBPS_PATH)/amt/*.o)
26 libps_libs_lto += $(wildcard $(LIBPS_PATH)/ref/*.o)
27 libps_libs_lto += $(wildcard $(LIBPS_PATH)/ps/*.o)
28 libps_libs_lto += $(wildcard $(LIBPS_PATH)/psbase/*.o)
29 libps_libs_lto += $(wildcard $(LIBPS_PATH)/usat/*.o)
30else
31 libps_libs_nolto += $(wildcard $(LIBPS_PATH)/plat/*.a)
32 libps_libs_nolto += $(wildcard $(LIBPS_PATH)/drv/*.a)
33 libps_libs_nolto += $(wildcard $(LIBPS_PATH)/phy/*.a)
34 libps_libs_nolto += $(wildcard $(LIBPS_PATH)/tools/*.a)
35 libps_libs_nolto += $(wildcard $(LIBPS_PATH)/amt/*.a)
36 libps_libs_nolto += $(wildcard $(LIBPS_PATH)/ref/*.a)
37 libps_libs_nolto += $(wildcard $(LIBPS_PATH)/ps/*.a)
38 libps_libs_nolto += $(wildcard $(LIBPS_PATH)/psbase/*.a)
39 libps_libs_nolto += $(wildcard $(LIBPS_PATH)/usat/*.a)
40endif
xf.li742dd022023-06-08 01:43:32 -070041ifeq ($(USE_OPTEE),yes)
42libps_libs_nolto += $(wildcard $(LIBPS_PATH)/optee/*.a)
43endif
lh9ed821d2023-04-07 01:36:19 -070044libps_libs_nolto += $(CROSS_COMPILE_LIB_KERNEL)
45
46libps_libs += $(libps_libs_nolto)
47libps_libs += $(libps_libs_lto)
48
49ifeq ($(USE_ENABLE_LTO),yes)
50
51LTO_CFLAGS = -flto -fno-toplevel-reorder
52# $(DISABLE_TL_REORDER)
53LTO_FINAL_CFLAGS := -fuse-linker-plugin
54
55# would be needed to support < 5.0
56LTO_FINAL_CFLAGS += -fno-toplevel-reorder
57
58LTO_FINAL_CFLAGS += -flto=jobserver
59
60# don't compile everything twice
61# requires plugin ar
62LTO_CFLAGS += -fno-fat-lto-objects
63
64# Used to disable LTO for specific files (e.g. vdso)
65DISABLE_LTO = -fno-lto
66
67# shut up lots of warnings for the compat syscalls
68#LTO_CFLAGS += $(call cc-disable-warning,attribute-alias,)
69
70LTO_FINAL_CFLAGS += $(LTO_CFLAGS) -fwhole-program
71
72# most options are passed through implicitely in the LTO
73# files per function, but not all.
74# should not pass any that may need to be disabled for
75# individual files.
76#LTO_FINAL_CFLAGS += $(filter -pg,${KBUILD_CFLAGS})
77LTO_FINAL_CFLAGS += -fno-strict-aliasing
78
79#ifdef CONFIG_LTO_DEBUG
80#LTO_FINAL_CFLAGS += -fdump-ipa-cgraph -fdump-ipa-inline-details
81# add for debugging compiler crashes:
82# LTO_FINAL_CFLAGS += -dH -save-temps
83#endif
84#ifdef CONFIG_LTO_CP_CLONE
85#LTO_FINAL_CFLAGS += -fipa-cp-clone
86#LTO_CFLAGS += -fipa-cp-clone
87#endif
88
89else
90
91LTO_CFLAGS =
92DISABLE_LTO =
93LTO_FINAL_CFLAGS =
94
95endif
96
97CPKO_EXT_CFLAGS =
98KERNEL_EXT_CFLAGS =
99
100ifeq ($(USE_TestHarness),yes)
101CPKO_EXT_CFLAGS += -D_USE_TestHarness
102endif
103
104ifeq ($(USE_VOICE_SUPPORT),yes)
105CPKO_EXT_CFLAGS += -DUSE_VOICE_SUPPORT
106endif
107
108ifeq ($(LIBC_TYPE),glibc)
109CPKO_EXT_CFLAGS += -DUSE_GLIBC
110endif
111
112ifeq ($(CONFIG_SINGLECORE),yes)
113KERNEL_EXT_CFLAGS += -DCONFIG_SINGLECORE
114endif
115
116ifeq ($(CONFIG_MEMCHECK),yes)
117KERNEL_EXT_CFLAGS += -DCONFIG_MEM_CHECK
118endif
119
120ifeq ($(CONFIG_KLOCWORK),yes)
121KERNEL_EXT_CFLAGS += -DCONFIG_KLOCWORK
122endif
123
124ifeq ($(USE_CAP_SYS),yes)
125KERNEL_EXT_CFLAGS += -D_USE_CAP_SYS
126endif
127ifeq ($(USE_CAP_SYS),no)
128KERNEL_EXT_CFLAGS += -DDDR_BASE_LEN_CAP=0
129KERNEL_EXT_CFLAGS += -DDDR_BASE_LEN_CAP_BUF=0
130endif
131
132ifeq ($(USE_VEHICLE_DC),yes)
133KERNEL_EXT_CFLAGS += -D_USE_VEHICLE_DC
134endif
135
lh758261d2023-07-13 05:52:04 -0700136ifeq ($(USE_VEHICLE_DC_REF),yes)
137KERNEL_EXT_CFLAGS += -D_USE_VEHICLE_DC_REF
jb.qi5532c6f2024-02-29 23:55:54 -0800138#jb.qi add for wifi config on 20240301 start
139#KERNEL_EXT_CFLAGS += -D_USE_VEHICLE_DC_REF_MMC0
140#jb.qi add for wifi config on 20240301 end
lh758261d2023-07-13 05:52:04 -0700141endif
142
lh9ed821d2023-04-07 01:36:19 -0700143KERNEL_EXT_CFLAGS += -DDDR_BASE_ADDR_LINUX_VA
144
145ifeq ($(USE_BTRUNK_SUPPORT),yes)
146KERNEL_EXT_CFLAGS += -DBTRUNK_SUPPORT
147endif
148
149KERNEL_EXT_CFLAGS += $(CPKO_EXT_CFLAGS)
150
151ifeq ($(USE_ZCAT_MBIM),yes)
152KERNEL_EXT_CFLAGS += -D_USE_MBIM
153endif
154
155ifeq ($(DCXO),yes)
156KERNEL_EXT_CFLAGS += -DRFC_DCXO_EN
157endif
158
159ifeq ($(RF_TYPE),220A1)
160KERNEL_EXT_CFLAGS += -D_USE_RF_ZTE220A1
161endif
162
163ifeq ($(RF_TYPE),230A)
164KERNEL_EXT_CFLAGS += -D_USE_RF_ZTE230A
165endif
166
167ifeq ($(USE_DSDS_VSIM),yes)
168KERNEL_EXT_CFLAGS += -DUSE_DSDS_VSIM
169endif
170
171ifeq ($(USE_ZXIC_DEBUG_INFO),yes)
172KERNEL_EXT_CFLAGS += -D_USE_ZXIC_DEBUG_INFO
173endif
174
lh758261d2023-07-13 05:52:04 -0700175ifeq ($(MODEM_TYPE),lte_only)
176KERNEL_EXT_CFLAGS += -D_USE_LTE_ONLY
177endif
178
lh9ed821d2023-04-07 01:36:19 -0700179KERNEL_EXT_CFLAGS += -I$(PUB_ROOT_DIR)/include/infra
180
xf.li6c8fc1e2023-08-12 00:11:09 -0700181ifeq ($(ALSA_CODEC_IN_CAP),yes)
182KERNEL_EXT_CFLAGS += -D_ALSA_CODEC_IN_CAP
jb.qi5532c6f2024-02-29 23:55:54 -0800183endif