Makefile.common 10 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
COMMON_CFLAGS		+= -DENABLE_ITTI
89
COMMON_CFLAGS		+= -I$(OPENAIR1_DIR)
90 91 92
COMMON_CFLAGS		+= -I$(OPENAIR2_DIR)/NAS
COMMON_CFLAGS 	 	+= $(L2_incl)
COMMON_CFLAGS		+= $(UTILS_incl)
93 94 95
SHARED_DEPENDENCIES += $(ITTI_MESSAGES_H)
endif

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

108 109
COMMON_CFLAGS		+= -DLOG_NO_THREAD 
#-DEMIT_ASN_DEBUG
110

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

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

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

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

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

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

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

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

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

181 182 183 184 185

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

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

200 201
export COMMON_CFLAGS

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

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

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

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

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