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 | # | |
12 | # Do NOT touch this line... | |
13 | # | |
14 | .PHONY: all run archive check clean dep objects | |
15 | ||
16 | .SUFFIXES: .d | |
17 | ||
18 | # | |
19 | # Set these variables... | |
20 | # | |
21 | ||
22 | #CXXFLAGS += -save-temps | |
23 | CXXFLAGS += -g | |
24 | ||
25 | # Flags for dependency generation | |
26 | CXXDEPFLAGS = -MM | |
27 | ||
28 | #COMPILER_FLAGS += | |
29 | ||
30 | # Flags for the linker: | |
31 | LDFLAGS += -g | |
32 | ||
33 | ifeq ($(PLATFORM), WIN32) | |
34 | # Silence linker warnings. | |
35 | LDFLAGS += -Wl,--enable-auto-import,--enable-runtime-pseudo-reloc | |
36 | endif | |
37 | ||
38 | # Flags for the TTCN-3 and ASN.1 compiler: | |
39 | #COMPILER_FLAGS += -L | |
40 | ||
41 | # Execution mode: (either ttcn3 or ttcn3-parallel) | |
42 | TTCN3_LIB = ttcn3$(RT2_SUFFIX)$(DYNAMIC_SUFFIX) | |
43 | ||
44 | ||
45 | # TTCN-3 modules of this project: | |
46 | TTCN3_MODULES = slider.ttcn dual.ttcn dual2.ttcn | |
47 | ||
48 | ifdef RT2 | |
49 | TTCN3_MODULES += dualnegtest.ttcn | |
50 | RT2CFG := run-rt2.cfg | |
51 | endif | |
52 | ||
53 | # ASN.1 modules of this project: | |
54 | ASN1_MODULES = | |
55 | ||
56 | # C++ source & header files generated from the TTCN-3 & ASN.1 modules of | |
57 | # this project: | |
58 | GENERATED_SOURCES = $(TTCN3_MODULES:.ttcn=.cc) $(ASN1_MODULES:.asn=.cc) | |
59 | GENERATED_HEADERS = $(GENERATED_SOURCES:.cc=.hh) | |
60 | ||
61 | # C/C++ Source & header files of Test Ports, external functions and | |
62 | # other modules: | |
63 | USER_SOURCES = PT1.cc UNDER.cc | |
64 | USER_HEADERS = $(USER_SOURCES:.cc=.hh) | |
65 | ||
66 | # Object files of this project that are needed for the executable test suite: | |
67 | OBJECTS = $(GENERATED_OBJECTS) $(USER_OBJECTS) | |
68 | ||
69 | GENERATED_OBJECTS = $(GENERATED_SOURCES:.cc=.o) | |
70 | ||
71 | USER_OBJECTS = $(USER_SOURCES:.cc=.o) | |
72 | ||
73 | DEPFILES = $(USER_OBJECTS:.o=.d) $(GENERATED_OBJECTS:.o=.d) | |
74 | ||
75 | # Other files of the project (Makefile, configuration files, etc.) | |
76 | # that will be added to the archived source files: | |
77 | OTHER_FILES = Makefile | |
78 | ||
79 | # The name of the executable test suite: | |
80 | TARGET = slider$(EXESUFFIX) | |
81 | ||
82 | # | |
83 | # Rules for building the executable... | |
84 | # | |
85 | ||
86 | all: $(TARGET) ; | |
87 | ||
88 | objects: $(OBJECTS) ; | |
89 | ||
90 | $(TARGET): $(OBJECTS) | |
91 | $(TTCN3_DIR)/bin/titanver $(OBJECTS) | |
92 | $(CXX) $(LDFLAGS) -o $@ $^ \ | |
93 | -L$(TTCN3_DIR)/lib -l$(TTCN3_LIB) \ | |
94 | -L$(OPENSSL_DIR)/lib -lcrypto \ | |
95 | -L$(XMLDIR)/lib $($(PLATFORM)_LIBS) | |
96 | ||
97 | .cc.o .c.o: | |
98 | $(CXX) -c $(CPPFLAGS) $(CXXFLAGS) -o $@ $< | |
99 | ||
100 | .cc.d .c.d: | |
101 | @echo Creating dependency file for '$<'; set -e; \ | |
102 | $(CXX) $(CXXDEPFLAGS) $(CPPFLAGS) $(CXXFLAGS) $< \ | |
103 | | sed 's/\($*\)\.o[ :]*/\1.o $@ : /g' > $@; \ | |
104 | [ -s $@ ] || rm -f $@ | |
105 | ||
106 | $(GENERATED_SOURCES) $(GENERATED_HEADERS): compile | |
107 | @if [ ! -f $@ ]; then $(RM) compile; $(MAKE) compile; fi | |
108 | ||
109 | compile:: $(TTCN3_DIR)/bin/compiler # $(TTCN3_COMPILER) | |
110 | @if [ -f $@ ]; then $(RM) compile; $(MAKE) compile; fi | |
111 | ||
112 | compile:: $(TTCN3_MODULES) $(ASN1_MODULES) | |
113 | $(TTCN3_COMPILER) $(COMPILER_FLAGS) $^ - $? | |
114 | touch $@ | |
115 | ||
116 | clean distclean: | |
117 | -$(RM) $(TARGET) $(OBJECTS) $(GENERATED_HEADERS) \ | |
118 | $(GENERATED_SOURCES) compile $(DEPFILES) \ | |
119 | tags *.log $(RT2CFG) | |
120 | ||
121 | dep: $(GENERATED_SOURCES) $(USER_SOURCES) ; | |
122 | ||
123 | ifeq ($(findstring n,$(MAKEFLAGS)),) | |
124 | ifeq ($(filter clean distclean check compile archive diag,$(MAKECMDGOALS)),) | |
125 | -include $(DEPFILES) | |
126 | endif | |
127 | endif | |
128 | ||
129 | ||
130 | # | |
131 | # Add your rules here if necessary... | |
132 | # | |
133 | run: $(TARGET) run$(RT2_SUFFIX).cfg | |
134 | ./$^ | |
135 | # cat $(TARGET).log | |
136 | # don't write the log, it confuses Eclipse | |
137 | ||
138 | rerun: | |
139 | rm -f compile; $(MAKE) run | |
140 | ||
141 | run-rt2.cfg: run.cfg Makefile | |
142 | perl -pwle 's/^(dual2)$$/$$1\ndualnegtest/' $< > $@ | |
143 | ||
144 | run-dynamic.cfg: run.cfg | |
145 | ln -s $^ $@ | |
146 | ||
147 | run-rt2-dynamic.cfg: run-rt2.cfg | |
148 | ln -s $^ $@ | |
149 | ||
150 | ||
151 | ifdef SRCDIR | |
152 | $(foreach src, $(USER_SOURCES), $(eval vpath $(src) $(ABS_SRC))) | |
153 | endif |