Commit | Line | Data |
---|---|---|
d44e3c4f | 1 | ############################################################################## |
2 | # Copyright (c) 2000-2016 Ericsson Telecom AB | |
970ed795 EL |
3 | # All rights reserved. This program and the accompanying materials |
4 | # are made available under the terms of the Eclipse Public License v1.0 | |
5 | # which accompanies this distribution, and is available at | |
6 | # http://www.eclipse.org/legal/epl-v10.html | |
d44e3c4f | 7 | # |
8 | # Contributors: | |
9 | # Baji, Laszlo | |
10 | # Balasko, Jeno | |
11 | # Delic, Adam | |
12 | # Forstner, Matyas | |
13 | # Hanko, Matyas | |
14 | # Kovacs, Ferenc | |
15 | # Raduly, Csaba | |
16 | # Szabados, Kristof | |
14e21cff | 17 | # Szabo, Bence Janos |
d44e3c4f | 18 | # |
19 | ############################################################################## | |
970ed795 EL |
20 | TOPDIR := .. |
21 | include ../Makefile.regression | |
22 | ||
23 | # WARNING! This Makefile can be used with GNU make only. | |
24 | # Other versions of make may report syntax errors in it. | |
25 | ||
26 | # | |
27 | # Do NOT touch this line... | |
28 | # | |
29 | .PHONY: all archive check clean distclean dep objects | |
30 | ||
31 | .SUFFIXES: .d | |
32 | ||
33 | # | |
34 | # Set these variables... | |
35 | # | |
36 | ||
37 | ||
38 | # Flags for the C++ preprocessor (and makedepend as well): | |
39 | #CPPFLAGS := -I. $(CPPFLAGS) | |
40 | ||
41 | # Flags for dependency generation | |
42 | CXXDEPFLAGS = -MM | |
43 | ||
44 | # Flags for the C++ compiler: | |
45 | CXXFLAGS += | |
46 | ||
47 | # Flags for the linker: | |
48 | LDFLAGS += | |
49 | ||
50 | ifeq ($(PLATFORM), WIN32) | |
51 | # Silence linker warnings. | |
52 | LDFLAGS += -Wl,--enable-auto-import,--enable-runtime-pseudo-reloc | |
53 | endif | |
54 | ||
55 | # Flags for the TTCN-3 and ASN.1 compiler: | |
56 | COMPILER_FLAGS += -L $(RT2_FLAG) | |
57 | # sort removes duplicates | |
58 | COMPILER_FLAGS := $(sort $(COMPILER_FLAGS)) | |
59 | ||
60 | # Execution mode: (either ttcn3 or ttcn3-parallel) | |
61 | TTCN3_LIB = ttcn3$(RT2_SUFFIX)$(DYNAMIC_SUFFIX) | |
62 | ||
63 | # | |
64 | # You may change these variables. Add your files if necessary... | |
65 | # | |
66 | ||
67 | # TTCN-3 modules of this project: | |
68 | COMPILE_TIME_TTCN := $(wildcard $(ABS_SRC)/*_SW.ttcn) | |
69 | RUN_TIME_TTCN := $(wildcard $(ABS_SRC)/*_OK.ttcn) | |
70 | # The naming convention is not exactly obvious; _SW stands for semantic warnings | |
71 | # *_SW.ttcn are the compile-time tests which have lots (1000+) warnings of type | |
72 | # "Control never reaches this code because of previous effective condition(s)" | |
73 | # | |
74 | # *_OK.ttcn are the runtime tests. Ideally, they would be warning-free :) | |
75 | # But at least there should be no "Control never reaches ..." warnings. | |
76 | TTCN3_MODULES := $(COMPILE_TIME_TTCN) $(RUN_TIME_TTCN) | |
77 | ||
78 | # ASN.1 modules of this project: | |
79 | ASN1_MODULES := | |
80 | ||
81 | # C++ source & header files generated by TTCN-3 & ASN.1 compilers: | |
82 | GENERATED_SOURCES := $(notdir $(TTCN3_MODULES:.ttcn=.cc)) | |
83 | GENERATED_HEADERS := $(notdir $(TTCN3_MODULES:.ttcn=.hh)) | |
84 | ifdef CODE_SPLIT | |
85 | GENERATED_SOURCES := $(foreach file, $(GENERATED_SOURCES:.cc=), $(addprefix $(file), .cc _seq.cc _set.cc _seqof.cc _setof.cc _union.cc)) | |
14e21cff | 86 | else ifdef SPLIT_TO_SLICES |
87 | POSTFIXES := $(foreach file, $(SPLIT_TO_SLICES), $(addsuffix $(file), _part_)) | |
88 | POSTFIXES := $(foreach file, $(POSTFIXES), $(addprefix $(file), .cc)) | |
89 | GENERATED_SOURCES2 := $(foreach file, $(GENERATED_SOURCES:.cc=), $(addprefix $(file), $(POSTFIXES))) | |
90 | GENERATED_SOURCES += $(GENERATED_SOURCES2) | |
91 | COMPILER_FLAGS += $(SPLIT_FLAG) | |
970ed795 EL |
92 | endif |
93 | ||
94 | # Source & header files of Test Ports and your other modules: | |
95 | USER_SOURCES = | |
96 | USER_HEADERS = $(USER_SOURCES:.cc=.hh) | |
97 | ||
98 | # Object files of this project that are needed for the executable test suite: | |
99 | OBJECTS = $(GENERATED_OBJECTS) $(USER_OBJECTS) | |
100 | ||
101 | GENERATED_OBJECTS = $(GENERATED_SOURCES:.cc=.o) | |
102 | ||
103 | USER_OBJECTS = $(USER_SOURCES:.cc=.o) | |
104 | ||
105 | DEPFILES = $(USER_OBJECTS:.o=.d) $(GENERATED_OBJECTS:.o=.d) | |
106 | ||
107 | # Other files of the project (Makefile, configuration files, etc.) | |
108 | # that will be added to the archived source files: | |
109 | OTHER_FILES = Makefile | |
110 | ||
111 | # The name of the executable test suite: | |
112 | TARGET := PreDef$(EXESUFFIX) | |
113 | ||
114 | # | |
115 | # Rules for building the executable... | |
116 | # | |
117 | all: $(TARGET) ; | |
118 | ||
119 | objects: $(OBJECTS) ; | |
120 | ||
121 | $(TARGET): $(OBJECTS) | |
122 | $(CXX) $(LDFLAGS) -o $@ $^ \ | |
123 | -L$(TTCN3_DIR)/lib -l$(TTCN3_LIB) \ | |
124 | -L$(OPENSSL_DIR)/lib -lcrypto \ | |
125 | -L$(XMLDIR)/lib $($(PLATFORM)_LIBS) \ | |
126 | || $(TTCN3_DIR)/bin/titanver $(OBJECTS) | |
127 | ||
128 | .cc.o .c.o: | |
129 | $(CXX) -c $(CPPFLAGS) $(CXXFLAGS) -o $@ $< | |
130 | ||
131 | .cc.d .c.d: | |
132 | @echo Creating dependency file for '$<'; set -e; \ | |
133 | $(CXX) $(CXXDEPFLAGS) $(CPPFLAGS) $(CXXFLAGS) $< \ | |
134 | | sed 's/\($*\)\.o[ :]*/\1.o $@ : /g' > $@; \ | |
135 | [ -s $@ ] || rm -f $@ | |
136 | ||
137 | $(GENERATED_SOURCES) $(GENERATED_HEADERS): compile | |
138 | @if [ ! -f $@ ]; then $(RM) compile; $(MAKE) compile; fi | |
139 | ||
140 | compile: $(TTCN3_MODULES) $(ASN1_MODULES) | |
141 | $(TOP_SRC)/../function_test/Semantic_Analyser/cw.pl $(COMPILER_FLAGS) $^ - $? | |
142 | touch $@ | |
143 | ||
144 | clean: | |
145 | -$(RM) $(TARGET) $(OBJECTS) $(GENERATED_HEADERS) \ | |
146 | $(GENERATED_SOURCES) compile $(DEPFILES) \ | |
147 | tags *.log | |
148 | ||
149 | distclean: clean | |
150 | -$(RM) $(DEPFILES) | |
151 | ||
152 | dep: $(GENERATED_SOURCES) $(USER_SOURCES) ; | |
153 | ||
154 | ifeq ($(findstring n,$(MAKEFLAGS)),) | |
155 | ifeq ($(filter clean distclean check compile archive diag,$(MAKECMDGOALS)),) | |
156 | -include $(DEPFILES) | |
157 | endif | |
158 | endif | |
159 | ||
160 | ||
161 | diag: | |
162 | $(TTCN3_DIR)/bin/compiler -v 2>&1 | |
163 | $(TTCN3_DIR)/bin/mctr_cli -v 2>&1 | |
164 | $(CXX) -v 2>&1 | |
165 | @echo TTCN3_DIR=$(TTCN3_DIR) | |
166 | @echo OPENSSL_DIR=$(OPENSSL_DIR) | |
167 | @echo XMLDIR=$(XMLDIR) | |
168 | @echo PLATFORM=$(PLATFORM) | |
169 | ||
170 | # | |
171 | # Add your rules here if necessary... | |
172 | # | |
173 | run: $(TARGET) PreDef.cfg | |
174 | ./$^ | |
175 | ||
176 | ||
177 | %.cc: %.ttcn | |
178 | mycompiler $(COMPILER_FLAGS) $^ | |
179 | ||
180 | .PRECIOUS: %.cc |