Makefile 17.2 KB
Newer Older
1 2 3 4 5 6 7 8 9 10 11
CC = gcc
MPICC = gcc #mpicc

CPUFLAGS = -mmmx -msse -msse2 -msse4.1 -march=native
# FORCE ssse3 for compilation of openair on User Mode Linux
CPUFLAGS += $(shell if grep --silent ssse3 /proc/cpuinfo ; then echo "-mssse3" ; else if grep --silent User\ Mode\ Linux /proc/cpuinfo ; then echo "-mssse3" ; else echo ""; fi; fi)
CPUFLAGS += $(shell if grep --silent sse4 /proc/cpuinfo ; then echo "-msse4" ; else echo ""; fi)
linux = $(shell if [ `uname` = "Linux" ] ; then echo "1" ; else echo "0" ; fi)

NUM_CORES=$(shell cat /proc/cpuinfo | grep processor | wc -l)

12 13 14 15 16 17
COMMON_UTILS_DIR    = $(OPENAIR_HOME)/common/utils
TOP_DIR             = $(OPENAIR1_DIR)
OPENAIR1_TOP        = $(OPENAIR1_DIR)
OPENAIR2_TOP        = $(OPENAIR2_DIR)
OPENAIR3_TOP        = $(OPENAIR3_DIR)
OPENAIR3            = $(OPENAIR3_DIR)
18 19 20

CFLAGS = -Wall -fno-strict-aliasing -DUSER_MODE -DNB_ANTENNAS_RX=2 -DNB_ANTENNAS_TXRX=2 -DNB_ANTENNAS_TX=2 -g -ggdb $(CPUFLAGS) -I/usr/include/X11 #-Wno-packed-bitfield-compat

21 22 23 24
ifdef ENABLE_ITTI
CFLAGS += -DENABLE_ITTI
endif

25 26 27 28 29 30 31 32 33 34 35 36
# Check if GCC version is greater or equal to 4.4
GCCVERSIONGTEQ44 := $(shell expr `gcc -dumpversion | cut -f1,2 -d. --output-delimiter=""` \>= 44)
ifeq "$(GCCVERSIONGTEQ44)" "1"
    CFLAGS += -Wno-packed-bitfield-compat
endif

ASN1_MSG_INC = $(OPENAIR2_DIR)/RRC/LITE/MESSAGES

CFLAGS += -DOPENAIR_LTE -DPUCCH #-DOFDMA_ULSCH -DIFFT_FPGA -DIFFT_FPGA_UE
CFLAGS += -DMAC_CONTEXT=1 -DPHY_CONTEXT=1 -DPHY_ABSTRACTION #-DPHY_ABSTRACTION_UL #-DRLC_UM_TEST_TRAFFIC=1
CFLAGS += -DNEW_FFT
#CFLAGS += -DLLR8
37
CFLAGS += -DPACKAGE_NAME='"oaisim"'
38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72
ifndef OPENAIR2
OPENAIR2=1
endif

ifndef OPENAIR_EMU
export OPENAIR_EMU=1
endif

ifdef EMOS
CFLAGS+=-DEMOS
endif

ifdef TRAFFIC_TM5
CFLAGS += -DRLC_UM_TEST_TRAFFIC=1 #-DFULL_BUFFER=1
endif

# activate OCG and libxml only under linux
ifeq ($(linux),1)
CFLAGS += -I/usr/include/libxml2 -L/usr/local/lib -I/usr/include/atlas -L/usr/X11R6/lib
OCG_FLAG = 1
cygwin=0
CFLAGS += -DLINUX
else
cygwin=1
OCG_FLAG = 0
endif

ifdef SMBV
CFLAGS += -DSMBV
endif

ifdef XFORMS
CFLAGS += -DXFORMS
endif

73
ifdef DB
74 75 76 77 78 79
# Check if libmysqlclient is installed and use it if found to store simulation data for postprocessing
ENABLE_DB = $(shell if [ `dpkg -l | grep libmysqlclient -c` = "0" ]; then  echo "0" ; else  echo "1" ; fi )
ifeq ($(ENABLE_DB), 1)
CFLAGS +=-I/usr/include/mysql -L/usr/lib/mysql -DENABLE_DB_STATS
DB_LDFLAGS = -lmysqlclient
endif 
80
endif
81

82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 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 168 169
ifdef PRINT_STATS
CFLAGS += -DPRINT_STATS
endif

ifndef rrc_cellular
rrc_cellular = 0
rrc_cellular_eNB = 0
rrc_cellular_UE = 0
else
  ifeq ($(eNB_flag),1)
    rrc_cellular_eNB=1
  endif
  ifeq ($(UE_flag),1)
    rrc_cellular_UE=1
  endif
endif

ifdef DEBUG_PHY
CFLAGS += -DDEBUG_PHY
endif

ifdef JF
CFLAGS += -DJUMBO_FRAME
endif
ifdef LS
CFLAGS += -DLARGE_SCALE
endif

# ln -sf EUTRA-RRC-Definitions-a20.asn EUTRA-RRC-Definitions.asn
# make cleanasn1
#make all Rel10=1


#export IS_REL10=$(shell if [ -f $(OPENAIR2_DIR)/RRC/LITE/MESSAGES/asn1c/ASN1_files/.lock-rel10 ] ; then  echo "1" ; else  echo "0" ; fi)
#export IS_REL8=$(shell if [ -f $(OPENAIR2_DIR)/RRC/LITE/MESSAGES/asn1c/ASN1_files/.lock-rel8 ] ; then  echo "1" ; else  echo "0" ; fi)

ifdef CBA
CFLAGS += -DRel10
CFLAGS += -DCBA
@echo "Rel10=1 CBA=1"

else ifdef Rel10
CFLAGS += -DRel10
@echo "Rel10=1"
#ifeq ($(IS_REL10), 0)
# $(/bin/bash cd $(OPENAIR2_DIR)/RRC/LITE/MESSAGES/asn1c/ASN1_files/ ; rm EUTRA-RRC-Definitions.asn ln -s EUTRA-RRC-Definitions-a20.asn EUTRA-RRC-Definitions.asn ; cd $(OPENAIR_TARGETS)/SIMU/USER/ ; rm -f $(ASN1_MSG_OBJS1) ; rm -f $(OPENAIR2_DIR)/RRC/LITE/MESSAGES/Makefile.inc.generated ; rm -f $(L2_OBJS) ; rm -f *.o ; rm -f oaisim ; rm -f oaisim_pad; touch $(OPENAIR2_DIR)/RRC/LITE/MESSAGES/asn1c/ASN1_files/.lock-rel10 ; rm $(OPENAIR2_DIR)/RRC/LITE/MESSAGES/asn1c/ASN1_files/.lock-rel8 ; $(OPENAIR_TARGETS)/SCRIPTS/asn1_generate_rrc_messaging_c_code.bash )
#endif
else # default is rel 8
@echo "Rel8=1"
CFLAGS += -DRel8
#ifeq ($(IS_REL8), 0)
# $(/bin/bash cd $(OPENAIR2_DIR)/RRC/LITE/MESSAGES/asn1c/ASN1_files/ ; rm EUTRA-RRC-Definitions.asn ln -s EUTRA-RRC-Definitions-86.asn EUTRA-RRC-Definitions.asn ;  cd $(OPENAIR_TARGETS)/SIMU/USER/ ; rm -f $(ASN1_MSG_OBJS1) ; rm -f $(OPENAIR2_DIR)/RRC/LITE/MESSAGES/Makefile.inc.generated ; rm -f $(L2_OBJS); rm -f *.o ; rm -f oaisim ; touch $(OPENAIR2_DIR)/RRC/LITE/MESSAGES/asn1c/ASN1_files/.lock-rel8 ; rm $(OPENAIR2_DIR)/RRC/LITE/MESSAGES/asn1c/ASN1_files/.lock-rel10 ; $(OPENAIR_TARGETS)/SCRIPTS/asn1_generate_rrc_messaging_c_code.bash )
#endif
endif

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

ifdef TEST_OMG
CFLAGS += -DTEST_OMG
#CFLAGS += -DDEBUG_OMG
endif
# after the execution, a profiling output "gmon.out" will be created,
#then we need to run "gprof ./oaisim > gmon.txt" in the same directory as "gmon.out"
# you could also use the script "grpof2dot.py gmon.txt" for visual diagrams
ifdef GPROF
CFLAGS += -pg
endif

#require kernel patch for oai driver to enable address autoconfiguration (IPv6 only)
ifdef ADDCONF
CFLAGS+=-DADDRCONF
endif

ifdef OAI_NW_DRIVER_TYPE_ETHERNET
CFLAGS+=-DOAI_NW_DRIVER_TYPE_ETHERNET
endif

CFLAGS += $(shell if [ `uname -o` = "Cygwin" ] ; then echo "-DCYGWIN" ;fi)

CFLAGS += -DENABLE_FXP -DOAI_EMU -DENABLE_USE_CPU_EXECUTION_TIME -DXER_PRINT

ifneq ($(USE_MME), R8)
UPDATE_RELEASE_9=1
endif

170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188
ifdef SECU
NETTLE_FOUND = $(shell if pkg-config --exists nettle; then echo "1" ; else echo "0"; fi)
OPENSSL_FOUND = $(shell if pkg-config --exists openssl; then echo "1" ; else echo "0"; fi)

ifeq ($(NETTLE_FOUND), 0)
@echo "Nettle library >= 2.5 is not installed on your system, continuing with security disabled"
SECU=0
else
ifeq ($(OPENSSL_FOUND), 0)
@echo "openssl library is not installed on your system, continuing with security disabled"
SECU=0
else
CFLAGS += -DENABLE_SECURITY
OSA_LDFLAGS += `pkg-config --libs nettle`
OSA_LDFLAGS += `pkg-config --libs openssl`
endif
endif
endif

189
include $(COMMON_UTILS_DIR)/Makefile.inc
190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211
include $(OPENAIR1_DIR)/PHY/Makefile.inc
include $(OPENAIR1_DIR)/SCHED/Makefile.inc
include $(OPENAIR2_DIR)/RRC/LITE/MESSAGES/Makefile.inc
include $(OPENAIR2_DIR)/LAYER2/Makefile.inc
include $(OPENAIR1_DIR)/SIMULATION/ETH_TRANSPORT/Makefile.inc
include $(OPENAIR2_DIR)/RRC/NAS/Makefile.inc
include $(OPENAIR2_DIR)/UTIL/Makefile.inc
include $(OPENAIR2_DIR)/S1AP/Makefile.inc
include $(OPENAIR2_DIR)/S1AP/MESSAGES/Makefile.inc

#LOG_OBJS +=  $(LOG_DIR)/vcd_signal_dumper.o
#LOG_OBJS +=  $(LOG_DIR)/log.o

CFLAGS += -DENB_MODE
S1AP_BUILT_OBJS=

ifdef USE_MME
CFLAGS += -DENABLE_USE_MME
CFLAGS_S1AP += -DENB_MODE -DENABLE_USE_MME -DEMIT_ASN_DEBUG=1 -DUSER_MODE
S1AP_BUILT_OBJS += $(S1AP_OBJS) $(addprefix $(OPENAIR2_DIR)/S1AP/MESSAGES/, $(S1AP_ASN_MODULE_SOURCES))
endif

212 213 214 215 216 217
ITTI_MESSAGES_H = messages_xml.h

ITTI_MESSAGES_XML = messages.xml

ITTI_MESSAGES_FILE =  $(ITTI_DIR)/intertask_interface_types.h

218 219 220 221 222 223 224 225 226 227 228 229 230 231
SIMULATION_OBJS  = $(TOP_DIR)/SIMULATION/TOOLS/gauss.o
SIMULATION_OBJS += $(TOP_DIR)/SIMULATION/TOOLS/random_channel.o
SIMULATION_OBJS += $(TOP_DIR)/SIMULATION/TOOLS/rangen_double.o
SIMULATION_OBJS += $(TOP_DIR)/SIMULATION/TOOLS/taus.o
SIMULATION_OBJS += $(TOP_DIR)/SIMULATION/TOOLS/multipath_channel.o
SIMULATION_OBJS += $(TOP_DIR)/SIMULATION/TOOLS/abstraction.o
SIMULATION_OBJS += $(TOP_DIR)/SIMULATION/RF/rf.o
SIMULATION_OBJS += $(TOP_DIR)/SIMULATION/RF/adc.o
SIMULATION_OBJS += $(TOP_DIR)/SIMULATION/RF/dac.o

ASN1_MSG_OBJS1=$(addprefix $(OPENAIR2_DIR)/RRC/LITE/MESSAGES/, $(ASN1_MSG_OBJS))
#L2_OBJS =
#EXTRA_CFLAGS =

232 233 234 235 236 237 238 239 240 241
OAISIM_OBJS_COMMON = channel_sim.o
OAISIM_OBJS_COMMON += init_lte.o
OAISIM_OBJS_COMMON += oaisim_config.o
OAISIM_OBJS_COMMON += sinr_sim.o
OAISIM_OBJS_COMMON += cor_SF_sim.o
#OAISIM_OBJS_COMMON += phy_procedures_sim_form.o
OAISIM_OBJS_COMMON += oaisim_functions.o

OAISIM_OBJS = oaisim.o

242 243 244 245 246 247 248 249
ifdef XFORMS
TOOLS_OBJS += $(OPENAIR1_DIR)/PHY/TOOLS/lte_phy_scope.o
endif

ifdef PAD
CFLAGS += -DPAD
endif

250
OAISIM_PAD_OBJS =  discrete_event_generator.o
251
OAISIM_PAD_OBJS += threadpool.o
252
OAISIM_PAD_OBJS += oaisim_pad.o
253 254 255 256 257 258 259 260 261 262 263 264
#deactivate the log offloading 
ifndef LOG_THREAD
CFLAGS +=-DLOG_NO_THREAD
endif

ifdef PROC
INT_OBJS +=$(OPENAIR_TARGETS)/SIMU/PROC/channel_sim_proc.o
INT_OBJS +=$(OPENAIR_TARGETS)/SIMU/PROC/Process.o
CFLAGS +=-DPROC
endif

CFLAGS += -DENABLE_VCD_FIFO
Cedric Roux's avatar
Cedric Roux committed
265
CFLAGS += -DENABLE_NEW_MULTICAST
266
ifdef NAS
267
CFLAGS += -DENABLE_PDCP_NETLINK_FIFO
268
endif
269 270
# CFLAGS += -DENABLE_LOG_FIFO

271 272 273 274 275 276 277 278
# Check if libpgm is installed and use it if found instead of the unreliable
# multicast
ENABLE_PGM = $(shell if pkg-config --exists openpgm-5.1; then echo "1" ; else echo "0"; fi)
ifeq ($(ENABLE_PGM), 1)
CFLAGS += `pkg-config --cflags openpgm-5.1` -DENABLE_PGM_TRANSPORT
PGM_LDFLAGS = `pkg-config --libs openpgm-5.1`
endif

279
OBJ = $(PHY_OBJS) $(SIMULATION_OBJS) $(ETHERNET_TRANSPORT_OBJS) $(TOOLS_OBJS) $(SCHED_OBJS) $(STATS_OBJS) $(NAS_OBJS) $(INT_OBJS) $(UTIL_OBJ) $(UTILS_OBJS) $(OAISIM_OBJS_COMMON) 
280 281 282 283
ifeq ($(OPENAIR2),1)
OBJ += $(L2_OBJS)
endif

284 285 286 287 288 289 290 291
LIB =  $(LFDS_DIR)/bin/liblfds611.a
ifdef USE_MME
LIB += $(S1AP_DIR)/libs1ap.a
endif

default: oaisim

all: oaisim pad
292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307

pad: oaisim_pad

userclean: cleanall oaisim

printvars:
	@echo LINUX variable is $(linux)
	@echo CYGWIN variable is $(cygwin)
	@echo rrc_cellular variable is $(rrc_cellular)
	@echo EXTRA_CFLAGS = $(EXTRA_CFLAGS)
	@echo OAI Config generator is $(OCG_FLAG)
	@echo OAI NETLINK FLAG is $(NAS_FLAG)
	@echo SSE3 proc is $(SSE3PROC)
	@echo L2 objs are $(L2_OBJS)
	@echo eNB_flag is $(eNB_flag)
	@echo UE_flag is $(UE_flag)
308 309 310
	@echo S1AP objs: $(S1AP_BUILT_OBJS)
	@echo CFLAGS: $(CFLAGS)
	@echo Enable PGM: $(ENABLE_PGM)
311 312 313 314 315 316 317 318 319 320 321

ASN1RELDIR=R9.8
ifeq ($(USE_MME), R8)
	ASN1RELDIR=R8.10
else
	CFLAGS_S1AP += -DUPDATE_RELEASE_9
endif
S1AP_DIR=$(OPENAIR2_DIR)/S1AP
ASN1MESSAGESDIR=$(S1AP_DIR)/MESSAGES
ASN1DIR=$(ASN1MESSAGESDIR)/ASN1

322
-include $(ITTI_MESSAGES_XML:.xml=.d)
323
-include $(OBJ:.o=.d)
324 325
-include $(OAISIM_OBJS:.o=.d)
-include $(OAISIM_PAD_OBJS:.o=.d)
326 327
-include $(ASN1_MSG_OBJS1:.o=.d)

328
$(ITTI_MESSAGES_XML): $(ITTI_MESSAGES_FILE)
329 330
	@echo "Generating messages.xml ..."
	@gccxml $(L2_incl) $(UTILS_incl) $< -fxml=$@
331 332 333 334 335 336
	@$(CC) -MM $(L2_incl) $(UTILS_incl) $< > $(basename $@).d
	@mv -f $(basename $@).d $(basename $@).d.tmp
	@sed -e 's|.*:|$@:|' < $(basename $@).d.tmp > $(basename $@).d
	@sed -e 's/.*://' -e 's/\\$$//' < $(basename $@).d.tmp | fmt -1 | \
	sed -e 's/^ *//' -e 's/$$/:/' >> $(basename $@).d
	@rm -f $(basename $@).d.tmp
337

338 339 340 341 342 343 344 345 346
$(ITTI_MESSAGES_H): $(ITTI_MESSAGES_XML)
	@echo "Generating messages_xml.h ..."
	@sed -e 's/[ ]*//' -e 's/"/\\"/g' -e 's/^/"/' -e 's/$$/"/' $< > $@

$(OAISIM_OBJS): $(ITTI_MESSAGES_H)

oaisim_pad.o: $(ITTI_MESSAGES_H)

$(OBJ) $(OAISIM_OBJS) $(OAISIM_PAD_OBJS) $(ASN1_MSG_OBJS1): %.o : %.c
347
	@echo Compiling $<
348 349
	@$(CC) -c $(CFLAGS) $(EXTRA_CFLAGS) -DPHY_CONTEXT=1 -I$(TOP_DIR) $(L2_incl) $(UTIL_incl) $(UTILS_incl) -I$(ASN1_MSG_INC) -o $@ $<
	@$(CC) -MM $(CFLAGS) $(EXTRA_CFLAGS) -DPHY_CONTEXT=1 -I$(TOP_DIR) $(L2_incl) $(UTIL_incl) $(UTILS_incl) -I$(ASN1_MSG_INC) $*.c > $*.d
350 351 352 353 354 355 356 357
	@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

$(S1AP_BUILT_OBJS): %.o : %.c
	@echo Compiling $<
358
	@$(CC) -Wall -c $(CFLAGS_S1AP) $(S1AP_Incl) $(UTIL_incl) $(UTILS_incl) -o $@ $<
359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374

$(ASN1MESSAGESDIR)/s1ap_ieregen.stamp: $(ASN1DIR)/$(ASN1RELDIR)/S1AP-PDU-Contents.asn $(ASN1DIR)/asn1tostruct.py
	echo Timestamp > $@
	(cd $(ASN1DIR) && python $(ASN1DIR)/asn1tostruct.py -f$<)

$(ASN1MESSAGESDIR)/s1ap_asn1regen.stamp: $(ASN1DIR)/$(ASN1RELDIR)/S1AP-CommonDataTypes.asn $(ASN1DIR)/$(ASN1RELDIR)/S1AP-Constants.asn $(ASN1DIR)/$(ASN1RELDIR)/S1AP-IEs.asn $(ASN1DIR)/$(ASN1RELDIR)/S1AP-PDU.asn
	echo Timestamp > $@
	(cd $(ASN1MESSAGESDIR) && asn1c -gen-PER -fnative-types -fskeletons-copy $^)

$(S1AP_DIR)/libs1ap.a: $(ASN1MESSAGESDIR)/s1ap_ieregen.stamp $(ASN1MESSAGESDIR)/s1ap_asn1regen.stamp $(S1AP_BUILT_OBJS)
	@echo Creating $@
	$(AR) rcs $@ $^

$(LFDS_DIR)/bin/liblfds611.a:
	$(MAKE) -C $(LFDS_DIR) -f makefile.linux

375
oaisim_pad: $(OBJ) $(OAISIM_PAD_OBJS) $(ASN1_MSG_OBJS1)
376
	@echo "Linking oaisim_pad ..."
377
	@$(MPICC) -I$(TOP_DIR) $(L2_incl) $(UTIL_incl) $(UTILS_incl) -I$(ASN1_MSG_INC) $(S1AP_Incl) -o oaisim_pad $(CFLAGS) $(EXTRA_CFLAGS) $(OBJ) $(OAISIM_PAD_OBJS) $(ASN1_MSG_OBJS1) \
378 379
	 -lm -lblas -lpthread -llapack_atlas -lforms -lxml2 -lX11 -lXpm -lrt

380
oaisim: $(OBJ) $(OAISIM_OBJS) $(ASN1_MSG_OBJS1) $(LIB)
381 382
	@echo "Linking oaisim ..."
	@$(CC) -I$(TOP_DIR) $(L2_incl) $(UTIL_incl) $(UTILS_incl) -I$(ASN1_MSG_INC) $(S1AP_Incl) -o oaisim $(CFLAGS) $(EXTRA_CFLAGS) $(OBJ) $(OAISIM_OBJS) $(ASN1_MSG_OBJS1) \
383
	-lm -lblas -lpthread -llapack_atlas -lforms -lxml2 -lX11 -lXpm -lrt \
384
	$(LIB) $(PGM_LDFLAGS) $(DB_LDFLAGS) $(OSA_LDFLAGS)
385 386 387 388 389 390 391 392

ifeq ($(rrc_cellular_eNB),1)
	mv oaisim oaisim_eNB
endif
ifeq ($(rrc_cellular_UE),1)
	mv oaisim oaisim_UE
endif

393
oaisimCROWN: $(OBJ) $(ASN1_MSG_OBJS1) oaisimCROWN.c
394
	@echo "Compiling oaisimCROWN.c ..."
395
	@$(CC) oaisimCROWN.c -I$(TOP_DIR) $(L2_incl) $(UTIL_incl) $(UTILS_incl) -I$(ASN1_MSG_INC) $(S1AP_Incl) -o oaisimCROWN $(CFLAGS) $(EXTRA_CFLAGS) $(OBJ) $(ASN1_MSG_OBJS1) -lm -lblas -lpthread -llapack_atlas -lforms -lxml2 -lX11 -lXpm -lrt 
396 397

test_nasmesh_fix:
398 399
	(cd $(OPENAIR2_DIR)/NAS/DRIVER/MESH/RB_TOOL && $(MAKE))
	(cd $(OPENAIR2_DIR) && $(MAKE) nasmesh_netlink_address_fix.ko)
400 401
	(cp $(OPENAIR2_DIR)/NAS/DRIVER/MESH/nasmesh.ko . )
nasmesh_fix:
402 403
	(cd $(OPENAIR2_DIR)/NAS/DRIVER/MESH/RB_TOOL && $(MAKE))
	(cd $(OPENAIR2_DIR) && $(MAKE) nasmesh_netlink_address_fix.ko)
404 405
	(sudo insmod $(OPENAIR2_DIR)/NAS/DRIVER/MESH/nasmesh.ko)
nasmesh_nl:
406 407
	(cd $(OPENAIR2_DIR)/NAS/DRIVER/MESH/RB_TOOL && $(MAKE))
	(cd $(OPENAIR2_DIR) && $(MAKE) nasmesh_netlink.ko)
408 409
	(sudo insmod $(OPENAIR2_DIR)/NAS/DRIVER/MESH/nasmesh.ko)
rb_tool:
410
	(cd $(OPENAIR2_DIR)/NAS/DRIVER/MESH/RB_TOOL && $(MAKE))
411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429

nasmesh_install:
	(sudo rmmod nasmesh)
	(sudo insmod $(OPENAIR2_DIR)/NAS/DRIVER/MESH/nasmesh.ko)

nas_sim_mt_cellular:
	( cd $(OPENAIR2_DIR)/NAS/SIMU_CELLULAR && make nasmt_sim CELLULAR=1 NO_RRM=1)

nas_sim_rg_cellular:
	( cd $(OPENAIR2_DIR)/NAS/SIMU_CELLULAR && make nasrg_sim MASTER=1 CELLULAR=1 NO_RRM=1)

rrm_std_cellular:
	( cd $(OPENAIR2_DIR)/NAS/SIMU_CELLULAR && make cell_rrm CELL_RRM=1 CELLULAR=1 NO_RRM=1)


cleanall: clean cleanasn1 cleanmmeasn1

clean:
	$(MAKE) -C $(LFDS_DIR) -f makefile.linux clean
430 431 432 433 434 435 436 437 438 439 440
	@rm -f -v oaisim
	@rm -f -v oaisim_pad
	@rm -f -v $(ITTI_MESSAGES_H) $(ITTI_MESSAGES_XML) $(ITTI_MESSAGES_XML:.xml=.d)
	@rm -f -v $(OBJ) $(OBJ:.o=.d)
	@rm -f -v $(OAISIM_OBJS) $(OAISIM_OBJS:.o=.d)
	@rm -f -v $(OAISIM_PAD_OBJS) $(OAISIM_PAD_OBJS:.o=.d)
	@rm -f -v $(ASN1_MSG_OBJS1) $(ASN1_MSG_OBJS1:.o=.d)
	@rm -f -v $(S1AP_BUILT_OBJS)
	@rm -f -v $(ASN1MESSAGESDIR)/libs1ap.a
	@rm -f -v *.exe*
	@rm -f -v $(ASN1_MSG_INC)/asn1_msg.o
441 442

cleanl1:
443 444 445 446
	@rm -f -v LOG_THREAD oaisim
	@rm -f -v $(PHY_OBJS) $(SCHED_OBJS)
	@rm -f -v *.o
	@rm -f -v *.exe
447 448

cleanl2:
449 450
	@rm -f -v $(L2_OBJS)
	@rm -f -v $(ASN1_MSG_INC)/asn1_msg.o
451 452

cleanasn1:
453 454 455 456 457 458
	@rm -f -v $(ASN1_MSG_OBJS1)
	@$(shell cd $(OPENAIR2_DIR)/RRC/LITE/MESSAGES ; rm -f -v $(ASN_MODULE_SOURCES) $(ASN_MODULE_HEADERS) *.o *.d )
	@rm -f -v $(OPENAIR2_DIR)/RRC/LITE/MESSAGES/Makefile.am.sample
	@rm -f -v $(OPENAIR2_DIR)/RRC/LITE/MESSAGES/Makefile.inc.generated
	@rm -f -v $(OPENAIR2_DIR)/RRC/LITE/MESSAGES/asn1c/ASN1_files/.lock-rel10
	@rm -f -v $(OPENAIR2_DIR)/RRC/LITE/MESSAGES/asn1c/ASN1_files/.lock-rel8
459 460

cleanmmeasn1:
461 462 463 464 465
	@rm -f -v $(S1AP_BUILT_OBJS)
	@rm -f -v $(S1AP_BUILT_OBJS:.o:.c)
	@rm -f -v $(ASN1MESSAGESDIR)/libs1ap.a
	@rm -f -v $(ASN1MESSAGESDIR)/s1ap_asn1regen.stamp
	@rm -f -v $(ASN1MESSAGESDIR)/s1ap_ieregen.stamp
466 467

cleancell:
468 469 470 471 472 473
	@rm -f -v $(OPENAIR2_DIR)/RRC/CELLULAR/*.o
	@rm -f -v $(OPENAIR2_DIR)/RRC/CELLULAR/*.d
	@rm -f -v $(OPENAIR2_DIR)/RRC/L2_INTERFACE/*.o
	@rm -f -v $(OPENAIR2_DIR)/RRC/L2_INTERFACE/*.d
	@rm -f -v $(OPENAIR2_DIR)/NAS/SIMU_CELLULAR/*.o
	@rm -f -v $(OPENAIR2_DIR)/NAS/SIMU_CELLULAR/*.d
474 475

print:
476
#	@echo $(cygwin)
477 478 479 480 481 482 483 484 485 486 487 488 489 490
	@echo "OBJ " 				$(OBJ)
	@echo "OAISIM_OBJS " 		$(OAISIM_OBJS)
	@echo "OAISIM_PAD_OBJS " 	$(OAISIM_PAD_OBJS)
	@echo "OCG_FLAG are "		$(OCG_FLAG)
	@echo "CFLAGS are "      	$(CFLAGS)
	@echo "EXTRA_CFLAGS are" 	$(EXTRA_CFLAGS)
	@echo "L2 includes are"	    $(L2_incl)
	@echo "S1AP Includes are"   $(S1AP_Incl)
	@echo "TOP_DIR Include is"  I$(TOP_DIR)
	@echo "UTIL includes are"	$(UTIL_incl)
	@echo "UTILS includes are"	$(UTILS_incl)
	@echo "IS_REL8 is "      	$(IS_REL8)
	@echo "IS_REL10 is "     	$(IS_REL10)
	@echo "ENABLE_DB is "    	$(ENABLE_DB)
491 492 493 494

showcflags:
	@echo $(CFLAGS)

495
otg_all: otg_latency otg_gp
496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511

# need to check if the file exists before calling otgplot
otg_latency:
	export TITLE="Application OWD(ms)" 
	cp /tmp/otg_latency.dat /tmp/onewaydelay.dat	
	$(OPENAIR2_DIR)/UTIL/OTG/OTGplot "/tmp/otg_latency.dat" "[$(COL1):$(COL2)]"
otg_latency_bg:
	export TITLE="Background OWD(ms)" 
	$(OPENAIR2_DIR)/UTIL/OTG/OTGplot "/tmp/otg_latency_bg.dat" "[$(COL1):$(COL2)]"
otg_gp:
	export TITLE="Application Goodput(Kb/s)" 
	cp /tmp/otg_GP.dat /tmp/goodput.dat
	$(OPENAIR2_DIR)/UTIL/OTG/OTGplot "/tmp/goodput.dat" "[$(COL1):$(COL2)]"
otg_gp_bg:
	export TITLE="Background Goodput(Kb/s)" 
	$(OPENAIR2_DIR)/UTIL/OTG/OTGplot "/tmp/otg_GP_bg.dat" "[$(COL1):$(COL2)]"
512 513 514
otg_jitter:
	export TITLE="Aplication Jitter(ms)" 
	$(OPENAIR2_DIR)/UTIL/OTG/OTGplot "/tmp/otg_jitter.dat" "[$(COL1):$(COL2)]"
515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531

pexpect = $(shell if [ `dpkg -l | grep pexpect -c` = "0" ]; then  echo "0" ; else  echo "1" ; fi )

pre-ci: 
	@echo "Pre-commit check"

ifeq 	($(pexpect), 1) 
ifndef	PW
	@echo "Usage: make pre-ci PW=mypassword"
	@echo "Password is used to access the local host through ssh."
	python $(OPENAIR_TARGETS)/TEST/OAI/test01.py 
else
	python $(OPENAIR_TARGETS)/TEST/OAI/test01.py -w $(PW)
endif
else
	@echo "Python pexpect package is missing, please install"
endif