Makefile.inc 3.59 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



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

CFLAGS =            \
	-Wall           \
	-DENB_MODE      \
	-DENABLE_USE_MME    \
	-I.        \
32
	-I$(ASN1MESSAGESDIR)/ASN1/$(ASN1RELDIR) \
33
	-I$(ASN1MESSAGESDIR) \
gauthier's avatar
gauthier committed
34 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
	-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

70

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

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

79 80
$(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)
81
#	(cd $(ASN1DIR)/$(ASN1RELDIR) && asn1c -fhave_native64 -gen-PER -fcompound-names $^)
82 83
	(cd $(ASN1MESSAGESDIR) && asn1c -fhave_native64 -gen-PER -fcompound-names -fskeletons-copy $^)
	@echo "Timestamp X2AP_CFLAGS: " $(X2AP_CFLAGS)
84
	@echo Timestamp > $@	
gauthier's avatar
gauthier committed
85 86 87 88 89 90 91 92 93

$(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
94 95
	@$(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
96 97 98 99 100 101 102
	@$(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
103 104
	@$(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
105 106 107

showcflags:
	@echo x2ap cflags: $(CFLAGS)