Commit daa3c358 authored by Cedric Roux's avatar Cedric Roux

- oaisim object files (almost all) are now generated in a separate directory (objs under SIMU/USER)

git-svn-id: http://svn.eurecom.fr/openair4G/trunk@4488 818b1a75-f10b-46b9-bf7c-635c3b92a50f
parent f9cf83a6
include $(OPENAIR_TARGETS)/SIMU/USER/Makerules
S1AP_OBJDIR = $(S1AP_DIR)/enb_objs
OUTDIR = $(S1AP_DIR)/enb_objs
ASN1MESSAGESDIR=$(S1AP_DIR)/MESSAGES
ASN1DIR=$(ASN1MESSAGESDIR)/ASN1
......@@ -24,9 +24,6 @@ include $(ASN1MESSAGESDIR)/Makefile.inc
libs1ap_OBJECTS = \
s1ap_eNB.o s1ap_common.o \
$(S1AP_OBJDIR)/s1ap_encoder.o \
$(S1AP_OBJDIR)/s1ap_decoder.o \
$(S1AP_OBJDIR)/s1ap_xer_print.o \
s1ap_eNB_itti_messaging.o \
s1ap_eNB_decoder.o \
s1ap_eNB_encoder.o \
......@@ -47,7 +44,7 @@ else
endif
# pull in dependency info for *existing* .o files
-include *.d
-include $(OUTDIR)/*.d
CFLAGS = \
-Wall \
......@@ -56,7 +53,7 @@ CFLAGS = \
-DEMIT_ASN_DEBUG=1 \
-DUSER_MODE \
-I./MESSAGES \
-I$(S1AP_OBJDIR) \
-I$(OUTDIR) \
-I../UTILS \
$(ADD_CFLAGS) \
-DENB_MODE \
......@@ -64,52 +61,69 @@ CFLAGS = \
-Wuninitialized \
-Werror=implicit-function-declaration
$(libs1ap_OBJECTS): %.o : %.c
S1AP_GENERATED = \
$(OUTDIR)/s1ap_encoder.o \
$(OUTDIR)/s1ap_decoder.o \
$(OUTDIR)/s1ap_xer_print.o
$(OUTDIR)/%.o : %.c
@echo "Compiling $<"
@if [ ! -d $(dir $@) ]; then mkdir -p $(dir $@); fi;
@$(CC) -c $(CFLAGS) -o $@ $<
@$(CC) -MM $(CFLAGS) $< > $(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
$(S1AP_GENERATED): %.o : %.c
@echo "Compiling $<"
@if [ ! -d $(dir $@) ]; then mkdir -p $(dir $@); fi;
@$(CC) -c $(CFLAGS) -o $@ $<
@$(CC) -MM $(CFLAGS) $*.c > $*.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
$(S1AP_OBJDIR)/s1ap_ieregen.stamp: $(ASN1DIR)/$(ASN1RELDIR)/S1AP-PDU-Contents.asn $(ASN1DIR)/asn1tostruct.py
mkdir -p $(S1AP_OBJDIR)
python $(ASN1DIR)/asn1tostruct.py -f$< -o$(S1AP_OBJDIR)
echo Timestamp > $@
$(S1AP_OBJDIR)/s1ap_asn1regen.stamp: $(ASN1DIR)/$(ASN1RELDIR)/S1AP-CommonDataTypes.asn \
@$(CC) -MM $(CFLAGS) $< > $(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
$(OUTDIR)/s1ap_ieregen.stamp: $(ASN1DIR)/$(ASN1RELDIR)/S1AP-PDU-Contents.asn $(ASN1DIR)/asn1tostruct.py
@if [ ! -d $(OUTDIR) ]; then mkdir -p $(OUTDIR); fi;
@python $(ASN1DIR)/asn1tostruct.py -f$< -o$(OUTDIR)
@echo Timestamp > $@
$(OUTDIR)/s1ap_asn1regen.stamp: $(ASN1DIR)/$(ASN1RELDIR)/S1AP-CommonDataTypes.asn \
$(ASN1DIR)/$(ASN1RELDIR)/S1AP-Constants.asn $(ASN1DIR)/$(ASN1RELDIR)/S1AP-IEs.asn $(ASN1DIR)/$(ASN1RELDIR)/S1AP-PDU.asn
(cd $(ASN1MESSAGESDIR) && asn1c -fhave_native64 -gen-PER $^)
echo Timestamp > $@
@echo Timestamp > $@
libs1ap.a: $(S1AP_OBJDIR)/s1ap_ieregen.stamp $(S1AP_OBJDIR)/s1ap_asn1regen.stamp $(libs1ap_OBJECTS)
$(OUTDIR)/libs1ap.a: | $(OUTDIR)/s1ap_ieregen.stamp $(OUTDIR)/s1ap_asn1regen.stamp $(S1AP_GENERATED) $(addprefix $(OUTDIR)/,$(libs1ap_OBJECTS))
@echo Creating S1AP archive
@$(AR) rcs $@ $(libs1ap_OBJECTS)
@$(AR) rcs $@ $(S1AP_GENERATED) $(addprefix $(OUTDIR)/,$(libs1ap_OBJECTS))
clean:
@$(RM_F_V) $(libs1ap_OBJECTS)
@$(RM_F_V) *.d
@$(RM_F_V) $(addprefix MESSAGES/, $(S1AP_ASN_MODULE_SOURCES))
@$(RM_F_V) $(addprefix MESSAGES/, $(S1AP_ASN_MODULE_SOURCES_R9))
@$(RM_F_V) $(addprefix MESSAGES/, $(S1AP_ASN_MODULE_SOURCES_R10))
@$(RM_F_V) $(addprefix MESSAGES/, $(S1AP_ASN_MODULE_SOURCES:.o=.d))
@$(RM_F_V) $(addprefix MESSAGES/, $(S1AP_ASN_MODULE_SOURCES_R9:.o=.d))
@$(RM_F_V) $(addprefix MESSAGES/, $(S1AP_ASN_MODULE_SOURCES_R10:.o=.d))
@$(RM_F_V) libs1ap.a
@$(RM_F_V) $(S1AP_OBJDIR)/s1ap_asn1regen.stamp
@$(RM_F_V) $(S1AP_OBJDIR)/s1ap_ieregen.stamp
@$(RM_F_V) $(S1AP_OBJDIR)/s1ap_decoder.c $(S1AP_OBJDIR)/s1ap_encoder.c
@$(RM_F_V) $(S1AP_OBJDIR)/s1ap_xer_print.c $(S1AP_OBJDIR)/s1ap_ies_defs.h
@$(RM_F_V) $(OUTDIR)/*.o
@$(RM_F_V) $(OUTDIR)/*.d
@$(RM_F_V) $(addprefix $(OUTDIR)/MESSAGES/, $(S1AP_ASN_MODULE_SOURCES))
@$(RM_F_V) $(addprefix $(OUTDIR)/MESSAGES/, $(S1AP_ASN_MODULE_SOURCES_R9))
@$(RM_F_V) $(addprefix $(OUTDIR)/MESSAGES/, $(S1AP_ASN_MODULE_SOURCES_R10))
@$(RM_F_V) $(addprefix $(OUTDIR)/MESSAGES/, $(S1AP_ASN_MODULE_SOURCES:.o=.d))
@$(RM_F_V) $(addprefix $(OUTDIR)/MESSAGES/, $(S1AP_ASN_MODULE_SOURCES_R9:.o=.d))
@$(RM_F_V) $(addprefix $(OUTDIR)/MESSAGES/, $(S1AP_ASN_MODULE_SOURCES_R10:.o=.d))
@$(RM_F_V) $(OUTDIR)/libs1ap.a
@$(RM_F_V) $(OUTDIR)/s1ap_asn1regen.stamp
@$(RM_F_V) $(OUTDIR)/s1ap_ieregen.stamp
@$(RM_F_V) $(OUTDIR)/s1ap_decoder.c $(OUTDIR)/s1ap_encoder.c
@$(RM_F_V) $(OUTDIR)/s1ap_xer_print.c $(OUTDIR)/s1ap_ies_defs.h
cleanall: clean
@$(RM_F_V) $(addprefix MESSAGES/, $(S1AP_ASN_MODULE_SOURCES:.o=.c))
@$(RM_F_V) $(addprefix MESSAGES/, $(S1AP_ASN_MODULE_SOURCES:.o=.h))
@$(RM_F_V) $(addprefix MESSAGES/, $(S1AP_ASN_MODULE_SOURCES_R9:.o=.c))
@$(RM_F_V) $(addprefix MESSAGES/, $(S1AP_ASN_MODULE_SOURCES_R9:.o=.h))
@$(RM_F_V) $(addprefix MESSAGES/, $(S1AP_ASN_MODULE_SOURCES_R10:.o=.c))
@$(RM_F_V) $(addprefix MESSAGES/, $(S1AP_ASN_MODULE_SOURCES_R10:.o=.h))
@$(RM_F_V) $(addprefix $(OUTDIR)/MESSAGES/, $(S1AP_ASN_MODULE_SOURCES:.o=.c))
@$(RM_F_V) $(addprefix $(OUTDIR)/MESSAGES/, $(S1AP_ASN_MODULE_SOURCES:.o=.h))
@$(RM_F_V) $(addprefix $(OUTDIR)/MESSAGES/, $(S1AP_ASN_MODULE_SOURCES_R9:.o=.c))
@$(RM_F_V) $(addprefix $(OUTDIR)/MESSAGES/, $(S1AP_ASN_MODULE_SOURCES_R9:.o=.h))
@$(RM_F_V) $(addprefix $(OUTDIR)/MESSAGES/, $(S1AP_ASN_MODULE_SOURCES_R10:.o=.c))
@$(RM_F_V) $(addprefix $(OUTDIR)/MESSAGES/, $(S1AP_ASN_MODULE_SOURCES_R10:.o=.h))
showcflags:
@echo s1ap cflags: $(CFLAGS)
\ No newline at end of file
include $(OPENAIR_TARGETS)/SIMU/USER/Makerules
OUTDIR = .
libsctp_OBJECTS = \
sctp_common.o \
sctp_eNB_task.o \
sctp_eNB_itti_messaging.o
# pull in dependency info for *existing* .o files
-include *.d
-include $(OUTDIR)/*.d
CFLAGS = \
-Wall \
$(S1AP_CFLAGS) \
-I../SCTP \
-DENB_MODE \
-Werror=uninitialized \
-Werror=implicit-function-declaration
$(libsctp_OBJECTS): %.o : %.c
$(OUTDIR)/%.o : %.c
@echo "Compiling $<"
@if [ ! -d $(dir $@) ]; then mkdir -p $(dir $@); fi;
@$(CC) -c $(CFLAGS) -o $@ $<
@$(CC) -MM $(CFLAGS) $*.c > $*.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
libsctp.a: $(libsctp_OBJECTS)
@$(CC) -MM $(CFLAGS) $< > $(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
objsdir:
@if [ ! -d $(OUTDIR) ]; then mkdir -p $(OUTDIR); fi;
$(OUTDIR)/libsctp.a: $(addprefix $(OUTDIR)/,$(libsctp_OBJECTS))
@echo Creating SCTP archive
@$(AR) rcs $@ $(libsctp_OBJECTS)
@$(AR) rcs $@ $(addprefix $(OUTDIR)/,$(libsctp_OBJECTS))
clean:
@$(RM_F_V) $(libsctp_OBJECTS)
@$(RM_F_V) *.d
@$(RM_F_V) libsctp.a
\ No newline at end of file
@$(RM_F_V) $(OUTDIR)/*.o
@$(RM_F_V) $(OUTDIR)/*.d
@$(RM_F_V) $(OUTDIR)/libsctp.a
\ No newline at end of file
##### paths #####
BINDIR = bin
OUTDIR := .
BINDIR = $(OUTDIR)/bin
OBJDIR = $(OUTDIR)/obj
INCDIR = inc
OBJDIR = obj
SRCDIR = src
##### misc #####
......@@ -10,6 +11,7 @@ QUIETLY = 1>/dev/null 2>/dev/null
##### sources, objects and libraries #####
BINNAME = liblfds611
AR_BINARY = $(BINDIR)/$(BINNAME).a
$(info $(AR_BINARY))
SO_BINARY = $(BINDIR)/$(BINNAME).so
SRCDIRS = lfds611_abstraction lfds611_freelist lfds611_liblfds lfds611_queue lfds611_ringbuffer lfds611_slist lfds611_stack
# TRD : be aware - in the linux makefile, with the one-pass linking behaviour of the GNU linker, the order
......@@ -76,14 +78,17 @@ vpath %.c $(patsubst %,$(SRCDIR)/%:,$(SRCDIRS))
##### implicit rules #####
$(OBJDIR)/%.o : %.c
$(DG) $(DGFLAGS) $< >$(OBJDIR)/$*.d
$(CC) $(CFLAGS) -o $@ $<
@echo "Compiling $<"
@$(DG) $(DGFLAGS) $< >$(OBJDIR)/$*.d
@$(CC) $(CFLAGS) -o $@ $<
##### explicit rules #####
$(AR_BINARY) : $(OBJECTS)
$(AR) $(AFLAGS) $(AR_BINARY) $(OBJECTS)
@echo "Creating $(AR_BINARY)"
@$(AR) $(AFLAGS) $(AR_BINARY) $(OBJECTS)
$(SO_BINARY) : $(OBJECTS)
@echo "Creating $(SO_BINARY)"
$(LD) $(LFLAGS) $(SYSLIBS) $(OBJECTS) -o $(SO_BINARY)
##### phony #####
......
......@@ -16,11 +16,13 @@ OPENAIR3 = $(OPENAIR3_DIR)
S1AP_DIR = $(OPENAIR_HOME)/openair-cn/S1AP
SCTP_DIR = $(OPENAIR_HOME)/openair-cn/SCTP
S1AP_OBJ_DIR = $(subst $(OPENAIR_HOME),$(OBJS_DIR),$(S1AP_DIR))
SCTP_OBJ_DIR = $(subst $(OPENAIR_HOME),$(OBJS_DIR),$(SCTP_DIR))
export S1AP_DIR
export COMMON_UTILS_DIR
CFLAGS = -O2 -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
CFLAGS = $(COMMON_CFLAGS) -DUSER_MODE -DNB_ANTENNAS_RX=2 -DNB_ANTENNAS_TXRX=2 -DNB_ANTENNAS_TX=2 $(CPUFLAGS) -I/usr/include/X11 #-Wno-packed-bitfield-compat
ifdef ENABLE_ITTI
CFLAGS += -DENABLE_ITTI
......@@ -60,7 +62,7 @@ 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
CFLAGS += $(LIBXML2_CFLAGS) -L/usr/local/lib -I/usr/include/atlas -L/usr/X11R6/lib
OCG_FLAG = 1
cygwin=0
CFLAGS += -DLINUX
......@@ -187,8 +189,7 @@ ifeq ($(OPENSSL_FOUND), 0)
SECU=0
else
CFLAGS += -DENABLE_SECURITY
OSA_LDFLAGS += `pkg-config --libs nettle`
OSA_LDFLAGS += `pkg-config --libs openssl`
LIBS += $(OPENSSL_LIBS) $(NETTLE_LIBS)
endif
endif
endif
......@@ -204,9 +205,6 @@ 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
ITTI_MESSAGES_H = messages_xml.h
ITTI_MESSAGES_XML = messages.xml
......@@ -224,16 +222,13 @@ 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 =
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_COMMON = $(OPENAIR_TARGETS)/SIMU/USER/channel_sim.o
OAISIM_OBJS_COMMON += $(OPENAIR_TARGETS)/SIMU/USER/init_lte.o
OAISIM_OBJS_COMMON += $(OPENAIR_TARGETS)/SIMU/USER/oaisim_config.o
OAISIM_OBJS_COMMON += $(OPENAIR_TARGETS)/SIMU/USER/sinr_sim.o
OAISIM_OBJS_COMMON += $(OPENAIR_TARGETS)/SIMU/USER/cor_SF_sim.o
OAISIM_OBJS_COMMON += $(OPENAIR_TARGETS)/SIMU/USER/oaisim_functions.o
OAISIM_OBJS = oaisim.o
......@@ -245,18 +240,18 @@ ifdef PAD
CFLAGS += -DPAD
endif
OAISIM_PAD_OBJS = discrete_event_generator.o
OAISIM_PAD_OBJS += threadpool.o
OAISIM_PAD_OBJS += oaisim_pad.o
OAISIM_PAD_OBJS = $(OPENAIR_TARGETS)/SIMU/USER/discrete_event_generator.o
OAISIM_PAD_OBJS += $(OPENAIR_TARGETS)/SIMU/USER/threadpool.o
OAISIM_PAD_OBJS += $(OPENAIR_TARGETS)/SIMU/USER/oaisim_pad.o
#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
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
......@@ -269,8 +264,8 @@ endif
# Check if libpgm is installed and use it if found instead of the unreliable
# multicast
ifeq ($(PGM_FOUND), 1)
CFLAGS += `pkg-config --cflags openpgm-5.1` -DENABLE_PGM_TRANSPORT
PGM_LDFLAGS = `pkg-config --libs openpgm-5.1`
CFLAGS += $(PGM_CFLAGS) -DENABLE_PGM_TRANSPORT
LIBS += $(PGM_LIBS)
endif
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)
......@@ -278,7 +273,10 @@ ifeq ($(OPENAIR2),1)
OBJ += $(L2_OBJS)
endif
LIBS = $(LFDS_DIR)/bin/liblfds611.a
LFDS_OBJ_DIR = $(subst $(OPENAIR_HOME),$(OBJS_DIR),$(LFDS_DIR))
LFDS_LIB = $(LFDS_OBJ_DIR)/bin/liblfds611.a
LIBS += $(LFDS_LIB)
OAISIM_DEPENDENCIES = $(LFDS_LIB)
default: oaisim
......@@ -288,22 +286,24 @@ pad: oaisim_pad
userclean: cleanall oaisim
objsdir:
@if [ ! -d $(OBJS_DIR) ]; then mkdir -p $(OBJS_DIR); fi
ifdef USE_MME
CFLAGS += -DENB_MODE -DENABLE_USE_MME -DENABLE_EVENT_FD -I$(S1AP_DIR) -I$(SCTP_DIR)
S1AP_CFLAGS = $(CFLAGS) -I$(TOP_DIR) $(L2_incl) $(UTIL_incl) $(UTILS_incl)
LIBS += $(S1AP_DIR)/libs1ap.a $(SCTP_DIR)/libsctp.a -lsctp -lcrypt
LIBS += $(S1AP_OBJ_DIR)/libs1ap.a $(SCTP_OBJ_DIR)/libsctp.a -lsctp -lcrypt
OAISIM_DEPENDENCIES += $(S1AP_OBJ_DIR)/libs1ap.a $(SCTP_OBJ_DIR)/libsctp.a
export S1AP_CFLAGS
$(S1AP_DIR)/libs1ap.a: force_look
@$(MAKE) -C $(S1AP_DIR) -f Makefile.eNB libs1ap.a
$(SCTP_DIR)/libsctp.a: force_look
@$(MAKE) -C $(SCTP_DIR) -f Makefile.eNB libsctp.a
$(S1AP_OBJ_DIR)/libs1ap.a: force_look
@$(MAKE) -C $(S1AP_DIR) -f Makefile.eNB $(S1AP_OBJ_DIR)/libs1ap.a OUTDIR=$(S1AP_OBJ_DIR)
$(SCTP_OBJ_DIR)/libsctp.a: force_look
@$(MAKE) -C $(SCTP_DIR) -f Makefile.eNB $(SCTP_OBJ_DIR)/libsctp.a OUTDIR=$(SCTP_OBJ_DIR)
endif
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)
......@@ -349,29 +349,36 @@ $(OAISIM_OBJS): $(ITTI_MESSAGES_H)
oaisim_pad.o: $(ITTI_MESSAGES_H)
endif
$(OBJ) $(OAISIM_OBJS) $(OAISIM_PAD_OBJS) $(ASN1_MSG_OBJS1): %.o : %.c
OAISIM_COMPILED_OBJECTS = $(subst $(OPENAIR_HOME), $(OBJS_DIR), $(OBJ) $(OAISIM_OBJS) $(ASN1_MSG_OBJS1))
$(OAISIM_COMPILED_OBJECTS): | objsdir
.SECONDEXPANSION:
$(OAISIM_COMPILED_OBJECTS) $(OAISIM_PAD_OBJS): %.o : $$(subst $(OBJS_DIR), $(OPENAIR_HOME), $$*.c)
@echo Compiling $<
@if [ ! -d $(dir $@) ]; then mkdir -p $(dir $@); fi;
@$(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
@$(CC) -MM $(CFLAGS) $(EXTRA_CFLAGS) -DPHY_CONTEXT=1 -I$(TOP_DIR) $(L2_incl) $(UTIL_incl) $(UTILS_incl) -I$(ASN1_MSG_INC) $< > $*.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
$(LFDS_DIR)/bin/liblfds611.a:
$(MAKE) -C $(LFDS_DIR) -f makefile.linux
$(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)
oaisim_pad: $(OBJ) $(OAISIM_PAD_OBJS) $(ASN1_MSG_OBJS1)
@echo "Linking oaisim_pad ..."
@$(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) \
-lm -lblas -lpthread -llapack_atlas -lforms -lxml2 -lX11 -lXpm -lrt
-lpthread -llapack_atlas -lforms -lrt $(LIBS) $(DB_LDFLAGS)
oaisim: $(OBJ) $(OAISIM_OBJS) $(ASN1_MSG_OBJS1) $(LIBS)
oaisim: $(OAISIM_COMPILED_OBJECTS) $(OAISIM_DEPENDENCIES)
@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) \
-lm -lblas -lpthread -llapack_atlas -lforms -lxml2 -lX11 -lXpm -lrt \
$(LIBS) $(PGM_LDFLAGS) $(DB_LDFLAGS) $(OSA_LDFLAGS)
@$(CC) -I$(TOP_DIR) $(L2_incl) $(UTIL_incl) $(UTILS_incl) -I$(ASN1_MSG_INC) $(S1AP_Incl) -o oaisim $(CFLAGS) $(EXTRA_CFLAGS) $(OAISIM_COMPILED_OBJECTS) \
-lpthread -llapack_atlas -lforms -lrt $(LIBS) $(DB_LDFLAGS)
ifeq ($(rrc_cellular_eNB),1)
mv oaisim oaisim_eNB
......@@ -382,7 +389,7 @@ endif
oaisimCROWN: $(OBJ) $(ASN1_MSG_OBJS1) oaisimCROWN.c
@echo "Compiling oaisimCROWN.c ..."
@$(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
@$(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 $(LIBXML2_LIBS) -lX11 -lXpm -lrt
nasmesh_fix:
(cd $(OPENAIR2_DIR)/NAS/DRIVER/MESH/RB_TOOL && $(MAKE))
......@@ -414,26 +421,25 @@ nas_sim_rg_cellular:
rrm_std_cellular:
( cd $(OPENAIR2_DIR)/NAS/SIMU_CELLULAR && make cell_rrm CELL_RRM=1 CELLULAR=1 NO_RRM=1)
cleanall: clean cleanasn1
@if [ -d $(S1AP_DIR) ];then $(MAKE) -C $(S1AP_DIR) -f Makefile.eNB cleanall; fi
@if [ -d $(S1AP_DIR) ]; then $(MAKE) -C $(S1AP_DIR) -f Makefile.eNB cleanall OUTDIR=$(S1AP_OBJ_DIR); fi
cleanalmostall: clean
rm -f $(ASN1_MSG_OBJS1)
clean:
@$(MAKE) -C $(LFDS_DIR) -f makefile.linux clean
@$(MAKE) -C $(LFDS_DIR) -f makefile.linux clean OUTDIR=$(LFDS_OBJ_DIR)
@$(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) $(OAISIM_PAD_OBJS)
@$(RM_F_V) $(OAISIM_PAD_OBJS:.o=.d)
@$(RM_F_V) $(OAISIM_COMPILED_OBJECTS)
@$(RM_F_V) $(OAISIM_COMPILED_OBJECTS:.o=.d)
@$(RM_F_V) *.exe*
@$(RM_F_V) $(ASN1_MSG_INC)/asn1_msg.o
@if [ -d $(S1AP_DIR) ];then $(MAKE) -C $(S1AP_DIR) -f Makefile.eNB clean; fi
@if [ -d $(SCTP_DIR) ];then $(MAKE) -C $(SCTP_DIR) -f Makefile.eNB clean; fi
@if [ -d $(S1AP_DIR) ]; then $(MAKE) -C $(S1AP_DIR) -f Makefile.eNB clean OUTDIR=$(S1AP_OBJ_DIR); fi
@if [ -d $(SCTP_DIR) ]; then $(MAKE) -C $(SCTP_DIR) -f Makefile.eNB clean OUTDIR=$(SCTP_OBJ_DIR); fi
cleanl1:
@$(RM_F_V) LOG_THREAD oaisim
......@@ -465,7 +471,6 @@ cleanlfds:
$(MAKE) -C $(LFDS_DIR) -f makefile.linux clean
print:
# @echo $(cygwin)
@echo "OBJ " $(OBJ)
@echo "OAISIM_OBJS " $(OAISIM_OBJS)
@echo "OAISIM_PAD_OBJS " $(OAISIM_PAD_OBJS)
......@@ -480,6 +485,7 @@ print:
@echo "IS_REL8 is " $(IS_REL8)
@echo "IS_REL10 is " $(IS_REL10)
@echo "ENABLE_DB is " $(ENABLE_DB)
@echo "Libs are" $(LIBS)
showcflags:
@echo oaisim cflags: $(CFLAGS)
......
CC = gcc
MPICC = gcc #mpicc
RM_F_V = rm -f -v
PWD = $(shell pwd)
OBJS_DIR := $(PWD)/objs
SVN_REV = $(shell svnversion -n .)
NUM_CORES=$(shell cat /proc/cpuinfo | grep processor | wc -l)
# Check for libraries and export cflags/linker variables
NETTLE_FOUND = $(shell if pkg-config --exists nettle; then echo "1" ; else echo "0"; fi)
ifeq ($(NETTLE_FOUND), 1)
NETTLE_LIBS = `pkg-config --libs nettle`
endif
OPENSSL_FOUND = $(shell if pkg-config --exists openssl; then echo "1" ; else echo "0"; fi)
ifeq ($(OPENSSL_FOUND), 1)
OPENSSL_LIBS = `pkg-config --libs openssl`
endif
PGM_FOUND = $(shell if pkg-config --exists openpgm-5.1; then echo "1" ; else echo "0"; fi)
ifeq ($(PGM_FOUND), 1)
PGM_CFLAGS = `pkg-config --cflags openpgm-5.1`
PGM_LIBS = `pkg-config --libs openpgm-5.1`
endif
LIBXML2_FOUND = $(shell if pkg-config --exists libxml-2.0; then echo "1" ; else echo "0"; fi)
ifeq ($(LIBXML2_FOUND), 1)
LIBXML2_CFLAGS = `pkg-config --cflags libxml-2.0`
LIBXML2_LIBS = `pkg-config --libs libxml-2.0`
endif
XPM_FOUND = $(shell if pkg-config --exists xpm; then echo "1" ; else echo "0"; fi)
ifeq ($(XPM_FOUND), 1)
XPM_LIBS = `pkg-config --libs xpm`
endif
LIBBLAS_FOUND = $(shell if [ -f /usr/include/cblas.h ]; then echo "1"; else echo "0"; fi)
ifeq ($(LIBBLAS_FOUND), 1)
LIBBLAS_LIBS = -lblas
else
echo "libblas not found, please install it"
endif
#Export common libs
LIBS = \
-lm \
$(LIBBLAS_LIBS) \
$(LIBXML2_LIBS) \
$(XPM_LIBS)
#Export common cflags (between softmodem and oaisim)
COMMON_CFLAGS = \
-Wall \
-fno-strict-aliasing \
-g \
-ggdb \
-O2
\ No newline at end of file
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment