Makefile 4.16 KB
Newer Older
filatov's avatar
filatov committed
1
2
3
4
5
6
7
8
9
10
##########################################################
#  This Makefile is to build the ASN1 library to be used
#  for external codec in Titan
#  This Makefile is expected that asn1c compiler is 
#  installed in the PATHs
##########################################################

# The name of the library
ASN_LIBRARY = libItsAsn.so 
# ASN.1 files to be included in the library
Denis Filatov's avatar
Denis Filatov committed
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
ASN_FILES = CAM/CAM.asn \
            DENM/DENM.asn \
            IS/ETSI_TS_103301/IVIM_PDU_Descriptions.asn \
            IS/ETSI_TS_103301/MAPEM_PDU_Descriptions.asn \
            IS/ETSI_TS_103301/SPATEM_PDU_Descriptions.asn \
            IS/ETSI_TS_103301/SREM_PDU_Descriptions.asn \
            IS/ETSI_TS_103301/SSEM_PDU_Descriptions.asn \
            IS/ISO_TS_14816/AVIAEINumberingAndDataStructures.asn \
            IS/ISO_TS_14906/EfcDsrcApplication.asn \
            IS/ISO_TS_14906/EfcDsrcGeneric.asn \
            IS/ISO_TS_17419/CITSapplMgmtIDs.asn \
            IS/ISO_TS_19091/original/AddGrpC.asn \
            IS/ISO_TS_19091/original/DSRC.asn \
            IS/ISO_TS_19091/original/REGION.asn \
            IS/ISO_TS_19321/IVI.asn \
            IS/ISO_TS_24534-3/ElectronicRegistrationIdentificationVehicleDataModule.asn \
            ITS-Container/ITS_Container.asn \
            Security/1609Dot2/IEEE1609dot2.asn \
            Security/1609Dot2/IEEE1609dot2BaseTypes.asn \
30
31
32
33
34
35
36
37
38
39
            Security/TS102921/EtsiTs102941BaseTypes.asn \
            Security/TS102921/EtsiTs102941MessagesCA.asn \
            Security/TS102921/EtsiTs102941TrustLists.asn \
            Security/TS102921/EtsiTs102941TypesAuthorization.asn \
            Security/TS102921/EtsiTs102941TypesAuthorizationValidation.asn \
            Security/TS102921/EtsiTs102941TypesCaManagement.asn \
            Security/TS102921/EtsiTs102941TypesEnrolment.asn \
            Security/EtsiTs103097Module.asn \


filatov's avatar
filatov committed
40
# PDUs
41
PDU = CAM DENM MAPEM SPATEM SREM SSEM IVIM EtsiTs103097Data EtsiTs103097Certificate EtsiTs102941Data
filatov's avatar
filatov committed
42

43
44
45
#patches
PATCHES = PsidGroupPermissions.c.diff

filatov's avatar
filatov committed
46
47
48
49
50
51
52
53
54
55
56
57
58
ASN1C:=asn1c
#Override ASN1C instalation path
#ASN1C_PATH = 

ifneq (, $(ASN1C_PATH))
OS=$(shell uname)
ifneq ("CYGWIN_NT-6.1", $(OS))
ASN1C:=$(ASN1C_PATH)/asn1c/asn1c -S $(ASN1C_PATH)/skeletons
else
ASN1C:=$(ASN1C_PATH)/asn1c/asn1c.exe -S $(ASN1C_PATH)/skeletons
endif
endif

Denis Filatov's avatar
Denis Filatov committed
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
ifeq (,$(ASN_DIR))
##########################################################
# Build path for the library
BIN_DIR := .
SCRIPT_DIR := $(dir $(lastword $(MAKEFILE_LIST)))
ASN_DIR := $(dir $(SCRIPT_DIR))../ttcn/LibIts/asn1

.PHONY: FORCE

all: $(BIN_DIR)/$(ASN_LIBRARY)
clean:
	rm -rf $(BIN_DIR)

$(BIN_DIR)/$(ASN_LIBRARY): $(BIN_DIR)/Makefile
	make -C $(BIN_DIR) all

$(BIN_DIR):
	mkdir -p $@

$(BIN_DIR)/Makefile: $(BIN_DIR) $(SCRIPT_DIR)/Makefile
	echo SCRIPT_DIR=$(SCRIPT_DIR) > $@
	echo ASN_DIR=$(ASN_DIR)       >>$@
	cat $(SCRIPT_DIR)/Makefile    >>$@

##########################################################
else
##########################################################
# This part is executed within the BIN_DIR directory to
# override variables from the Makefile.am.libasncodec 
# generated by asn1c
filatov's avatar
filatov committed
89
90
91
92
93
94
95
96
LIB_MAKEFILE=Makefile.am.libasncodec
include $(LIB_MAKEFILE)
OBJS = ${ASN_MODULE_SRCS:.c=.o}
CONVERTER=converter
ASN_CONVERTER_SOURCES := \
	converter-example.c\
	pdu_collection.c
CONVERTER_OBJS=${ASN_CONVERTER_SOURCES:.c=.o}
garciay's avatar
garciay committed
97
CFLAGS += $(ASN_MODULE_CFLAGS) -DPDU=CAM -DASN_PDU_COLLECTION -fPIC -I.
filatov's avatar
filatov committed
98

Denis Filatov's avatar
Denis Filatov committed
99
all: Makefile $(CONVERTER)
filatov's avatar
filatov committed
100
101
102

$(LIB_MAKEFILE): $(addprefix $(ASN_DIR)/, $(ASN_FILES))
	$(ASN1C) -gen-PER -gen-OER $(addprefix -pdu=,$(PDU)) -fcompound-names $^
garciay's avatar
garciay committed
103
	-for n in $(PATCHES); do git apply "$(SCRIPT_DIR)/$$n"; done
filatov's avatar
filatov committed
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124

$(CONVERTER): $(ASN_LIBRARY) $(CONVERTER_OBJS) 
	$(CC) $(CFLAGS) -o $@ $(CONVERTER_OBJS) $(ASN_LIBRARY) $(LIBS)

$(ASN_LIBRARY): ${ASN_MODULE_SRCS:.c=.o}
	$(CC) $(CFLAGS) -o $@ $^ -shared $(LDFLAGS) $(LIBS)

.SUFFIXES:
.SUFFIXES: .c .o

.c.o:
	$(CC) $(CFLAGS) -o $@ -c $<

clean:
	rm -f $(CONVERTER) $(ASN_LIBRARY)
	rm -f $(OBJS) $(CONVERTER_OBJS)

regen: clear-asn1c $(LIB_MAKEFILE)
clear-asn1c:
	rm -f $(LIB_MAKEFILE)

Denis Filatov's avatar
Denis Filatov committed
125
126
127
128
Makefile: $(SCRIPT_DIR)/Makefile
	echo SCRIPT_DIR=$(SCRIPT_DIR) > $@
	echo ASN_DIR=$(ASN_DIR) >>$@
	cat $<                  >>$@
filatov's avatar
filatov committed
129
##########################################################
Denis Filatov's avatar
Denis Filatov committed
130
endif