blob: 2ef849ae7c139e8d840d8b52145906a9130b8c8c [file] [log] [blame]
yuezonghe824eb0c2024-06-27 02:32:26 -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
41
42libps_libs_nolto += $(CROSS_COMPILE_LIB)
43
44libps_libs += $(libps_libs_nolto)
45libps_libs += $(libps_libs_lto)
46
47ifeq ($(USE_ENABLE_LTO),yes)
48
49LTO_CFLAGS = -flto -fno-toplevel-reorder
50# $(DISABLE_TL_REORDER)
51LTO_FINAL_CFLAGS := -fuse-linker-plugin
52
53# would be needed to support < 5.0
54LTO_FINAL_CFLAGS += -fno-toplevel-reorder
55
56LTO_FINAL_CFLAGS += -flto=jobserver
57
58# don't compile everything twice
59# requires plugin ar
60LTO_CFLAGS += -fno-fat-lto-objects
61
62# Used to disable LTO for specific files (e.g. vdso)
63DISABLE_LTO = -fno-lto
64
65# shut up lots of warnings for the compat syscalls
66#LTO_CFLAGS += $(call cc-disable-warning,attribute-alias,)
67
68LTO_FINAL_CFLAGS += $(LTO_CFLAGS) -fwhole-program
69
70# most options are passed through implicitely in the LTO
71# files per function, but not all.
72# should not pass any that may need to be disabled for
73# individual files.
74#LTO_FINAL_CFLAGS += $(filter -pg,${KBUILD_CFLAGS})
75LTO_FINAL_CFLAGS += -fno-strict-aliasing
76
77#ifdef CONFIG_LTO_DEBUG
78#LTO_FINAL_CFLAGS += -fdump-ipa-cgraph -fdump-ipa-inline-details
79# add for debugging compiler crashes:
80# LTO_FINAL_CFLAGS += -dH -save-temps
81#endif
82#ifdef CONFIG_LTO_CP_CLONE
83#LTO_FINAL_CFLAGS += -fipa-cp-clone
84#LTO_CFLAGS += -fipa-cp-clone
85#endif
86
87else
88
89LTO_CFLAGS =
90DISABLE_LTO =
91LTO_FINAL_CFLAGS =
92
93endif
94
95CPKO_EXT_CFLAGS =
96KERNEL_EXT_CFLAGS =
97
98ifeq ($(USE_TestHarness),yes)
99CPKO_EXT_CFLAGS += -D_USE_TestHarness
100endif
101
102ifeq ($(USE_VOICE_SUPPORT),yes)
103CPKO_EXT_CFLAGS += -DUSE_VOICE_SUPPORT
104endif
105
106ifeq ($(CONFIG_SINGLECORE),yes)
107KERNEL_EXT_CFLAGS += -DCONFIG_SINGLECORE
108endif
109
110ifeq ($(CONFIG_MEMCHECK),yes)
111KERNEL_EXT_CFLAGS += -DCONFIG_MEM_CHECK
112endif
113
114ifeq ($(CONFIG_KLOCWORK),yes)
115KERNEL_EXT_CFLAGS += -DCONFIG_KLOCWORK
116endif
117
118ifeq ($(USE_CAP_SYS),yes)
119KERNEL_EXT_CFLAGS += -D_USE_CAP_SYS
120endif
121ifeq ($(USE_CAP_SYS),no)
122KERNEL_EXT_CFLAGS += -DDDR_BASE_LEN_CAP=0
123KERNEL_EXT_CFLAGS += -DDDR_BASE_LEN_CAP_BUF=0
124endif
125
126KERNEL_EXT_CFLAGS += -DDDR_BASE_ADDR_LINUX_VA
127
128ifeq ($(USE_BTRUNK_SUPPORT),yes)
129KERNEL_EXT_CFLAGS += -DBTRUNK_SUPPORT
130endif
131
132KERNEL_EXT_CFLAGS += $(CPKO_EXT_CFLAGS)
133
134ifeq ($(USE_ZCAT_MBIM),yes)
135KERNEL_EXT_CFLAGS += -D_USE_MBIM
136endif
137
138ifeq ($(DCXO),yes)
139KERNEL_EXT_CFLAGS += -DRFC_DCXO_EN
140endif
141
142ifeq ($(RF_TYPE),220A1)
143KERNEL_EXT_CFLAGS += -D_USE_RF_ZTE220A1
144endif
145
146ifeq ($(RF_TYPE),230A)
147KERNEL_EXT_CFLAGS += -D_USE_RF_ZTE230A
148endif
149
150ifeq ($(MODEM_TYPE),lte_only)
151KERNEL_EXT_CFLAGS += -D_USE_LTE_ONLY
152endif