Makefile.common 9.99 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
SECU=0
else
LIBS += $(OPENSSL_LIBS) $(NETTLE_LIBS)
endif
endif
endif

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

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
62 63 64 65 66

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

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

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

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

nikaeinn's avatar
nikaeinn committed
95
ifeq ($(USE_MME), R10)	
96 97 98 99 100 101 102 103
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 
104
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
105
endif 
106

107 108
COMMON_CFLAGS		+= -DLOG_NO_THREAD 
#-DEMIT_ASN_DEBUG
109

110
openair_cn_available := $(shell if [ -d "$(UE_NAS_DIR)" ]; then echo "0" ; else  echo "1" ; fi )
111 112
ifeq 	($(openair_cn_available), 0)
COMMON_CFLAGS		+= -DENABLE_NAS_UE_LOGGING
113 114 115 116 117 118
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
119
endif
120

121 122
UENAS_CFLAGS		= $(COMMON_CFLAGS)
UENAS_CFLAGS		+= -I$(SECU_DIR)
123
export UENAS_CFLAGS
124

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

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

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

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

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

157 158 159 160 161
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
162
GTPV1U_CFLAGS           += -I$(OPENAIR_DIR)/openair2/ENB_APP
163
GTPV1U_CFLAGS           += $(UTIL_incl) -I$(OPENAIR3_DIR)/UTILS
gauthier's avatar
gauthier committed
164 165
export GTPV1U_CFLAGS

166
GTPV1U_ENB_CFLAGS            = $(COMMON_CFLAGS)
167
GTPV1U_ENB_CFLAGS           +=  $(OPENAIR_DIR)/openair2/COMMON
168
GTPV1U_ENB_CFLAGS           += -I$(X2AP_DIR)
169 170 171 172 173 174 175
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
176
GTPV1U_ENB_CFLAGS           += -I$(OPENAIR_DIR)/openair2/ENB_APP
177
GTPV1U_ENB_CFLAGS           += $(UTIL_incl) -I$(OPENAIR3_DIR)/UTILS
178 179
export GTPV1U_ENB_CFLAGS

180 181 182 183 184

$(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)
185 186
$(X2AP_OBJ_DIR)/libx2ap.a: force_look
	@$(MAKE) -C $(X2AP_DIR) -f Makefile.inc $(X2AP_OBJ_DIR)/libx2ap.a OUTDIR=$(X2AP_OBJ_DIR)
187 188 189 190
$(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
191 192 193 194
$(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)
195

196
OBJ = $(NAS_UE_OBJS) $(SECU_OBJS)
197 198
endif

199 200
export COMMON_CFLAGS

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

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

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

226 227 228 229 230 231
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)
232
	@if [ -d $(UE_NAS_OBJ_DIR) ]; then $(MAKE) -C $(UE_NAS_DIR) -f Makefile.UE clean OUTDIR=$(UE_NAS_OBJ_DIR); fi
233
	@if [ -d $(SECU_OBJ_DIR) ]; then $(MAKE) -C $(SECU_DIR) -f Makefile.eNB clean OUTDIR=$(SECU_OBJ_DIR); fi
234
	@if [ -d $(X2AP_OBJ_DIR) ]; then $(MAKE) -C $(X2AP_DIR) -f Makefile.inc clean OUTDIR=$(X2AP_OBJ_DIR); fi
235 236
	@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
237 238
	@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
239 240 241

common-cleanall:
	@if [ -d $(UE_NAS_OBJ_DIR) ]; then $(MAKE) -C $(UE_NAS_DIR) -f Makefile.UE cleanall OUTDIR=$(UE_NAS_OBJ_DIR); fi
242
	@if [ -d $(SECU_OBJ_DIR) ]; then $(MAKE) -C $(SECU_DIR) -f Makefile.eNB cleanall OUTDIR=$(SECU_OBJ_DIR); fi
243
	@if [ -d $(X2AP_OBJ_DIR) ]; then $(MAKE) -C $(X2AP_DIR) -f Makefile.inc cleanall OUTDIR=$(X2AP_OBJ_DIR); fi
244 245
	@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
246 247
	@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
248