Makefile.common 10.1 KB
Newer Older
1
# This file gathers compilation directive shared between lte-softmodem and oaisim
2
export COMMON_UTILS_DIR    = $(OPENAIR_DIR)/common/utils
3 4
export UE_NAS_DIR          = $(OPENAIR_DIR)/openair3/NAS
export S1AP_DIR            = $(OPENAIR_DIR)/openair3/S1AP
5
export X2AP_DIR            = $(OPENAIR_DIR)/openair2/X2AP
6 7 8 9
export SCTP_DIR            = $(OPENAIR_DIR)/openair3/SCTP
export UDP_DIR             = $(OPENAIR_DIR)/openair3/UDP
export GTPV1U_DIR          = $(OPENAIR_DIR)/openair3/GTPV1-U
export SECU_DIR            = $(OPENAIR_DIR)/openair3/SECU
10 11 12 13 14 15 16 17

UE_NAS_OBJ_DIR      = $(subst $(OPENAIR_DIR),$(OBJS_DIR),$(UE_NAS_DIR))
SECU_OBJ_DIR        = $(subst $(OPENAIR_DIR),$(OBJS_DIR),$(SECU_DIR))
S1AP_OBJ_DIR        = $(subst $(OPENAIR_DIR),$(OBJS_DIR),$(S1AP_DIR))
X2AP_OBJ_DIR        = $(subst $(OPENAIR_DIR),$(OBJS_DIR),$(X2AP_DIR))
SCTP_OBJ_DIR        = $(subst $(OPENAIR_DIR),$(OBJS_DIR),$(SCTP_DIR))
UDP_OBJ_DIR         = $(subst $(OPENAIR_DIR),$(OBJS_DIR),$(UDP_DIR))
GTPV1U_OBJ_DIR      = $(subst $(OPENAIR_DIR),$(OBJS_DIR),$(GTPV1U_DIR))
18

19 20
#Export common cflags (between softmodem and oaisim)
COMMON_CFLAGS		= \
21 22 23 24 25
	-D'FIRMWARE_VERSION="$(SVN_REV) - $(DATE_REV)"' \
	-Wall                       \
	-fno-strict-aliasing        \
	-O2                         \
	-Werror=implicit-function-declaration
26

27 28 29 30
# the code already uses C99 integer type (like int32_t)
# switch on full support for C99 + GNU extensions
CFLAGS += -std=gnu99

31 32 33 34 35
ITTI_MESSAGES_H		= messages_xml.h
ITTI_MESSAGES_XML	= messages.xml
ITTI_MESSAGES_FILE	= $(ITTI_DIR)/intertask_interface_types.h

include $(COMMON_UTILS_DIR)/Makefile.inc
36 37
include $(OPENAIR_TARGETS)/COMMON/Makefile.inc
include $(OPENAIR2_DIR)/NAS/Makefile.inc
38

39 40
ifeq ($(SECU), 1)	
ifeq ($(NETTLE_FOUND), 0)
41
@(warning "Nettle library >= 2.5 is not installed on your system, nettle-dev lib needed, continuing with security disabled")
42 43 44
SECU=0
else
ifeq ($(OPENSSL_FOUND), 0)
45
@(warning "openssl library is not installed on your system, openssl lib needed, continuing with security disabled")
46 47 48 49 50 51 52 53 54
SECU=0
else
CFLAGS += -DENABLE_SECURITY
LIBS += $(OPENSSL_LIBS) $(NETTLE_LIBS)
endif
endif
endif

CFLAGS += -DJUMBO_FRAME
55 56 57 58 59 60 61 62

ifdef MAX_NUM_CCs
CFLAGS           += -DMAX_NUM_CCs=$(MAX_NUM_CCs)
COMMON_CFLAGS    += -DMAX_NUM_CCs=$(MAX_NUM_CCs)
else
CFLAGS           += -DMAX_NUM_CCs=1
COMMON_CFLAGS    += -DMAX_NUM_CCs=1
endif
63 64 65 66 67

ifeq ($(ENABLE_RAL), 1)
CFLAGS += -DENABLE_RAL
endif

68 69 70
ifeq ($(PDCP_USE_NETLINK),1)  
CFLAGS += -DPDCP_USE_NETLINK
endif
71 72 73 74
ifeq ($(LIBCONFIG_LONG),1)	
CFLAGS += -DLIBCONFIG_LONG
endif

nikaeinn's avatar
nikaeinn committed
75 76
# add R9
ifeq ($(USE_MME), R10)	
77
COMMON_CFLAGS		+= -DENABLE_USE_MME
78
ENABLE_ITTI = 1
79 80
ifeq ($(LINK_ENB_PDCP_TO_GTPV1U), 1)	
    COMMON_CFLAGS       += -DLINK_ENB_PDCP_TO_GTPV1U
81 82 83 84
# COMMON_CFLAGS       += -I$(UDP_DIR)
# COMMON_CFLAGS       += -I$(GTPV1U_DIR)
# COMMON_CFLAGS       += -I$(GTPV1U_DIR)/nw-gtpv1u/shared
endif
85 86
endif

nikaeinn's avatar
nikaeinn committed
87
ifeq ($(ENABLE_ITTI),1)
88 89
COMMON_CFLAGS		+= -DENABLE_ITTI
COMMON_CFLAGS		+= -DUSER_MODE
90
COMMON_CFLAGS		+= -I$(OPENAIR1_DIR)
91 92 93
COMMON_CFLAGS		+= -I$(OPENAIR2_DIR)/NAS
COMMON_CFLAGS 	 	+= $(L2_incl)
COMMON_CFLAGS		+= $(UTILS_incl)
94 95 96
SHARED_DEPENDENCIES += $(ITTI_MESSAGES_H)
endif

nikaeinn's avatar
nikaeinn committed
97
ifeq ($(USE_MME), R10)	
98 99 100 101 102 103 104 105
LIBS			+= $(UE_NAS_OBJ_DIR)/libuenas.a $(SECU_OBJ_DIR)/libsecu.a 
LIBS			+= $(S1AP_OBJ_DIR)/libs1ap.a $(SCTP_OBJ_DIR)/libsctp.a -lsctp -lcrypt
LIBS			+= $(UDP_OBJ_DIR)/libudp.a $(GTPV1U_OBJ_DIR)/libgtpv1u.a 

ifdef X2AP
LIBS			+= $(X2AP_OBJ_DIR)/libx2ap.a
SHARED_DEPENDENCIES	+= $(UE_NAS_OBJ_DIR)/libuenas.a $(SECU_OBJ_DIR)/libsecu.a $(X2AP_OBJ_DIR)/libx2ap.a $(S1AP_OBJ_DIR)/libs1ap.a $(SCTP_OBJ_DIR)/libsctp.a  $(UDP_OBJ_DIR)/libudp.a $(GTPV1U_OBJ_DIR)/libgtpv1u.a
else 
106
SHARED_DEPENDENCIES	+= $(UE_NAS_OBJ_DIR)/libuenas.a $(SECU_OBJ_DIR)/libsecu.a $(S1AP_OBJ_DIR)/libs1ap.a $(SCTP_OBJ_DIR)/libsctp.a  $(UDP_OBJ_DIR)/libudp.a $(GTPV1U_OBJ_DIR)/libgtpv1u.a
107
endif 
108

109 110
COMMON_CFLAGS		+= -DLOG_NO_THREAD 
#-DEMIT_ASN_DEBUG
111

112
openair_cn_available := $(shell if [ -d "$(UE_NAS_DIR)" ]; then echo "0" ; else  echo "1" ; fi )
113 114
ifeq 	($(openair_cn_available), 0)
COMMON_CFLAGS		+= -DENABLE_NAS_UE_LOGGING
115 116 117 118 119 120
COMMON_CFLAGS		+= -I$(OPENAIR_DIR)/openair3/NAS/EURECOM-NAS/src/api/network
COMMON_CFLAGS		+= -I$(OPENAIR_DIR)/openair3/NAS/EURECOM-NAS/src/include
COMMON_CFLAGS		+= -I$(OPENAIR_DIR)/openair3/NAS/EURECOM-NAS/src/ies
COMMON_CFLAGS		+= -I$(OPENAIR_DIR)/openair3/NAS/EURECOM-NAS/src/emm/msg
COMMON_CFLAGS		+= -I$(OPENAIR_DIR)/openair3/NAS/EURECOM-NAS/src/esm/msg
COMMON_CFLAGS		+= -I$(OPENAIR_DIR)/openair3/NAS/EURECOM-NAS/src/util
121
endif
122

123 124
UENAS_CFLAGS		= $(COMMON_CFLAGS)
UENAS_CFLAGS		+= -I$(SECU_DIR)
125
export UENAS_CFLAGS
126

127
SECU_CFLAGS			= $(COMMON_CFLAGS)
128 129
SECU_CFLAGS			+= -I$(OPENAIR_DIR)/openair3/COMMON
SECU_CFLAGS			+= -I$(OPENAIR_DIR)/openair3/UTILS
130 131
SECU_CFLAGS			+= -I$(SECU_DIR)
export SECU_CFLAGS
132

133 134
COMMON_MME_CFLAGS	 = -I$(SECU_DIR)
COMMON_MME_CFLAGS       += -I$(SCTP_DIR)
135
COMMON_MME_CFLAGS	+= -I$(X2AP_DIR) 
136
COMMON_MME_CFLAGS	+= -I$(S1AP_DIR)
gauthier's avatar
gauthier committed
137 138
COMMON_MME_CFLAGS	+= -I$(UDP_DIR)
COMMON_MME_CFLAGS	+= -I$(GTPV1U_DIR)
139

140 141 142 143
S1AP_CFLAGS          = $(COMMON_CFLAGS) $(COMMON_MME_CFLAGS)
S1AP_CFLAGS         += -DENB_MODE
S1AP_CFLAGS         += -I$(TOP_DIR)
S1AP_CFLAGS         += $(UTIL_incl)
144 145
export S1AP_CFLAGS

nikaeinn's avatar
nikaeinn committed
146
X2AP_CFLAGS          = $(COMMON_CFLAGS) 
147 148 149 150 151
X2AP_CFLAGS         += -DENB_MODE
X2AP_CFLAGS         += -I$(TOP_DIR)
X2AP_CFLAGS         += $(UTIL_incl)
export X2AP_CFLAGS

gauthier's avatar
gauthier committed
152 153 154 155
UDP_CFLAGS	 		 = $(COMMON_CFLAGS) $(COMMON_MME_CFLAGS)
UDP_CFLAGS	 		+= -DENB_MODE
UDP_CFLAGS	 		+= -I$(TOP_DIR)
UDP_CFLAGS	 		+= $(UTIL_incl)
156
UDP_CFLAGS	 		+= -I$(OPENAIR_DIR)/openair2/ENB_APP
gauthier's avatar
gauthier committed
157 158
export UDP_CFLAGS

159 160 161 162 163
GTPV1U_CFLAGS            = $(COMMON_CFLAGS) $(COMMON_MME_CFLAGS)
GTPV1U_CFLAGS           += -DENB_MODE
GTPV1U_CFLAGS           += -I$(TOP_DIR)
GTPV1U_CFLAGS           += -I$(GTPV1U_DIR)/nw-gtpv1u/include
GTPV1U_CFLAGS           += -I$(GTPV1U_DIR)/nw-gtpv1u/shared
164
GTPV1U_CFLAGS           += -I$(OPENAIR_DIR)/openair2/ENB_APP
165
GTPV1U_CFLAGS           += $(UTIL_incl) -I$(OPENAIR3_DIR)/UTILS
gauthier's avatar
gauthier committed
166 167
export GTPV1U_CFLAGS

168
GTPV1U_ENB_CFLAGS            = $(COMMON_CFLAGS)
169
GTPV1U_ENB_CFLAGS           +=  $(OPENAIR_DIR)/openair2/COMMON
170
GTPV1U_ENB_CFLAGS           += -I$(X2AP_DIR)
171 172 173 174 175 176 177
GTPV1U_ENB_CFLAGS           += -I$(S1AP_DIR)
GTPV1U_ENB_CFLAGS           += -I$(UDP_DIR)
GTPV1U_ENB_CFLAGS           += -I$(GTPV1U_DIR)
GTPV1U_ENB_CFLAGS           += -DENB_MODE
GTPV1U_ENB_CFLAGS           += -I$(TOP_DIR)
GTPV1U_ENB_CFLAGS           += -I$(GTPV1U_DIR)/nw-gtpv1u/include
GTPV1U_ENB_CFLAGS           += -I$(GTPV1U_DIR)/nw-gtpv1u/shared
178
GTPV1U_ENB_CFLAGS           += -I$(OPENAIR_DIR)/openair2/ENB_APP
179
GTPV1U_ENB_CFLAGS           += $(UTIL_incl) -I$(OPENAIR3_DIR)/UTILS
180 181
export GTPV1U_ENB_CFLAGS

182 183 184 185 186

$(UE_NAS_OBJ_DIR)/libuenas.a: force_look
	@$(MAKE) -C $(UE_NAS_DIR) -f Makefile.UE $(UE_NAS_OBJ_DIR)/libuenas.a OUTDIR=$(UE_NAS_OBJ_DIR)
$(SECU_OBJ_DIR)/libsecu.a: force_look
	@$(MAKE) -C $(SECU_DIR) -f Makefile.eNB $(SECU_OBJ_DIR)/libsecu.a OUTDIR=$(SECU_OBJ_DIR)
187 188
$(X2AP_OBJ_DIR)/libx2ap.a: force_look
	@$(MAKE) -C $(X2AP_DIR) -f Makefile.inc $(X2AP_OBJ_DIR)/libx2ap.a OUTDIR=$(X2AP_OBJ_DIR)
189 190 191 192
$(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)
gauthier's avatar
gauthier committed
193 194 195 196
$(UDP_OBJ_DIR)/libudp.a: force_look
	@$(MAKE) -C $(UDP_DIR) -f Makefile.eNB $(UDP_OBJ_DIR)/libudp.a OUTDIR=$(UDP_OBJ_DIR)
$(GTPV1U_OBJ_DIR)/libgtpv1u.a: force_look
	@$(MAKE) -C $(GTPV1U_DIR) -f Makefile.eNB $(GTPV1U_OBJ_DIR)/libgtpv1u.a OUTDIR=$(GTPV1U_OBJ_DIR)
197

198
OBJ = $(NAS_UE_OBJS) $(SECU_OBJS)
199 200
endif

201 202
export COMMON_CFLAGS

nikaeinn's avatar
nikaeinn committed
203
ifeq ($(ENABLE_ITTI),1)	
204
CFLAGS += $(COMMON_CFLAGS) $(COMMON_MME_CFLAGS) $(TARGETS_COMMON_incl)
205
OBJ += $(TARGETS_COMMON_OBJS)
206 207 208 209 210 211 212 213

gccxml_available = $(shell if [ `gccxml --version | grep GCC-XML -c` = "0" ]; then  echo "0" ; else  echo "1" ; fi )
ifeq 	($(gccxml_available), 0)
$(error gccxml is missing, please install)
endif
CFLAGS += -I$(OPENAIR2_DIR)/COMMON -DENABLE_ITTI $(UTILS_incl)
endif

214
$(ITTI_MESSAGES_XML): $(ITTI_MESSAGES_FILE)
215
	@echo "Generating messages.xml ..."
216
	@gccxml $(COMMON_CFLAGS) $< -fxml=$@ -I$(ITTI_DIR)
217
	@$(CC) -MM $(COMMON_CFLAGS) $< > $(basename $@).d
218 219 220 221 222 223 224 225 226 227
	@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

$(ITTI_MESSAGES_H): $(ITTI_MESSAGES_XML)
	@echo "Generating messages_xml.h ..."
	@sed -e 's/[ ]*//' -e 's/"/\\"/g' -e 's/^/"/' -e 's/$$/\\n"/' $< > $@

228 229 230 231 232 233
force_look:
	@true

common-clean:
	@$(RM_F_V) $(ITTI_MESSAGES_H) $(ITTI_MESSAGES_XML) $(ITTI_MESSAGES_XML:.xml=.d)
	@$(MAKE) -C $(LFDS_DIR) -f makefile.linux clean OUTDIR=$(LFDS_OBJ_DIR)
234
	@if [ -d $(UE_NAS_OBJ_DIR) ]; then $(MAKE) -C $(UE_NAS_DIR) -f Makefile.UE clean OUTDIR=$(UE_NAS_OBJ_DIR); fi
235
	@if [ -d $(SECU_OBJ_DIR) ]; then $(MAKE) -C $(SECU_DIR) -f Makefile.eNB clean OUTDIR=$(SECU_OBJ_DIR); fi
236
	@if [ -d $(X2AP_OBJ_DIR) ]; then $(MAKE) -C $(X2AP_DIR) -f Makefile.inc clean OUTDIR=$(X2AP_OBJ_DIR); fi
237 238
	@if [ -d $(S1AP_OBJ_DIR) ]; then $(MAKE) -C $(S1AP_DIR) -f Makefile.eNB clean OUTDIR=$(S1AP_OBJ_DIR); fi
	@if [ -d $(SCTP_OBJ_DIR) ]; then $(MAKE) -C $(SCTP_DIR) -f Makefile.eNB clean OUTDIR=$(SCTP_OBJ_DIR); fi
gauthier's avatar
gauthier committed
239 240
	@if [ -d $(UDP_OBJ_DIR) ]; then $(MAKE) -C $(UDP_DIR) -f Makefile.eNB clean OUTDIR=$(UDP_OBJ_DIR); fi
	@if [ -d $(GTPV1U_OBJ_DIR) ]; then $(MAKE) -C $(GTPV1U_DIR) -f Makefile.eNB clean OUTDIR=$(GTPV1U_OBJ_DIR); fi
241 242 243

common-cleanall:
	@if [ -d $(UE_NAS_OBJ_DIR) ]; then $(MAKE) -C $(UE_NAS_DIR) -f Makefile.UE cleanall OUTDIR=$(UE_NAS_OBJ_DIR); fi
244
	@if [ -d $(SECU_OBJ_DIR) ]; then $(MAKE) -C $(SECU_DIR) -f Makefile.eNB cleanall OUTDIR=$(SECU_OBJ_DIR); fi
245
	@if [ -d $(X2AP_OBJ_DIR) ]; then $(MAKE) -C $(X2AP_DIR) -f Makefile.inc cleanall OUTDIR=$(X2AP_OBJ_DIR); fi
246 247
	@if [ -d $(S1AP_OBJ_DIR) ]; then $(MAKE) -C $(S1AP_DIR) -f Makefile.eNB cleanall OUTDIR=$(S1AP_OBJ_DIR); fi
	@if [ -d $(SCTP_OBJ_DIR) ]; then $(MAKE) -C $(SCTP_DIR) -f Makefile.eNB cleanall OUTDIR=$(SCTP_OBJ_DIR); fi
gauthier's avatar
gauthier committed
248 249
	@if [ -d $(UDP_OBJ_DIR) ]; then $(MAKE) -C $(UDP_DIR) -f Makefile.eNB cleanall OUTDIR=$(UDP_OBJ_DIR); fi
	@if [ -d $(GTPV1U_OBJ_DIR) ]; then $(MAKE) -C $(GTPV1U_DIR) -f Makefile.eNB cleanall OUTDIR=$(GTPV1U_OBJ_DIR); fi
250