Makefile.inc 3.61 KB
Newer Older
gauthier's avatar
 
gauthier committed
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19

ASN1MESSAGESDIR=$(X2AP_DIR)/MESSAGES
ASN1DIR=$(ASN1MESSAGESDIR)/ASN1

#//ifeq ($(USE_MME), R10)
#//	ASN1RELDIR=R10.7
#//else
#//ASN1RELDIR=R11.2
#//endif

# TEMP
ASN1RELDIR=R11.2


include $(ASN1DIR)/$(ASN1RELDIR)/Makefile.inc

libx2ap_OBJECTS = \
	x2ap.o        \
	x2ap_common.o \
20
	$(addprefix MESSAGES/ASN1/$(ASN1RELDIR)/, $(X2AP_ASN_MODULE_SOURCES))
gauthier's avatar
 
gauthier committed
21 22 23 24 25 26 27 28 29 30 31 32



# pull in dependency info for *existing* .o files
-include $(OUTDIR)/*.d

CFLAGS =            \
	-Wall           \
	-DENB_MODE      \
	-DENABLE_USE_MME    \
	-DUSER_MODE     \
	-I.        \
nikaeinn's avatar
nikaeinn committed
33
	-I$(ASN1MESSAGESDIR)/ASN1/$(ASN1RELDIR) \
34
	-I$(ASN1MESSAGESDIR) \
gauthier's avatar
 
gauthier committed
35 36 37 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
	-I$(OUTDIR)     \
	-I../UTILS      \
	$(ADD_CFLAGS)       \
	$(X2AP_CFLAGS)      \
	-Wuninitialized     \
	-Werror=implicit-function-declaration

X2AP_GENERATED =    \
	$(OUTDIR)/x2ap_encoder.o    \
	$(OUTDIR)/x2ap_decoder.o    \
	$(OUTDIR)/x2ap_xer_print.o

$(OUTDIR)/%.o : %.c
	@echo "Compiling $<"
	@echo "Compiling $<  with CFLAGS= $(CFLAGS)"
	@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

$(X2AP_GENERATED): %.o : %.c
	@echo "Compiling $<"
	@echo "Compiling $<  with CFLAGS= $(CFLAGS)"
	@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

71

gauthier's avatar
 
gauthier committed
72 73
$(OUTDIR)/x2ap_ieregen.stamp: $(ASN1DIR)/$(ASN1RELDIR)/X2AP-PDU-Contents.asn $(ASN1DIR)/asn1tostruct.py
	@if [ ! -d $(OUTDIR) ]; then mkdir -p $(OUTDIR); fi;
nikaeinn's avatar
nikaeinn committed
74
	@python $(ASN1DIR)/asn1tostruct.py -f$< -o$(OUTDIR) 
gauthier's avatar
 
gauthier committed
75 76
	@echo Timestamp > $@

77 78 79
#ProtocolExtensionContainer
#$(ASN1DIR)/$(ASN1RELDIR)/X2AP-PDU.asn 

nikaeinn's avatar
nikaeinn committed
80 81
$(OUTDIR)/x2ap_asn1regen.stamp:  $(ASN1DIR)/$(ASN1RELDIR)/X2AP-CommonDataTypes.asn  $(ASN1DIR)/$(ASN1RELDIR)/X2AP-Constants.asn $(ASN1DIR)/$(ASN1RELDIR)/X2AP-IEs.asn  $(ASN1DIR)/$(ASN1RELDIR)/X2AP-PDU.asn   
	@echo "Timestamp DIR " $(ASN1DIR) " DIRREL " $(ASN1RELDIR)
nikaeinn's avatar
nikaeinn committed
82
#	(cd $(ASN1DIR)/$(ASN1RELDIR) && asn1c -fhave_native64 -gen-PER -fcompound-names $^)
83 84
	(cd $(ASN1MESSAGESDIR) && asn1c -fhave_native64 -gen-PER -fcompound-names -fskeletons-copy $^)
	@echo "Timestamp X2AP_CFLAGS: " $(X2AP_CFLAGS)
nikaeinn's avatar
nikaeinn committed
85
	@echo Timestamp > $@	
gauthier's avatar
 
gauthier committed
86 87 88 89 90 91 92 93 94

$(OUTDIR)/libx2ap.a: $(OUTDIR)/x2ap_ieregen.stamp $(OUTDIR)/x2ap_asn1regen.stamp $(X2AP_GENERATED) $(addprefix $(OUTDIR)/,$(libx2ap_OBJECTS))
	@echo Creating X2AP archive
	@echo libx2ap_OBJECTS $(libx2ap_OBJECTS)
	@$(AR) rcs $@ $(X2AP_GENERATED) $(addprefix $(OUTDIR)/,$(libx2ap_OBJECTS))

clean:
	@$(RM_F_V) $(OUTDIR)/*.o
	@$(RM_F_V) $(OUTDIR)/*.d
95 96
	@$(RM_F_V) $(addprefix $(OUTDIR)/MESSAGES/ASN1/$(ASN1RELDIR), $(X2AP_ASN_MODULE_SOURCES))
	@$(RM_F_V) $(addprefix $(OUTDIR)/MESSAGES/ASN1/$(ASN1RELDIR), $(X2AP_ASN_MODULE_SOURCES:.o=.d))
gauthier's avatar
 
gauthier committed
97 98 99 100 101 102 103
	@$(RM_F_V) $(OUTDIR)/libx2ap.a
	@$(RM_F_V) $(OUTDIR)/x2ap_asn1regen.stamp
	@$(RM_F_V) $(OUTDIR)/x2ap_ieregen.stamp
	@$(RM_F_V) $(OUTDIR)/x2ap_decoder.c $(OUTDIR)/x2ap_encoder.c
	@$(RM_F_V) $(OUTDIR)/x2ap_xer_print.c $(OUTDIR)/x2ap_ies_defs.h

cleanall: clean
104 105
	@$(RM_F_V) $(addprefix $(OUTDIR)/MESSAGES/ASN1/$(ASN1RELDIR), $(X2AP_ASN_MODULE_SOURCES:.o=.c))
	@$(RM_F_V) $(addprefix $(OUTDIR)/MESSAGES/ASN1/$(ASN1RELDIR), $(X2AP_ASN_MODULE_SOURCES:.o=.h))
gauthier's avatar
 
gauthier committed
106 107 108

showcflags:
	@echo x2ap cflags: $(CFLAGS)