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 | ORIG ?= . | |
12 | ||
13 | # WARNING! This Makefile can be used with GNU make only. | |
14 | # Other versions of make may report syntax errors in it. | |
15 | ||
16 | # | |
17 | # Do NOT touch this line... | |
18 | # | |
19 | .PHONY: all check clean dep objects preprocess | |
20 | ||
21 | # | |
22 | # Set these variables... | |
23 | # | |
24 | ||
25 | ||
26 | # C preprocessor used for TTCN-3 files: | |
27 | CPP = cpp | |
28 | ||
29 | # Flags for the C++ preprocessor (and makedepend as well): | |
30 | CPPFLAGS += -D$(PLATFORM) | |
31 | # -I$(TTCN3_DIR)/include | |
32 | ||
33 | # Flags for preprocessing TTCN-3 files: | |
34 | #CPPFLAGS_TTCN3 += | |
35 | ||
36 | # Flags for the C++ compiler: (-Wall already in) | |
37 | CXXFLAGS += -g -W -Wformat=2 | |
38 | ||
39 | # Flags for the linker: | |
40 | LDFLAGS += -g | |
41 | ||
42 | # Local flags for Titan (can be overridden from the environment or commandline) | |
43 | TTCNFLAGS += -b -r -x | |
44 | ||
45 | # Flags for the TTCN-3 and ASN.1 compiler | |
46 | # (common flags already set in Makefile.regression) | |
47 | COMPILER_FLAGS += $(TTCNFLAGS) | |
48 | ||
49 | # $(sort ) also eliminates duplicates | |
50 | COMPILER_FLAGS := $(sort $(COMPILER_FLAGS)) | |
51 | ||
52 | # Execution mode: (either ttcn3 or ttcn3-parallel) | |
53 | TTCN3_LIB = ttcn3$(RT2_SUFFIX)$(DYNAMIC_SUFFIX) | |
54 | ||
55 | ||
56 | # | |
57 | # You may change these variables. Add your files if necessary... | |
58 | # | |
59 | ||
60 | # TTCN-3 modules to preprocess: | |
61 | TTCN3_PP_MODULES = $(wildcard $(ABS_SRC)/*.ttcnpp) | |
62 | ||
63 | # Files to include in TTCN-3 preprocessed modules: | |
64 | TTCN3_INCLUDES = $(TOP_SRC)/XML/macros.ttcnin | |
65 | ||
66 | # ASN.1 modules of this project: | |
67 | ASN1_MODULES = | |
68 | ||
69 | # TTCN-3 source files generated by the C preprocessor: | |
70 | PREPROCESSED_TTCN3_MODULES := $(notdir $(TTCN3_PP_MODULES:.ttcnpp=.ttcn)) | |
71 | ||
72 | # TTCN-3 modules of this project: | |
73 | TTCN3_MODULES = smallany.ttcn noany.ttcn | |
74 | ||
75 | # C++ source & header files generated from the TTCN-3 & ASN.1 modules of | |
76 | # this project: | |
77 | GENERATED_SOURCES = $(TTCN3_MODULES:.ttcn=.cc) $(PREPROCESSED_TTCN3_MODULES:.ttcn=.cc) $(ASN1_MODULES:.asn=.cc) | |
78 | GENERATED_HEADERS = $(GENERATED_SOURCES:.cc=.hh) | |
79 | ifdef CODE_SPLIT | |
80 | GENERATED_SOURCES := $(foreach file, $(GENERATED_SOURCES:.cc=), $(addprefix $(file), .cc _seq.cc _set.cc _seqof.cc _setof.cc _union.cc)) | |
81 | endif | |
82 | ||
83 | # C/C++ Source & header files of Test Ports, external functions and | |
84 | # other modules: | |
85 | USER_SOURCES = | |
86 | USER_HEADERS = $(USER_SOURCES:.cc=.hh) | |
87 | ||
88 | # Object files of this project that are needed for the executable test suite: | |
89 | OBJECTS = $(GENERATED_SOURCES:.cc=.o) $(USER_SOURCES:.cc=.o) | |
90 | ||
91 | # The name of the executable test suite: | |
92 | TARGET = AnytypeTest | |
93 | ||
94 | ||
95 | # | |
96 | # Rules for building the executable... | |
97 | # | |
98 | ||
99 | all: $(TARGET) ; | |
100 | ||
101 | objects: $(OBJECTS) ; | |
102 | ||
103 | $(TARGET): $(GENERATED_SOURCES) $(USER_SOURCES) | |
104 | $(CXX) $(CPPFLAGS) $(CXXFLAGS) $(LDFLAGS) -o $@ $^ \ | |
105 | -L$(TTCN3_DIR)/lib -l$(TTCN3_LIB) \ | |
106 | -L$(OPENSSL_DIR)/lib -lcrypto \ | |
107 | -L$(XMLDIR)/lib $($(PLATFORM)_LIBS) | |
108 | ||
109 | %.ttcn: %.ttcnpp $(TTCN3_INCLUDES) | |
110 | $(CPP) -x c -nostdinc $(CPPFLAGS_TTCN3) $< $@ | |
111 | ||
112 | preprocess: $(PREPROCESSED_TTCN3_MODULES) ; | |
113 | ||
114 | $(GENERATED_SOURCES) $(GENERATED_HEADERS): compile | |
115 | @if [ ! -f $@ ]; then $(RM) compile; $(MAKE) compile; fi | |
116 | ||
117 | ifeq ($(findstring dynamic,$(TTCN3_LIB)),) | |
118 | # not dynamic | |
119 | CORELIB_BINARY := $(TTCN3_DIR)/lib/lib$(TTCN3_LIB).a | |
120 | else | |
121 | CORELIB_BINARY := $(TTCN3_DIR)/lib/lib$(TTCN3_LIB).so | |
122 | endif | |
123 | ||
124 | ||
125 | compile:: $(firstword $(TTCN3_COMPILER)) $(CORELIB_BINARY) | |
126 | @if [ -f $@ ]; then $(RM) compile; $(MAKE) compile; fi | |
127 | ||
128 | compile:: $(TTCN3_MODULES) $(PREPROCESSED_TTCN3_MODULES) $(ASN1_MODULES) | |
129 | # no old names due to modulepar verbose | |
130 | $(filter-out -Nold -E, $(TTCN3_COMPILER) $(COMPILER_FLAGS)) $^ - $? | |
131 | touch $@ | |
132 | ||
133 | clean distclean: | |
134 | -$(RM) $(TARGET) $(OBJECTS) $(GENERATED_HEADERS) \ | |
135 | $(GENERATED_SOURCES) $(PREPROCESSED_TTCN3_MODULES) compile \ | |
136 | tags *.log | |
137 | ||
138 | dep: $(GENERATED_SOURCES) $(USER_SOURCES) | |
139 | makedepend $(CPPFLAGS) $^ | |
140 | ||
141 | # | |
142 | # Add your rules here if necessary... | |
143 | # | |
144 | ||
145 | install: | |
146 | @echo You cannot be serious! | |
147 | ||
148 | re: | |
149 | rm -f compile | |
150 | ||
151 | RUN := $(shell which colortitan) | |
152 | ifeq ($(firstword $(RUN)),no) | |
153 | # stupid /bin/which on Solaris writes errors to stdout instead of stderr | |
154 | RUN := | |
155 | endif | |
156 | ||
157 | ||
158 | run: $(TARGET) config.cfg | |
159 | $(RUN) ./$^ | |
160 |