1 ################################################################################
2 # Copyright (c) [2017-2019] [Radisys] #
4 # Licensed under the Apache License, Version 2.0 (the "License"); #
5 # you may not use this file except in compliance with the License. #
6 # You may obtain a copy of the License at #
8 # http://www.apache.org/licenses/LICENSE-2.0 #
10 # Unless required by applicable law or agreed to in writing, software #
11 # distributed under the License is distributed on an "AS IS" BASIS, #
12 # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. #
13 # See the License for the specific language governing permissions and #
14 # limitations under the License. #
15 ################################################################################
19 # Identify the location our software which is used by rest
20 # of the build scripts
22 include ../common/rsys_fancy.mak
23 include ../common/env.mak
30 CPUINFO=`cat /proc/cpuinfo | grep processor| wc -l`
34 NUM_PARALLEL=$(shell echo $(CPUINFO) - 1 |bc)
38 NUM_PARALLEL=$(shell echo $(CPUINFO) + 2 |bc)
41 PARALLEL_COMP=-j $(NUM_PARALLEL)
43 # Different options to CPUH and CPUL builds
44 # # Other apsects of tool chain set here
45 # # These should be made available appropriately to the builds
46 ifeq ($(MACHINE),BIT64)
48 CC_STRIP =strip --strip-all
54 CC_STRIP =strip --strip-all
69 #-----------------------------------------------------------------------
70 # macro for output file name and makefile name
73 PLTFRM_FLAGS= -UMSPD -DODU #-DFAPI -DINTEL_WLS -DEGTP_TEST
76 PLTFRM_FLAGS += -DMODE=TDD
78 ifeq ($(CA_ENABLE),YES)
79 PLTFRM_FLAGS += -DCA_ENABLE=YES
82 ifeq ($(NODE),TEST_STUB)
83 PLTFRM_FLAGS+=-DODU_TEST_STUB
86 # The include options get merged with the options needed by
87 # # the called makefiles and hence we export these to make them
88 # # available to them.
91 # The called makefiles depend on these macros and these need to be exported
97 # Add to the linker options the platform specific components
98 #L_OPTS+=-lnsl -lrt -lm -lpthread -lsctp
99 L_OPTS+=-lnsl -lrt -lm -lpthread -lsctp
101 # Export some of the flags expected from the command line.
102 # # These macros are made available for the makefiles called from this makefile
112 @echo -e "******************************************************************"
113 @echo -e "BUILD COMMAND DESCRIPTION "
114 @echo -e "------------------------------------------------------------------"
115 @echo -e "$(RULE)odu - Builds all components of ODU$(NORM)"
116 @echo -e "$(RULE)cu_stub - Builds all CU Stub$(NORM)"
117 @echo -e "$(RULE)ric_stub - Builds all RIC_Stub$(NORM)"
118 @echo -e "$(RULE)clean_odu - clean up ODU$(NORM)"
119 @echo -e "$(RULE)clean_cu - clean up CU Stub$(NORM)"
120 @echo -e "$(RULE)clean_ric - clean up RIC Stub$(NORM)"
121 @echo -e "$(RULE)clean_all - cleanup everything$(NORM)"
122 @echo -e "$(OPTS) options: $(NORM)"
123 @echo -e "$(OPTS) MACHINE=BIT64/BIT32 - Default is BIT32$(NORM)"
124 @echo -e "$(OPTS) NODE=TEST_STUB - Mandatory option for cu_stub/ric_stub$(NORM)"
125 @echo -e "$(OPTS) MODE=TDD - If not specified, MODE=FDD$(NORM)"
126 @echo -e "******************************************************************"
129 $(Q)echo -e "Preparing directories for build..."
130 $(Q)mkdir -p $(BUILD_DIR)/obj/odu
131 $(Q)mkdir -p $(LIB_ROOT)/odu
132 $(Q)mkdir -p $(ROOT_DIR)/libs/
133 $(Q)mkdir -p $(BIN_DIR)/odu
134 $(Q)mkdir -p $(ROOT_DIR)/bin
135 $(Q)echo -e "Directories are successfully prepared"
138 $(Q)echo -e "Preparing directories for build..."
139 $(Q)mkdir -p $(BUILD_DIR)/obj/cu_stub
140 $(Q)mkdir -p $(LIB_ROOT)/cu_stub
141 $(Q)mkdir -p $(BIN_DIR)/cu_stub
142 $(Q)echo -e "Directories are successfully prepared"
145 $(Q)echo -e "Preparing directories for build..."
146 $(Q)mkdir -p $(BUILD_DIR)/obj/ric_stub
147 $(Q)mkdir -p $(LIB_ROOT)/ric_stub
148 $(Q)mkdir -p $(BIN_DIR)/ric_stub
149 $(Q)echo -e "Directories are successfully prepared"
152 $(Q)$(MAKE) -f $(COM_BUILD_DIR)/asn_common.mak OBJ_DIR=$(OBJ_ROOT)/odu LIB_DIR=$(LIB_ROOT)/odu LOG_DIR=$(LOG_ROOT)/odu CC='$(CC1)'
153 $(Q)$(MAKE) -f $(COM_BUILD_DIR)/asn_f1ap.mak OBJ_DIR=$(OBJ_ROOT)/odu LIB_DIR=$(LIB_ROOT)/odu LOG_DIR=$(LOG_ROOT)/odu CC='$(CC1)'
154 $(Q)$(MAKE) -f $(COM_BUILD_DIR)/asn_e2ap.mak OBJ_DIR=$(OBJ_ROOT)/odu LIB_DIR=$(LIB_ROOT)/odu LOG_DIR=$(LOG_ROOT)/odu CC='$(CC1)'
155 $(Q)$(MAKE) -f $(COM_BUILD_DIR)/asn_rrc.mak OBJ_DIR=$(OBJ_ROOT)/odu LIB_DIR=$(LIB_ROOT)/odu LOG_DIR=$(LOG_ROOT)/odu CC='$(CC1)'
156 $(Q)$(MAKE) -f $(COM_BUILD_DIR)/du_app.mak OBJ_DIR=$(OBJ_ROOT)/odu LIB_DIR=$(LIB_ROOT)/odu LOG_DIR=$(LOG_ROOT)/odu CC='$(CC1)'
157 #$(Q)$(MAKE) -f $(COM_BUILD_DIR)/f1ap.mak OBJ_DIR=$(OBJ_ROOT)/odu LIB_DIR=$(LIB_ROOT)/odu LOG_DIR=$(LOG_ROOT)/odu CC='$(CC1)'
158 $(Q)$(MAKE) -f $(COM_BUILD_DIR)/kw.mak OBJ_DIR=$(OBJ_ROOT)/odu LIB_DIR=$(LIB_ROOT)/odu LOG_DIR=$(LOG_ROOT)/odu CC='$(CC1)'
159 $(Q)$(MAKE) -f $(COM_BUILD_DIR)/cm.mak OBJ_DIR=$(OBJ_ROOT)/odu LIB_DIR=$(LIB_ROOT)/odu LOG_DIR=$(LOG_ROOT)/odu CC='$(CC1)'
160 $(Q)$(MAKE) -f $(COM_BUILD_DIR)/mac.mak OBJ_DIR=$(OBJ_ROOT)/odu LIB_DIR=$(LIB_ROOT)/odu LOG_DIR=$(LOG_ROOT)/odu CC='$(CC1)'
161 $(Q)$(MAKE) -f $(COM_BUILD_DIR)/sch.mak OBJ_DIR=$(OBJ_ROOT)/odu LIB_DIR=$(LIB_ROOT)/odu LOG_DIR=$(LOG_ROOT)/odu CC='$(CC1)'
162 $(Q)$(MAKE) -f $(COM_BUILD_DIR)/mt.mak OBJ_DIR=$(OBJ_ROOT)/odu LIB_DIR=$(LIB_ROOT)/odu LOG_DIR=$(LOG_ROOT)/odu CC='$(CC1)'
163 $(Q)$(MAKE) -f $(COM_BUILD_DIR)/rl.mak OBJ_DIR=$(OBJ_ROOT)/odu LIB_DIR=$(LIB_ROOT)/odu LOG_DIR=$(LOG_ROOT)/odu CC='$(CC1)'
164 $(Q)$(MAKE) -f $(COM_BUILD_DIR)/phy_stub.mak OBJ_DIR=$(OBJ_ROOT)/odu LIB_DIR=$(LIB_ROOT)/odu LOG_DIR=$(LOG_ROOT)/odu CC='$(CC1)'
167 $(Q)$(CC1) -g -o $(OBJ_ROOT)/odu/odu -Wl,-R../lib/:. $(OBJ_ROOT)/odu/*.o\
168 $(L_OPTS) -L$(LIB_ROOT)/odu -L$(ROOT_DIR)/libs/odu
171 $(Q)$(MAKE) -f $(COM_BUILD_DIR)/du_app.mak clean OBJ_DIR=$(OBJ_ROOT)/odu LIB_DIR=$(LIB_ROOT)/odu LOG_DIR=$(LOG_ROOT)/odu CC='$(CC1)'
172 $(Q)$(MAKE) -f $(COM_BUILD_DIR)/asn_common.mak clean OBJ_DIR=$(OBJ_ROOT)/odu LIB_DIR=$(LIB_ROOT)/odu LOG_DIR=$(LOG_ROOT)/odu CC='$(CC1)'
173 $(Q)$(MAKE) -f $(COM_BUILD_DIR)/asn_f1ap.mak clean OBJ_DIR=$(OBJ_ROOT)/odu LIB_DIR=$(LIB_ROOT)/odu LOG_DIR=$(LOG_ROOT)/odu CC='$(CC1)'
174 $(Q)$(MAKE) -f $(COM_BUILD_DIR)/asn_e2ap.mak clean OBJ_DIR=$(OBJ_ROOT)/odu LIB_DIR=$(LIB_ROOT)/odu LOG_DIR=$(LOG_ROOT)/odu CC='$(CC1)'
175 $(Q)$(MAKE) -f $(COM_BUILD_DIR)/asn_rrc.mak clean OBJ_DIR=$(OBJ_ROOT)/odu LIB_DIR=$(LIB_ROOT)/odu LOG_DIR=$(LOG_ROOT)/odu CC='$(CC1)'
176 $(Q)$(MAKE) -f $(COM_BUILD_DIR)/kw.mak clean OBJ_DIR=$(OBJ_ROOT)/odu LIB_DIR=$(LIB_ROOT)/odu LOG_DIR=$(LOG_ROOT)/odu CC='$(CC1)'
177 $(Q)$(MAKE) -f $(COM_BUILD_DIR)/cm.mak clean OBJ_DIR=$(OBJ_ROOT)/odu LIB_DIR=$(LIB_ROOT)/odu LOG_DIR=$(LOG_ROOT)/odu CC='$(CC1)'
178 $(Q)$(MAKE) -f $(COM_BUILD_DIR)/mac.mak clean OBJ_DIR=$(OBJ_ROOT)/odu LIB_DIR=$(LIB_ROOT)/odu LOG_DIR=$(LOG_ROOT)/odu CC='$(CC1)'
179 $(Q)$(MAKE) -f $(COM_BUILD_DIR)/sch.mak clean OBJ_DIR=$(OBJ_ROOT)/odu LIB_DIR=$(LIB_ROOT)/odu LOG_DIR=$(LOG_ROOT)/odu CC='$(CC1)'
180 $(Q)$(MAKE) -f $(COM_BUILD_DIR)/mt.mak clean OBJ_DIR=$(OBJ_ROOT)/odu LIB_DIR=$(LIB_ROOT)/odu LOG_DIR=$(LOG_ROOT)/odu CC='$(CC1)'
181 $(Q)$(MAKE) -f $(COM_BUILD_DIR)/rl.mak clean OBJ_DIR=$(OBJ_ROOT)/odu LIB_DIR=$(LIB_ROOT)/odu LOG_DIR=$(LOG_ROOT)/odu CC='$(CC1)'
182 $(Q)$(MAKE) -f $(COM_BUILD_DIR)/phy_stub.mak clean OBJ_DIR=$(OBJ_ROOT)/odu LIB_DIR=$(LIB_ROOT)/odu LOG_DIR=$(LOG_ROOT)/odu CC='$(CC1)'
183 $(Q)rm -rf $(OBJ_ROOT)/odu/*
184 $(Q)rm -rf $(LIB_ROOT)/odu/*
185 $(Q)rm -rf $(BIN_DIR)/odu/*
186 $(Q)rm -rf $(ROOT_DIR)/bin/odu
187 $(Q)echo -e "***** ODU CLEAN COMPLETE *****"
189 clean_all: clean_odu clean_cu clean_ric
190 $(Q)rm -rf $(OBJ_ROOT)
191 $(Q)rm -rf $(LIB_ROOT)
192 $(Q)rm -rf $(LOG_ROOT)
193 $(Q)rm -rf $(BIN_DIR)
194 $(Q)rm -rf $(ROOT_DIR)/bin
195 $(Q)rm -rf $(ROOT_DIR)/libs
198 $(Q)$(MAKE) -f $(COM_BUILD_DIR)/cu_stub.mak OBJ_DIR=$(OBJ_ROOT)/cu_stub LIB_DIR=$(LIB_ROOT)/cu_stub LOG_DIR=$(LOG_ROOT)/cu_stub CC='$(CC1)'
199 $(Q)$(MAKE) -f $(COM_BUILD_DIR)/asn_common.mak OBJ_DIR=$(OBJ_ROOT)/cu_stub LIB_DIR=$(LIB_ROOT)/cu_stub LOG_DIR=$(LOG_ROOT)/cu_stub CC='$(CC1)'
200 $(Q)$(MAKE) -f $(COM_BUILD_DIR)/asn_f1ap.mak OBJ_DIR=$(OBJ_ROOT)/cu_stub LIB_DIR=$(LIB_ROOT)/cu_stub LOG_DIR=$(LOG_ROOT)/cu_stub CC='$(CC1)'
201 $(Q)$(MAKE) -f $(COM_BUILD_DIR)/asn_rrc.mak OBJ_DIR=$(OBJ_ROOT)/cu_stub LIB_DIR=$(LIB_ROOT)/cu_stub LOG_DIR=$(LOG_ROOT)/cu_stub CC='$(CC1)'
202 $(Q)$(MAKE) -f $(COM_BUILD_DIR)/cm.mak OBJ_DIR=$(OBJ_ROOT)/cu_stub LIB_DIR=$(LIB_ROOT)/cu_stub LOG_DIR=$(LOG_ROOT)/cu_stub CC='$(CC1)'
203 $(Q)$(MAKE) -f $(COM_BUILD_DIR)/mt.mak OBJ_DIR=$(OBJ_ROOT)/cu_stub LIB_DIR=$(LIB_ROOT)/cu_stub LOG_DIR=$(LOG_ROOT)/cu_stub CC='$(CC1)'
206 $(Q)$(MAKE) -f $(COM_BUILD_DIR)/cu_stub.mak clean OBJ_DIR=$(OBJ_ROOT)/cu_stub LIB_DIR=$(LIB_ROOT)/cu_stub LOG_DIR=$(LOG_ROOT)/cu_stub CC='$(CC1)'
207 $(Q)$(MAKE) -f $(COM_BUILD_DIR)/asn_common.mak clean OBJ_DIR=$(OBJ_ROOT)/cu_stub LIB_DIR=$(LIB_ROOT)/cu_stub LOG_DIR=$(LOG_ROOT)/cu_stub CC='$(CC1)'
208 $(Q)$(MAKE) -f $(COM_BUILD_DIR)/asn_f1ap.mak clean OBJ_DIR=$(OBJ_ROOT)/cu_stub LIB_DIR=$(LIB_ROOT)/cu_stub LOG_DIR=$(LOG_ROOT)/cu_stub CC='$(CC1)'
209 $(Q)$(MAKE) -f $(COM_BUILD_DIR)/asn_rrc.mak clean OBJ_DIR=$(OBJ_ROOT)/cu_stub LIB_DIR=$(LIB_ROOT)/cu_stub LOG_DIR=$(LOG_ROOT)/cu_stub CC='$(CC1)'
210 $(Q)$(MAKE) -f $(COM_BUILD_DIR)/cm.mak clean OBJ_DIR=$(OBJ_ROOT)/cu_stub LIB_DIR=$(LIB_ROOT)/cu_stub LOG_DIR=$(LOG_ROOT)/cu_stub CC='$(CC1)'
211 $(Q)$(MAKE) -f $(COM_BUILD_DIR)/mt.mak clean OBJ_DIR=$(OBJ_ROOT)/cu_stub LIB_DIR=$(LIB_ROOT)/cu_stub LOG_DIR=$(LOG_ROOT)/cu_stub CC='$(CC1)'
212 $(Q)rm -rf $(OBJ_ROOT)/cu_stub/*
213 $(Q)rm -rf $(LIB_ROOT)/cu_stub/*
214 $(Q)rm -rf $(BIN_DIR)/cu_stub/*
215 $(Q)rm -rf $(ROOT_DIR)/bin/cu_stub
216 $(Q)echo -e "***** CU STUB CLEAN COMPLETE *****"
219 $(Q)$(CC1) -g -o $(OBJ_ROOT)/cu_stub/cu_stub -Wl,-R../lib/:. $(OBJ_ROOT)/cu_stub/*.o\
220 $(L_OPTS) -L$(LIB_ROOT)/cu_stub -L$(ROOT_DIR)/libs/cu_stub
221 $(Q)cp -f ./obj/cu_stub/cu_stub ./bin/cu_stub
222 $(Q)cp -rf ./bin/cu_stub $(ROOT_DIR)/bin/
223 $(Q)cp -f ../scripts/cu_script.sh $(ROOT_DIR)/bin/cu_stub
224 $(Q)echo -e "***** CU STUB BUILD COMPLETE *****"
227 $(Q)$(MAKE) -f $(COM_BUILD_DIR)/ric_stub.mak OBJ_DIR=$(OBJ_ROOT)/ric_stub LIB_DIR=$(LIB_ROOT)/ric_stub LOG_DIR=$(LOG_ROOT)/ric_stub CC='$(CC1)'
228 $(Q)$(MAKE) -f $(COM_BUILD_DIR)/asn_common.mak OBJ_DIR=$(OBJ_ROOT)/ric_stub LIB_DIR=$(LIB_ROOT)/ric_stub LOG_DIR=$(LOG_ROOT)/ric_stub CC='$(CC1)'
229 $(Q)$(MAKE) -f $(COM_BUILD_DIR)/asn_e2ap.mak OBJ_DIR=$(OBJ_ROOT)/ric_stub LIB_DIR=$(LIB_ROOT)/ric_stub LOG_DIR=$(LOG_ROOT)/ric_stub CC='$(CC1)'
230 $(Q)$(MAKE) -f $(COM_BUILD_DIR)/cm.mak OBJ_DIR=$(OBJ_ROOT)/ric_stub LIB_DIR=$(LIB_ROOT)/ric_stub LOG_DIR=$(LOG_ROOT)/ric_stub CC='$(CC1)'
231 $(Q)$(MAKE) -f $(COM_BUILD_DIR)/mt.mak OBJ_DIR=$(OBJ_ROOT)/ric_stub LIB_DIR=$(LIB_ROOT)/ric_stub LOG_DIR=$(LOG_ROOT)/ric_stub CC='$(CC1)'
234 $(Q)$(MAKE) -f $(COM_BUILD_DIR)/ric_stub.mak clean OBJ_DIR=$(OBJ_ROOT)/ric_stub LIB_DIR=$(LIB_ROOT)/ric_stub LOG_DIR=$(LOG_ROOT)/ric_stub CC='$(CC1)'
235 $(Q)$(MAKE) -f $(COM_BUILD_DIR)/asn_common.mak clean OBJ_DIR=$(OBJ_ROOT)/ric_stub LIB_DIR=$(LIB_ROOT)/ric_stub LOG_DIR=$(LOG_ROOT)/ric_stub CC='$(CC1)'
236 $(Q)$(MAKE) -f $(COM_BUILD_DIR)/asn_e2ap.mak clean OBJ_DIR=$(OBJ_ROOT)/ric_stub LIB_DIR=$(LIB_ROOT)/ric_stub LOG_DIR=$(LOG_ROOT)/ric_stub CC='$(CC1)'
237 $(Q)$(MAKE) -f $(COM_BUILD_DIR)/asn_rrc.mak clean OBJ_DIR=$(OBJ_ROOT)/ric_stub LIB_DIR=$(LIB_ROOT)/ric_stub LOG_DIR=$(LOG_ROOT)/ric_stub CC='$(CC1)'
238 $(Q)$(MAKE) -f $(COM_BUILD_DIR)/cm.mak clean OBJ_DIR=$(OBJ_ROOT)/ric_stub LIB_DIR=$(LIB_ROOT)/ric_stub LOG_DIR=$(LOG_ROOT)/ric_stub CC='$(CC1)'
239 $(Q)$(MAKE) -f $(COM_BUILD_DIR)/mt.mak clean OBJ_DIR=$(OBJ_ROOT)/ric_stub LIB_DIR=$(LIB_ROOT)/ric_stub LOG_DIR=$(LOG_ROOT)/ric_stub CC='$(CC1)'
240 $(Q)rm -rf $(OBJ_ROOT)/ric_stub/*
241 $(Q)rm -rf $(LIB_ROOT)/ric_stub/*
242 $(Q)rm -rf $(BIN_DIR)/ric_stub/*
243 $(Q)rm -rf $(ROOT_DIR)/bin/ric_stub
244 $(Q)echo -e "***** RIC STUB CLEAN COMPLETE *****"
248 $(Q)$(CC1) -g -o $(OBJ_ROOT)/ric_stub/ric_stub -Wl,-R../lib/:. $(OBJ_ROOT)/ric_stub/*.o\
249 $(L_OPTS) -L$(LIB_ROOT)/ric_stub -L$(ROOT_DIR)/libs/ric_stub
250 $(Q)cp -f ./obj/ric_stub/ric_stub ./bin/ric_stub
251 $(Q)cp -rf ./bin/ric_stub $(ROOT_DIR)/bin/
252 $(Q)echo -e "***** RIC STUB BUILD COMPLETE *****"
256 $(Q)cp -f ./obj/odu/odu ./bin/odu
257 $(Q)cp -rf ./bin/odu $(ROOT_DIR)/bin/
258 $(Q)cp -f ../scripts/odu_script.sh $(ROOT_DIR)/bin/odu
259 $(Q)cp -f ./lib/odu/*.a $(ROOT_DIR)/libs/
260 $(Q)echo -e "***** BUILD COMPLETE *****"
262 odu: prepare_dirs copy_build
264 cu_stub: prepare_cu_dirs cu link_cu
265 ric_stub: prepare_ric_dirs ric link_ric