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