Makefile 10.1 KB
Newer Older
1
2
3
4
# Include some shared directives
include $(OPENAIR_TARGETS)/Makerules

default: lte-softmodem
5
all: lte-softmodem lte-enb
6
7
8

include $(OPENAIR_TARGETS)/Makefile.common

Huang's avatar
   
Huang committed
9
10
11
12
13
14
15
16
17
18
19
20
21
GCCVERSION = $(shell gcc --version | grep ^gcc | sed 's/^.* //g')
ifeq "$(GCCVERSION)"  "4.4.3"
    CFLAGS += -Wno-packed-bitfield-compat
endif
ifeq "$(GCCVERSION)" "4.5.2"
    CFLAGS += -Wno-packed-bitfield-compat
endif
ifeq "$(GCCVERSION)" "4.6.1"
    CFLAGS += -Wno-packed-bitfield-compat
endif

CFLAGS += -O2
CFLAGS += -DDRIVER2013 -I$(OPENAIR_TARGETS)/ARCH/EXMIMO/USERSPACE/LIB/ -I$(OPENAIR_TARGETS)/ARCH/EXMIMO/DEFS -DENABLE_VCD_FIFO
Cedric Roux's avatar
   
Cedric Roux committed
22
23
ifdef DEBUG
CFLAGS += -g -ggdb
24
endif
Huang's avatar
   
Huang committed
25
26
27
28
29
30
31
32
33
34
SRC = synctest.c condtest.c #lte-softmodem.c

ifndef RTAI
RTAI=1
endif

ifndef USRP
USRP=0
endif

Cedric Roux's avatar
   
Cedric Roux committed
35
36
37
38
ifeq ($(ENABLE_RAL), 1)
CFLAGS += -DENABLE_RAL
endif

Huang's avatar
   
Huang committed
39
40
41
42
43
44
45
ifeq ($(RTAI),1)
CFLAGS += -DENABLE_RTAI_CLOCK
CFLAGS += -DCONFIG_RTAI_LXRT_INLINE  #remend the RTAI warning
RTAI_OBJ = sched_dlsch.o sched_ulsch.o sched_rx_pdsch.o rt_wrapper.o 
ifeq ($(USRP),1)
RTAI_OBJ += lte-softmodem-usrp.o
else
46
47
48
49
# RTAI_OBJ += lte-softmodem.o
# RTAI_OBJ += lte-enb.o
# RTAI_OBJ += lte-softmodem-enb.o
# RTAI_OBJ += lte-softmodem-ue.o
Huang's avatar
   
Huang committed
50
51
endif
else
52
OBJ += sched_dlsch.o sched_ulsch.o sched_rx_pdsch.o rt_wrapper.o
Huang's avatar
   
Huang committed
53
54
55
ifeq ($(USRP),1)
OBJ += lte-softmodem-usrp.o
else
56
57
58
59
# OBJ += lte-softmodem.o
# OBJ += lte-enb.o
# OBJ += lte-softmodem-enb.o
# OBJ += lte-softmodem-ue.o
Huang's avatar
   
Huang committed
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
endif
CFLAGS += -DENABLE_USE_CPU_EXECUTION_TIME
endif

OBJ += $(OPENAIR1_DIR)/SIMULATION/TOOLS/taus.o $(OPENAIR_TARGETS)/SIMU/USER/init_lte.o #$(OPENAIR_TARGETS)/ARCH/EXMIMO/USERSPACE/LIB/openair0_lib.o

ifeq ($(USRP),1)
include $(OPENAIR_TARGETS)/ARCH/USRP/USERSPACE/LIB/Makefile.inc
endif

OBJ += $(OPENAIR_TARGETS)/ARCH/EXMIMO/USERSPACE/LIB/openair0_lib.o
CFLAGS += -DDRIVER2013 -I$(OPENAIR_TARGETS)/ARCH/EXMIMO/USERSPACE/LIB/ -I$(OPENAIR_TARGETS)/ARCH/EXMIMO/DEFS -DENABLE_VCD_FIFO

TOP_DIR = $(OPENAIR1_DIR)
include $(OPENAIR1_DIR)/PHY/Makefile.inc
include $(OPENAIR1_DIR)/SCHED/Makefile.inc

OBJ += $(PHY_OBJS)
ifeq ($(RTAI),1)
RTAI_OBJ += $(SCHED_OBJS)
else
OBJ += $(SCHED_OBJS)
endif

OPENAIR2_TOP = $(OPENAIR2_DIR)
include $(OPENAIR2_DIR)/LAYER2/Makefile.inc
include $(OPENAIR2_DIR)/UTIL/Makefile.inc
include $(OPENAIR2_DIR)/RRC/NAS/Makefile.inc
88
include $(OPENAIR2_DIR)/ENB_APP/Makefile.inc
89
include $(OPENAIR3_DIR)/RAL-LTE/Makefile.inc
90
91

OBJ +=  $(ENB_APP_OBJS)
Huang's avatar
   
Huang committed
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107

ifeq ($(RTAI),1)
LOG_OBJS=
RTAI_OBJ+=$(LOG_DIR)/vcd_signal_dumper.o
RTAI_OBJ+=$(LOG_DIR)/log.o
endif

include $(OPENAIR2_DIR)/RRC/LITE/MESSAGES/Makefile.inc

OBJ += $(LOG_OBJS) 

ifndef OPENAIR2
OPENAIR2=1
endif
ifeq ($(OPENAIR2),1)
ASN1_MSG_OBJS1=$(addprefix $(OPENAIR2_DIR)/RRC/LITE/MESSAGES/, $(ASN1_MSG_OBJS))
108
OBJ += $(L2_OBJS) $(LIST_OBJ) $(TIMER_OBJ) $(MEM_OBJ) $(OTG_OBJS) $(MATH_OBJS)
Huang's avatar
   
Huang committed
109
OBJ += $(OPENAIR1_DIR)/SIMULATION/ETH_TRANSPORT/netlink_init.o
110
#OBJ += $(PDCP_DIR)/pdcp_thread.o
Huang's avatar
   
Huang committed
111
112
113
CFLAGS += -DOPENAIR2 -DNO_RRM -DPUCCH -DMAC_CONTEXT=1
endif

114
ifdef ENABLE_ITTI
115
RTAI_OBJ += $(UTILS_OBJS)
116
117
endif

118
CFLAGS += $(L2_incl) $(ENB_APP_incl) $(UTIL_incl) $(UTILS_incl)
Huang's avatar
   
Huang committed
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167

CFLAGS += -I$(OPENAIR1_DIR) -I$(OPENAIR2_DIR)/RRC/LITE/MESSAGES	#-I$(OPENAIR3_DIR)/MESH -I$(OPENAIR3_DIR)/MESH/RRM

CFLAGS += -DNEW_FFT -DLOG_NO_THREAD

ifeq ($(XFORMS),1)
CFLAGS += -DXFORMS -I/usr/include/X11
LDFLAGS += -lforms
OBJ += $(OPENAIR1_DIR)/PHY/TOOLS/lte_phy_scope.o
OBJ += stats.o
endif

ifdef SMBV
CFLAGS += -DSMBV
endif

#CPUFLAGS = -mmmx -msse -msse2 -m32 -mssse3 -msse4.1
CPUFLAGS = -mmmx -msse -msse2 -mssse3 -msse4.1
#CFLAGS += -fno-common -mpreferred-stack-boundary=4  
CFLAGS += -Wall -fno-strict-aliasing -DPHYSIM -DUSER_MODE -DPC_TARGET -DPC_DSP -DNB_ANTENNAS_RX=2 -DNB_ANTENNAS_TXRX=2 -DNB_ANTENNAS_TX=2 -DPHY_CONTEXT=1 -rdynamic $(CPUFLAGS) # -Wno-packed-bitfield-compat
CFLAGS += -DOPENAIR_LTE -DENABLE_FXP -DOPENAIR1 -DDLSCH_THREAD #-DULSCH_THREAD

#only for CBMIMO1
ifdef CBMIMO1
CFLAGS += -DFW2011 -DBIT8_TX -DCBMIMO1
else
#only for EXPRESS MIMO
CFLAGS += -DEXMIMO
#CFLAGS += -DEXMIMO -DTIMING_ADVANCE_HW=138 #this is for ExpressMIMO 1
#CFLAGS += -DEXMIMO -DTIMING_ADVANCE_HW=45 #this is for ExpressMIMO 2
endif

ifeq ($(HARD_RT),1)
CFLAGS += -DHARD_RT
endif

ifeq ($(EMOS),1)
CFLAGS += -DEMOS #-DEMOS_CHANNEL
LDFLAGS += -lgps
endif

ifeq ($(NAS),1)
CFLAGS += -DNAS_NETLINK -DLINUX
OBJ += $(NAS_OBJS)
endif

RTAI_CFLAGS += $(shell rtai-config --lxrt-cflags) -DRTAI
LDFLAGS += -lpthread -lm -lforms
ifeq ($(RTAI),1)
168
LDFLAGS += $(shell rtai-config --lxrt-ldflags)
169
170
171
ifdef ENABLE_ITTI
LDFLAGS += -lrt
endif
Huang's avatar
   
Huang committed
172
173
174
175
176
177
else
LDFLAGS += -lrt
endif

ifeq ($(USRP),1)
CFLAGS += -I/opt/uhd/include -L/opt/uhd/lib -luhd -lpthread -lstdc++
linhuang's avatar
linhuang committed
178
CFLAGS += -DUSRP
Huang's avatar
   
Huang committed
179
180
181
endif
#CFLAGS += -I/usr/include/c++/4.6 -I/usr/include/c++/4.6/x86_64-linux-gnu -I/usr/include/rtai/

182
183
184
185
LFDS_OBJ_DIR		 = $(subst $(OPENAIR_HOME),$(OBJS_DIR),$(LFDS_DIR))
LFDS_LIB		 = $(LFDS_OBJ_DIR)/bin/liblfds611.a
LIBS 			+= $(LFDS_LIB)
SHARED_DEPENDENCIES 	+= $(LFDS_LIB)
Huang's avatar
   
Huang committed
186

187
188
189
-include $(OBJ:.o=.d)
-include $(ASN1_MSG_OBJS1:.o=.d)
-include $(RTAI_OBJ:.o=.d)
190
191
-include lte-softmodem.d
-include lte-enb.d
192

193
194
195
196
$(LFDS_LIB):
	@if [ ! -d $(LFDS_OBJ_DIR)/bin ]; then mkdir -p $(LFDS_OBJ_DIR)/bin; fi;
	@if [ ! -d $(LFDS_OBJ_DIR)/obj ]; then mkdir -p $(LFDS_OBJ_DIR)/obj; fi;
	$(MAKE) -C $(LFDS_DIR) -f makefile.linux OUTDIR=$(LFDS_OBJ_DIR)
Huang's avatar
   
Huang committed
197

198
199
200
ifeq ($(RTAI),1)
$(RTAI_OBJ) lte-enb.o lte-softmodem.o: %.o : %.c
else
Huang's avatar
   
Huang committed
201
$(RTAI_OBJ): %.o : %.c
202
endif
Huang's avatar
   
Huang committed
203
	@echo Compiling $< ...
Cedric Roux's avatar
   
Cedric Roux committed
204
	@$(CC) -c $(CFLAGS) $(EXTRA_CFLAGS) $(RTAI_CFLAGS) -o $@ $<
205
206
207
208
209
210
	@$(CC) -MM $(CFLAGS) $(EXTRA_CFLAGS) $(RTAI_CFLAGS) $< > $*.d
	@mv -f $*.d $*.d.tmp
	@sed -e 's|.*:|$*.o:|' < $*.d.tmp > $*.d
	@sed -e 's/.*://' -e 's/\\$$//' < $*.d.tmp | fmt -1 | \
	sed -e 's/^ *//' -e 's/$$/:/' >> $*.d
	@rm -f $*.d.tmp
Huang's avatar
   
Huang committed
211

212
213
214
215
ifdef ENABLE_ITTI
$(OBJ) $(RTAI_OBJ): $(ITTI_MESSAGES_H)
endif

216
ifeq ($(RTAI),1)
Huang's avatar
   
Huang committed
217
$(OBJ) $(ASN1_MSG_OBJS1): %.o : %.c
218
219
220
else
$(OBJ) $(ASN1_MSG_OBJS1) lte-enb.o lte-softmodem.o: %.o : %.c
endif
Huang's avatar
   
Huang committed
221
222
	@echo Compiling $< ...
	@$(CC) -c $(CFLAGS) $(EXTRA_CFLAGS) -o $@ $<
223
224
225
226
227
228
	@$(CC) -MM $(CFLAGS) $(EXTRA_CFLAGS) $< > $*.d
	@mv -f $*.d $*.d.tmp
	@sed -e 's|.*:|$*.o:|' < $*.d.tmp > $*.d
	@sed -e 's/.*://' -e 's/\\$$//' < $*.d.tmp | fmt -1 | \
	sed -e 's/^ *//' -e 's/$$/:/' >> $*.d
	@rm -f $*.d.tmp
Huang's avatar
   
Huang committed
229
230
231
232
233
234
235
236
237
238
239

$(USRP_OBJ):$(USRP_FILE_OBJ)
	@echo Compiling openair_usrp.cpp
	@$(CXX) -c $(USRP_CFLAGS) $(USRP_FILE_OBJ) -o $(USRP_OBJ)

condtest: condtest.c 
	$(CC) $(CFLAGS) $(LDFLAGS) condtest.c -o condtest

synctest: $(OBJ) $(ASN1_MSG_OBJS1) $(RTAI_OBJ)
	$(CC) $(CFLAGS) $(LDFLAGS) $(OBJ) $(RTAI_OBJ) $(ASN1_MSG_OBJS1) -o synctest

240
241
242
243
244
lte-softmodem: $(OBJ) $(ASN1_MSG_OBJS1) $(RTAI_OBJ) lte-softmodem.o $(SHARED_DEPENDENCIES)
	@echo Linking $@
	@$(CC) $(CFLAGS) $(EXTRA_CFLAGS) $(OBJ) $(RTAI_OBJ) $(ASN1_MSG_OBJS1) lte-softmodem.o -o lte-softmodem $(LDFLAGS) $(LIBS)

lte-enb: $(OBJ) $(ASN1_MSG_OBJS1) $(RTAI_OBJ) lte-enb.o $(SHARED_DEPENDENCIES)
245
	@echo Linking $@
246
	@$(CC) $(CFLAGS) $(EXTRA_CFLAGS) $(OBJ) $(RTAI_OBJ) $(ASN1_MSG_OBJS1) lte-enb.o -o lte-enb $(LDFLAGS) $(LIBS)
Huang's avatar
   
Huang committed
247

248
249
250
lte-softmodem-usrp: $(OBJ) $(ASN1_MSG_OBJS1) $(RTAI_OBJ) $(USRP_OBJ) $(SHARED_DEPENDENCIES)
	@echo Linking $@
	@$(CC) $(USRP_OBJ) $(CFLAGS) $(OBJ) $(RTAI_OBJ) $(ASN1_MSG_OBJS1) -o lte-softmodem-usrp $(LDFLAGS) $(LIBS)
Huang's avatar
   
Huang committed
251

252
253
254
255
256
OBJ_EMOS = $(OPENAIR_TARGETS)/ARCH/EXMIMO/USERSPACE/LIB/openair0_lib.o rt_wrapper.o $(OPENAIR2_DIR)/UTIL/LOG/log.o $(OPENAIR2_DIR)/UTIL/LOG/vcd_signal_dumper.o
emos-raw: $(SHARED_DEPENDENCIES) $(OBJ_EMOS) emos-raw.c
	@$(CC) $(CFLAGS) $(EXTRA_CFLAGS) $(RTAI_CFLAGS) $(OBJ_EMOS) -o emos-raw emos-raw.c $(LDFLAGS) $(LIBS)


Huang's avatar
   
Huang committed
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
synctest_eNB: synctest
	cp synctest synctest_eNB

synctest_UE: synctest
	cp synctest synctest_UE

drivers:
	cd $(OPENAIR2_DIR) && make clean && make nasmesh_netlink.ko
	cd $(OPENAIR2_DIR)/NAS/DRIVER/MESH/RB_TOOL && make clean && make
	cd $(OPENAIR_TARGETS)/ARCH/EXMIMO/DRIVER/eurecom && make clean && make 
	cd $(OPENAIR_TARGETS)/ARCH/EXMIMO/USERSPACE/OAI_FW_INIT && make clean && make 

run: condtest
	rtai-load condtest --verbose

run_eNB_test: 
	rtai-load eNB_test --verbose

run_eNB: 
	rtai-load eNB --verbose

run_UE: 
	rtai-load UE --verbose

run_UE0:
	rtai-load UE0 --verbose

run_UE0_smbv:
	rtai-load UE0_smbv --verbose

run_UE850:
	rtai-load UE850 --verbose

run_eNB850:
	rtai-load eNB850 --verbose

run_UE0prach:
	rtai-load UE0prach --verbose

run_UE1prach:
	rtai-load UE1prach --verbose

run_UE2prach:
	rtai-load UE2prach --verbose

run_UE0noL2:
	rtai-load UE0noL2 -- verbose

run_UE1noL2: 
	rtai-load UE1noL2 --verbose

run_UE2noL2: 
	rtai-load UE2noL2 --verbose

run_UE0calib:
	rtai-load UE0calib --verbose

run_UE0calibmed:
	rtai-load UE0calibmed --verbose

run_UE0calibbyp:
	rtai-load UE0calibbyp --verbose

run_UE1: 
	rtai-load UE1 --verbose

run_UE2: 
	rtai-load UE2 --verbose

run_eNB0:
	rtai-load eNB0 --verbose

run_eNB1:
	rtai-load eNB1 --verbose

run_eNB2:
	rtai-load eNB2 --verbose

335
336
337
338
clean: common-clean
	@$(RM_F_V) $(OBJ) $(RTAI_OBJ)
	@$(RM_F_V) $(OBJ:.o=.d) $(RTAI_OBJ:.o=.d)
	@$(RM_F_V) $(ASN1_MSG_INC)/asn1_msg.o $(ASN1_MSG_INC)/asn1_msg.d
Huang's avatar
   
Huang committed
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360

cleanasn1:
	rm -f $(ASN1_MSG_OBJS1)
	$(shell cd $(OPENAIR2_DIR)/RRC/LITE/MESSAGES ; rm -f $(ASN_MODULE_SOURCES) $(ASN_MODULE_HEADERS) *.o *.d )
	rm -f $(OPENAIR2_DIR)/RRC/LITE/MESSAGES/Makefile.am.sample
	rm -f $(OPENAIR2_DIR)/RRC/LITE/MESSAGES/Makefile.inc.generated
	rm -f $(OPENAIR2_DIR)/RRC/LITE/MESSAGES/asn1c/ASN1_files/.lock-rel8
	rm -f $(OPENAIR2_DIR)/RRC/LITE/MESSAGES/asn1c/ASN1_files/.lock-rel10

cleancell:
	rm -f $(OPENAIR2_DIR)/RRC/CELLULAR/*.o
	rm -f $(OPENAIR2_DIR)/RRC/CELLULAR/*.d
	rm -f $(OPENAIR2_DIR)/RRC/L2_INTERFACE/*.o
	rm -f $(OPENAIR2_DIR)/RRC/L2_INTERFACE/*.d
	rm -f $(OPENAIR2_DIR)/NAS/SIMU_CELLULAR/*.o
	rm -f $(OPENAIR2_DIR)/NAS/SIMU_CELLULAR/*.d

cleanalmostall: clean 
	rm -f $(ASN1_MSG_OBJS1)
	rm -rf condtest synctest lte-softmodem
	rm -rf synctest_eNB synctest_UE

361
cleanall: common-cleanall clean cleanasn1
Huang's avatar
   
Huang committed
362
363
364
365
366
367
368
369
370
371
372
373
374
	rm -rf condtest synctest lte-softmodem lte-softmodem-usrp
	rm -rf synctest_eNB synctest_UE

show:
	@echo $(CFLAGS)
	@echo $(EXTRA_CFLAGS)
	@echo $(OBJ) $(RTAI_OBJ) 
	@echo $(USRP_OBJ)
	@echo IS_REL8 is $(IS_REL8)
	@echo IS_REL10 is $(IS_REL10)

beautiful:
	astyle --style=gnu -s2 $(SRC)