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 include $(OPENAIR_TARGETS)/SIMU/USER/Makerules
S1AP_OBJDIR = $(S1AP_DIR)/enb_objs OUTDIR = $(S1AP_DIR)/enb_objs
ASN1MESSAGESDIR=$(S1AP_DIR)/MESSAGES ASN1MESSAGESDIR=$(S1AP_DIR)/MESSAGES
ASN1DIR=$(ASN1MESSAGESDIR)/ASN1 ASN1DIR=$(ASN1MESSAGESDIR)/ASN1
...@@ -24,9 +24,6 @@ include $(ASN1MESSAGESDIR)/Makefile.inc ...@@ -24,9 +24,6 @@ include $(ASN1MESSAGESDIR)/Makefile.inc
libs1ap_OBJECTS = \ libs1ap_OBJECTS = \
s1ap_eNB.o s1ap_common.o \ 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_itti_messaging.o \
s1ap_eNB_decoder.o \ s1ap_eNB_decoder.o \
s1ap_eNB_encoder.o \ s1ap_eNB_encoder.o \
...@@ -47,7 +44,7 @@ else ...@@ -47,7 +44,7 @@ else
endif endif
# pull in dependency info for *existing* .o files # pull in dependency info for *existing* .o files
-include *.d -include $(OUTDIR)/*.d
CFLAGS = \ CFLAGS = \
-Wall \ -Wall \
...@@ -56,7 +53,7 @@ CFLAGS = \ ...@@ -56,7 +53,7 @@ CFLAGS = \
-DEMIT_ASN_DEBUG=1 \ -DEMIT_ASN_DEBUG=1 \
-DUSER_MODE \ -DUSER_MODE \
-I./MESSAGES \ -I./MESSAGES \
-I$(S1AP_OBJDIR) \ -I$(OUTDIR) \
-I../UTILS \ -I../UTILS \
$(ADD_CFLAGS) \ $(ADD_CFLAGS) \
-DENB_MODE \ -DENB_MODE \
...@@ -64,52 +61,69 @@ CFLAGS = \ ...@@ -64,52 +61,69 @@ CFLAGS = \
-Wuninitialized \ -Wuninitialized \
-Werror=implicit-function-declaration -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 $<" @echo "Compiling $<"
@if [ ! -d $(dir $@) ]; then mkdir -p $(dir $@); fi;
@$(CC) -c $(CFLAGS) -o $@ $< @$(CC) -c $(CFLAGS) -o $@ $<
@$(CC) -MM $(CFLAGS) $*.c > $*.d @$(CC) -MM $(CFLAGS) $< > $(basename $@).d
@mv -f $*.d $*.d.tmp @mv -f $(basename $@).d $(basename $@).d.tmp
@sed -e 's|.*:|$*.o:|' < $*.d.tmp > $*.d @sed -e 's|.*:|$@:|' < $(basename $@).d.tmp > $(basename $@).d
@sed -e 's/.*://' -e 's/\\$$//' < $*.d.tmp | fmt -1 | \ @sed -e 's/.*://' -e 's/\\$$//' < $(basename $@).d.tmp | fmt -1 | \
sed -e 's/^ *//' -e 's/$$/:/' >> $*.d sed -e 's/^ *//' -e 's/$$/:/' >> $(basename $@).d
@rm -f $*.d.tmp @rm -f $(basename $@).d.tmp
$(S1AP_OBJDIR)/s1ap_ieregen.stamp: $(ASN1DIR)/$(ASN1RELDIR)/S1AP-PDU-Contents.asn $(ASN1DIR)/asn1tostruct.py $(OUTDIR)/s1ap_ieregen.stamp: $(ASN1DIR)/$(ASN1RELDIR)/S1AP-PDU-Contents.asn $(ASN1DIR)/asn1tostruct.py
mkdir -p $(S1AP_OBJDIR) @if [ ! -d $(OUTDIR) ]; then mkdir -p $(OUTDIR); fi;
python $(ASN1DIR)/asn1tostruct.py -f$< -o$(S1AP_OBJDIR) @python $(ASN1DIR)/asn1tostruct.py -f$< -o$(OUTDIR)
echo Timestamp > $@ @echo Timestamp > $@
$(S1AP_OBJDIR)/s1ap_asn1regen.stamp: $(ASN1DIR)/$(ASN1RELDIR)/S1AP-CommonDataTypes.asn \ $(OUTDIR)/s1ap_asn1regen.stamp: $(ASN1DIR)/$(ASN1RELDIR)/S1AP-CommonDataTypes.asn \
$(ASN1DIR)/$(ASN1RELDIR)/S1AP-Constants.asn $(ASN1DIR)/$(ASN1RELDIR)/S1AP-IEs.asn $(ASN1DIR)/$(ASN1RELDIR)/S1AP-PDU.asn $(ASN1DIR)/$(ASN1RELDIR)/S1AP-Constants.asn $(ASN1DIR)/$(ASN1RELDIR)/S1AP-IEs.asn $(ASN1DIR)/$(ASN1RELDIR)/S1AP-PDU.asn
(cd $(ASN1MESSAGESDIR) && asn1c -fhave_native64 -gen-PER $^) (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 @echo Creating S1AP archive
@$(AR) rcs $@ $(libs1ap_OBJECTS) @$(AR) rcs $@ $(S1AP_GENERATED) $(addprefix $(OUTDIR)/,$(libs1ap_OBJECTS))
clean: clean:
@$(RM_F_V) $(libs1ap_OBJECTS) @$(RM_F_V) $(OUTDIR)/*.o
@$(RM_F_V) *.d @$(RM_F_V) $(OUTDIR)/*.d
@$(RM_F_V) $(addprefix MESSAGES/, $(S1AP_ASN_MODULE_SOURCES)) @$(RM_F_V) $(addprefix $(OUTDIR)/MESSAGES/, $(S1AP_ASN_MODULE_SOURCES))
@$(RM_F_V) $(addprefix MESSAGES/, $(S1AP_ASN_MODULE_SOURCES_R9)) @$(RM_F_V) $(addprefix $(OUTDIR)/MESSAGES/, $(S1AP_ASN_MODULE_SOURCES_R9))
@$(RM_F_V) $(addprefix MESSAGES/, $(S1AP_ASN_MODULE_SOURCES_R10)) @$(RM_F_V) $(addprefix $(OUTDIR)/MESSAGES/, $(S1AP_ASN_MODULE_SOURCES_R10))
@$(RM_F_V) $(addprefix MESSAGES/, $(S1AP_ASN_MODULE_SOURCES:.o=.d)) @$(RM_F_V) $(addprefix $(OUTDIR)/MESSAGES/, $(S1AP_ASN_MODULE_SOURCES:.o=.d))
@$(RM_F_V) $(addprefix MESSAGES/, $(S1AP_ASN_MODULE_SOURCES_R9:.o=.d)) @$(RM_F_V) $(addprefix $(OUTDIR)/MESSAGES/, $(S1AP_ASN_MODULE_SOURCES_R9:.o=.d))
@$(RM_F_V) $(addprefix MESSAGES/, $(S1AP_ASN_MODULE_SOURCES_R10:.o=.d)) @$(RM_F_V) $(addprefix $(OUTDIR)/MESSAGES/, $(S1AP_ASN_MODULE_SOURCES_R10:.o=.d))
@$(RM_F_V) libs1ap.a @$(RM_F_V) $(OUTDIR)/libs1ap.a
@$(RM_F_V) $(S1AP_OBJDIR)/s1ap_asn1regen.stamp @$(RM_F_V) $(OUTDIR)/s1ap_asn1regen.stamp
@$(RM_F_V) $(S1AP_OBJDIR)/s1ap_ieregen.stamp @$(RM_F_V) $(OUTDIR)/s1ap_ieregen.stamp
@$(RM_F_V) $(S1AP_OBJDIR)/s1ap_decoder.c $(S1AP_OBJDIR)/s1ap_encoder.c @$(RM_F_V) $(OUTDIR)/s1ap_decoder.c $(OUTDIR)/s1ap_encoder.c
@$(RM_F_V) $(S1AP_OBJDIR)/s1ap_xer_print.c $(S1AP_OBJDIR)/s1ap_ies_defs.h @$(RM_F_V) $(OUTDIR)/s1ap_xer_print.c $(OUTDIR)/s1ap_ies_defs.h
cleanall: clean cleanall: clean
@$(RM_F_V) $(addprefix MESSAGES/, $(S1AP_ASN_MODULE_SOURCES:.o=.c)) @$(RM_F_V) $(addprefix $(OUTDIR)/MESSAGES/, $(S1AP_ASN_MODULE_SOURCES:.o=.c))
@$(RM_F_V) $(addprefix MESSAGES/, $(S1AP_ASN_MODULE_SOURCES:.o=.h)) @$(RM_F_V) $(addprefix $(OUTDIR)/MESSAGES/, $(S1AP_ASN_MODULE_SOURCES:.o=.h))
@$(RM_F_V) $(addprefix MESSAGES/, $(S1AP_ASN_MODULE_SOURCES_R9:.o=.c)) @$(RM_F_V) $(addprefix $(OUTDIR)/MESSAGES/, $(S1AP_ASN_MODULE_SOURCES_R9:.o=.c))
@$(RM_F_V) $(addprefix MESSAGES/, $(S1AP_ASN_MODULE_SOURCES_R9:.o=.h)) @$(RM_F_V) $(addprefix $(OUTDIR)/MESSAGES/, $(S1AP_ASN_MODULE_SOURCES_R9:.o=.h))
@$(RM_F_V) $(addprefix MESSAGES/, $(S1AP_ASN_MODULE_SOURCES_R10:.o=.c)) @$(RM_F_V) $(addprefix $(OUTDIR)/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_R10:.o=.h))
showcflags: showcflags:
@echo s1ap cflags: $(CFLAGS) @echo s1ap cflags: $(CFLAGS)
\ No newline at end of file
include $(OPENAIR_TARGETS)/SIMU/USER/Makerules include $(OPENAIR_TARGETS)/SIMU/USER/Makerules
OUTDIR = .
libsctp_OBJECTS = \ libsctp_OBJECTS = \
sctp_common.o \ sctp_common.o \
sctp_eNB_task.o \ sctp_eNB_task.o \
sctp_eNB_itti_messaging.o sctp_eNB_itti_messaging.o
# pull in dependency info for *existing* .o files # pull in dependency info for *existing* .o files
-include *.d -include $(OUTDIR)/*.d
CFLAGS = \ CFLAGS = \
-Wall \ -Wall \
$(S1AP_CFLAGS) \ $(S1AP_CFLAGS) \
-I../SCTP \
-DENB_MODE \ -DENB_MODE \
-Werror=uninitialized \ -Werror=uninitialized \
-Werror=implicit-function-declaration -Werror=implicit-function-declaration
$(libsctp_OBJECTS): %.o : %.c $(OUTDIR)/%.o : %.c
@echo "Compiling $<" @echo "Compiling $<"
@if [ ! -d $(dir $@) ]; then mkdir -p $(dir $@); fi;
@$(CC) -c $(CFLAGS) -o $@ $< @$(CC) -c $(CFLAGS) -o $@ $<
@$(CC) -MM $(CFLAGS) $*.c > $*.d @$(CC) -MM $(CFLAGS) $< > $(basename $@).d
@mv -f $*.d $*.d.tmp @mv -f $(basename $@).d $(basename $@).d.tmp
@sed -e 's|.*:|$*.o:|' < $*.d.tmp > $*.d @sed -e 's|.*:|$@:|' < $(basename $@).d.tmp > $(basename $@).d
@sed -e 's/.*://' -e 's/\\$$//' < $*.d.tmp | fmt -1 | \ @sed -e 's/.*://' -e 's/\\$$//' < $(basename $@).d.tmp | fmt -1 | \
sed -e 's/^ *//' -e 's/$$/:/' >> $*.d sed -e 's/^ *//' -e 's/$$/:/' >> $(basename $@).d
@rm -f $*.d.tmp @rm -f $(basename $@).d.tmp
libsctp.a: $(libsctp_OBJECTS) objsdir:
@if [ ! -d $(OUTDIR) ]; then mkdir -p $(OUTDIR); fi;
$(OUTDIR)/libsctp.a: $(addprefix $(OUTDIR)/,$(libsctp_OBJECTS))
@echo Creating SCTP archive @echo Creating SCTP archive
@$(AR) rcs $@ $(libsctp_OBJECTS) @$(AR) rcs $@ $(addprefix $(OUTDIR)/,$(libsctp_OBJECTS))
clean: clean:
@$(RM_F_V) $(libsctp_OBJECTS) @$(RM_F_V) $(OUTDIR)/*.o
@$(RM_F_V) *.d @$(RM_F_V) $(OUTDIR)/*.d
@$(RM_F_V) libsctp.a @$(RM_F_V) $(OUTDIR)/libsctp.a
\ No newline at end of file \ No newline at end of file
##### paths ##### ##### paths #####
BINDIR = bin OUTDIR := .
BINDIR = $(OUTDIR)/bin
OBJDIR = $(OUTDIR)/obj
INCDIR = inc INCDIR = inc
OBJDIR = obj
SRCDIR = src SRCDIR = src
##### misc ##### ##### misc #####
...@@ -10,6 +11,7 @@ QUIETLY = 1>/dev/null 2>/dev/null ...@@ -10,6 +11,7 @@ QUIETLY = 1>/dev/null 2>/dev/null
##### sources, objects and libraries ##### ##### sources, objects and libraries #####
BINNAME = liblfds611 BINNAME = liblfds611
AR_BINARY = $(BINDIR)/$(BINNAME).a AR_BINARY = $(BINDIR)/$(BINNAME).a
$(info $(AR_BINARY))
SO_BINARY = $(BINDIR)/$(BINNAME).so SO_BINARY = $(BINDIR)/$(BINNAME).so
SRCDIRS = lfds611_abstraction lfds611_freelist lfds611_liblfds lfds611_queue lfds611_ringbuffer lfds611_slist lfds611_stack 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 # 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)) ...@@ -76,14 +78,17 @@ vpath %.c $(patsubst %,$(SRCDIR)/%:,$(SRCDIRS))
##### implicit rules ##### ##### implicit rules #####
$(OBJDIR)/%.o : %.c $(OBJDIR)/%.o : %.c
$(DG) $(DGFLAGS) $< >$(OBJDIR)/$*.d @echo "Compiling $<"
$(CC) $(CFLAGS) -o $@ $< @$(DG) $(DGFLAGS) $< >$(OBJDIR)/$*.d
@$(CC) $(CFLAGS) -o $@ $<
##### explicit rules ##### ##### explicit rules #####
$(AR_BINARY) : $(OBJECTS) $(AR_BINARY) : $(OBJECTS)
$(AR) $(AFLAGS) $(AR_BINARY) $(OBJECTS) @echo "Creating $(AR_BINARY)"
@$(AR) $(AFLAGS) $(AR_BINARY) $(OBJECTS)
$(SO_BINARY) : $(OBJECTS) $(SO_BINARY) : $(OBJECTS)
@echo "Creating $(SO_BINARY)"
$(LD) $(LFLAGS) $(SYSLIBS) $(OBJECTS) -o $(SO_BINARY) $(LD) $(LFLAGS) $(SYSLIBS) $(OBJECTS) -o $(SO_BINARY)
##### phony ##### ##### phony #####
......
This diff is collapsed.
CC = gcc CC = gcc
MPICC = gcc #mpicc MPICC = gcc #mpicc
RM_F_V = rm -f -v 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) 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) 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) 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) 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