Makefile 4.9 KB
Newer Older
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 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 70 71 72 73 74
PLATFORM =	linux-x86-32
NUM_PROC = $(shell echo `cat /proc/cpuinfo | grep processor | wc -l`)
NUM_PROC = 1

LIBS =		-L/usr/local/lib -Llib -lSockets -lasn1rrc -lpthread -lssl -lcrypto -lssl -lxml2

#------------------------------------------------
# DIRS
#------------------------------------------------
UPDIR	:= $(shell /bin/pwd)
BIN_DIR             = bin
SRC_DIR             = $(UPDIR)/src
COM_DIR             = $(SRC_DIR)/com
FOREIGN_DIR         = $(SRC_DIR)/foreign
SOCKETS_DIR         = $(FOREIGN_DIR)/sockets-2.3.9.4
TCPIP_DIR           = $(FOREIGN_DIR)/tcpip
SQL_DIR             = $(FOREIGN_DIR)/sql
ASN1_RRC_SPEC_DIR   = $(FOREIGN_DIR)/generated_c_asn1_rrc/ASN1_files
RRC_RRM_ASN1_DIR    = $(COM_DIR)/asn1
RADIO_RESOURCES_DIR = $(SRC_DIR)/radio_resources
RRC_DIR             = ../RRC/LITE
TEST_DIR            = $(SRC_DIR)/test


#------------------------------------------------
# INCLUDES
#------------------------------------------------
include		Makefile.objs
include		Makefile.Defines.$(PLATFORM)
INCLUDE =	-I$(SRC_DIR) -I$(SOCKETS_DIR)  -I$(SQL_DIR)  -I$(COM_DIR)  -I$(COM_DIR)/rrc  -I$(COM_DIR)/rrm  \
-I$(TCPIP_DIR) -I$(RADIO_RESOURCES_DIR) -I$(RRC_RRM_ASN1_DIR) -I$(TEST_DIR)


#------------------------------------------------
# CFLAGS
#------------------------------------------------

CPPFLAGS =	 $(CFLAGS)
#CPPFLAGS +=	-fpermissive -std=gnu++98

#------------------------------------------------
# LIBS
#------------------------------------------------
libasn1rrc:	libasn1rrc.a
		mv libasn1rrc.a lib

libsqlite:	libsqlite.a
		mv libsqlite.a lib


libSockets:	libSockets.a
		mv libSockets.a lib


libasn1rrc.a:	$(ASN1RRC_OBJS)
		ar cru $@ $^
		ranlib $@

libSockets.a:	$(SOCKETS_OBJS)
		ar cru $@ $^
		ranlib $@

libsqlite.a:	$(SQLITE_OBJS)
		ar cru $@ $^
		ranlib $@

LDFLAGS +=	-rdynamic

#------------------------------------------------
# PROGS
#------------------------------------------------
PROGS =		rrm_exe test_exe

gen-c-from-asn1:
75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110
		#-fbless-SIZE
		# Allow SIZE() constraint for INTEGER, ENUMERATED, and other types
		# for which this constraint is normally prohibited	by  the  stan-
		# dard.  This  is  a violation of ASN.1 standard, and the compiler
		# may fail to produce a meaningful code.

		#-fcompound-names
		# Using this option prevents name collisions in the target	source
		# code  by	using  complex	names  for target language structures.
		# (Name collisions may occur if the ASN.1 module reuses  the  same
		# identifiers in multiple contexts).

		#-findirect-choice
		# When  generating code for a CHOICE type, compile the CHOICE mem-
		# bers as indirect pointers instead of declaring them inline. Con-
		# sider  using this option together with -fno-include-deps to pre-
		# vent circular references.

		#-fknown-extern-type=<name>
		# Pretend the specified type is known. The	compiler  will	assume
		# the  target  language  source files for the given type have been
		# provided manually.

		#-fno-constraints
		# Do not generate ASN.1 subtype constraint checking code. This may
		# make a shorter executable.

		#-fno-include-deps
		# Do  not  generate  courtesy #include lines for non-critical type
		# dependencies.  Helps prevent namespace collisions.

		#-funnamed-unions
		# Enable unnamed unions in the definitions	of  target  language's
		# structures.
		#cd $(RRC_RRM_ASN1_DIR);asn1c -gen-PER -fcompound-names -fnative-types -fskeletons-copy  $(ASN1_RRC_SPEC_DIR)/EUTRA-RRC-Definitions.asn  $(RRC_RRM_ASN1_DIR)/rrc-rrm.asn; cd -
		cd $(RRC_RRM_ASN1_DIR);asn1c -gen-PER  -fno-include-deps -fcompound-names -fnative-types -fskeletons-copy  $(ASN1_RRC_SPEC_DIR)/EUTRA-RRC-Definitions.asn  $(RRC_RRM_ASN1_DIR)/rrc-rrm.asn; cd -
111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169


libs:
	make -j$(NUM_PROC) libasn1rrc libsqlite libSockets


all:	libs
	make -j$(NUM_PROC) $(PROGS)


rrm:	$(RRM_OBJS) lib/libSockets.a lib/libasn1rrc.a
	g++ -o $@ $^ $(LIBS)
	mv rrm $(BIN_DIR)

rrm_exe:	clean_test_objs
	make -j$(NUM_PROC) rrm



clean_test_objs:
	find $(COM_DIR)/rrc/ -name '*Response.o' -delete -print;
	find $(COM_DIR)/rrc/ -name '*Reconfiguration.o' -delete -print;

dummy_rrc:	CFLAGS += -DTEST_SCENARIO=1

dummy_rrc:	$(TEST_OBJS) lib/libSockets.a lib/libasn1rrc.a
	g++  -o  $@ $^ $(LIBS)
	mv dummy_rrc $(BIN_DIR)

test_exe:	clean_test_objs
	make -j$(NUM_PROC) dummy_rrc






clean:
	find -name '*.o' -delete -print; \
	find -name '*.bak' -delete -print; \
	find -name '*.d' -delete -print; \
	find -name '*~' -delete -print; \
	rm -f bin/*; \
	rm -f lib/*

cleanrrm:
	find src/com/rrc -name '*.o'  -delete -print; \
	find src/com/rrm -name '*.o'  -delete -print; \
	find src/com -name 'Message.o'  -delete -print; \
	find src/radio_resources -name '*.o' -delete -print; \
	find src/com -name '*.bak' -delete -print; \
	find src/radio_resources -name '*.bak' -delete -print; \
	find src/com -name '*.d' -delete -print; \
	find src/radio_resources -name '*.d' -delete -print; \
	find src/com -name '*~' -delete -print; \
	find src/radio_resources -name '*~' -delete -print; \
	rm -f bin/*; \

-include	*.d