blob: 12833648c7e333ca2aefd17a45891e009f2af490 [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
138endif
139
lh9ed821d2023-04-07 01:36:19 -0700140KERNEL_EXT_CFLAGS += -DDDR_BASE_ADDR_LINUX_VA
141
142ifeq ($(USE_BTRUNK_SUPPORT),yes)
143KERNEL_EXT_CFLAGS += -DBTRUNK_SUPPORT
144endif
145
146KERNEL_EXT_CFLAGS += $(CPKO_EXT_CFLAGS)
147
148ifeq ($(USE_ZCAT_MBIM),yes)
149KERNEL_EXT_CFLAGS += -D_USE_MBIM
150endif
151
152ifeq ($(DCXO),yes)
153KERNEL_EXT_CFLAGS += -DRFC_DCXO_EN
154endif
155
156ifeq ($(RF_TYPE),220A1)
157KERNEL_EXT_CFLAGS += -D_USE_RF_ZTE220A1
158endif
159
160ifeq ($(RF_TYPE),230A)
161KERNEL_EXT_CFLAGS += -D_USE_RF_ZTE230A
162endif
163
164ifeq ($(USE_DSDS_VSIM),yes)
165KERNEL_EXT_CFLAGS += -DUSE_DSDS_VSIM
166endif
167
168ifeq ($(USE_ZXIC_DEBUG_INFO),yes)
169KERNEL_EXT_CFLAGS += -D_USE_ZXIC_DEBUG_INFO
170endif
171
lh758261d2023-07-13 05:52:04 -0700172ifeq ($(MODEM_TYPE),lte_only)
173KERNEL_EXT_CFLAGS += -D_USE_LTE_ONLY
174endif
175
lh9ed821d2023-04-07 01:36:19 -0700176KERNEL_EXT_CFLAGS += -I$(PUB_ROOT_DIR)/include/infra
177
xf.li6c8fc1e2023-08-12 00:11:09 -0700178ifeq ($(ALSA_CODEC_IN_CAP),yes)
179KERNEL_EXT_CFLAGS += -D_ALSA_CODEC_IN_CAP
180endif