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 | # Raduly, Csaba | |
14e21cff | 12 | # Szabo, Bence Janos |
d44e3c4f | 13 | # |
14 | ############################################################################## | |
970ed795 EL |
15 | TOPDIR := ../.. |
16 | include ../../Makefile.regression | |
17 | ||
18 | .SUFFIXES: .ttcn .hh .cc .d | |
19 | .PHONY: all clean dep run convert | |
20 | ||
21 | # Execution mode: (either ttcn3 or ttcn3-parallel) | |
22 | TTCN3_LIB := ttcn3$(RT2_SUFFIX)$(DYNAMIC_SUFFIX) | |
23 | ||
24 | #CPPFLAGS | |
25 | #CXXFLAGS | |
26 | #COMPILER_FLAGS += | |
27 | ||
28 | GENERATED_TTCN := XSD.ttcn UsefulTtcn3Types.ttcn \ | |
29 | www_example_org_Schema1.ttcn www_example_org_Schema2.ttcn www_example_org_Import.ttcn | |
30 | ||
31 | TTCN3_MODULES := tester.ttcn $(GENERATED_TTCN) | |
32 | ||
33 | #ttcn_ericsson_se_protocolModules_xtdp1_0_xtdl2.ttcn | |
34 | #ttcn_ericsson_se_protocolModules_xtdp1_0_xtdl.ttcn | |
35 | ||
36 | GENERATED_SOURCES := $(TTCN3_MODULES:.ttcn=.cc) | |
37 | GENERATED_HEADERS := $(GENERATED_SOURCES:.cc=.hh) | |
38 | ifdef CODE_SPLIT | |
39 | GENERATED_SOURCES := $(foreach file, $(GENERATED_SOURCES:.cc=), $(addprefix $(file), .cc _seq.cc _set.cc _seqof.cc _setof.cc _union.cc)) | |
14e21cff | 40 | else ifdef SPLIT_TO_SLICES |
41 | POSTFIXES := $(foreach file, $(SPLIT_TO_SLICES), $(addsuffix $(file), _part_)) | |
42 | POSTFIXES := $(foreach file, $(POSTFIXES), $(addprefix $(file), .cc)) | |
43 | GENERATED_SOURCES2 := $(foreach file, $(GENERATED_SOURCES:.cc=), $(addprefix $(file), $(POSTFIXES))) | |
44 | GENERATED_SOURCES += $(GENERATED_SOURCES2) | |
970ed795 EL |
45 | endif |
46 | USER_SOURCES = | |
47 | USER_HEADERS = $(USER_SOURCES:.cc=.hh) | |
48 | ||
49 | OBJECTS = $(GENERATED_SOURCES:.cc=.o) $(USER_SOURCES:.cc=.o) | |
50 | ||
51 | DEPFILES := $(OBJECTS:.o=.d) | |
52 | ||
53 | TARGET = Schemas$(EXESUFFIX) | |
54 | ||
55 | all: $(TARGET) | |
56 | ||
57 | ifeq ($(findstring dynamic,$(TTCN3_LIB)),) | |
58 | # not dynamic | |
59 | CORELIB_BINARY := $(TTCN3_DIR)/lib/lib$(TTCN3_LIB).a | |
60 | else | |
61 | CORELIB_BINARY := $(TTCN3_DIR)/lib/lib$(TTCN3_LIB).so | |
62 | endif | |
63 | ||
64 | # libttcn3.a appears twice; this should be harmless | |
65 | $(TARGET): $(OBJECTS) $(CORELIB_BINARY) | |
66 | $(CXX) $(LDFLAGS) -o $@ $(OBJECTS) \ | |
67 | -L$(TTCN3_DIR)/lib -l$(TTCN3_LIB) \ | |
68 | -L$(OPENSSL_DIR)/lib -lcrypto $($(PLATFORM)_LIBS) \ | |
69 | || $(TTCN3_DIR)/bin/titanver $(OBJECTS) | |
70 | ||
71 | %.o: %.cc | |
72 | @echo '(C++)' $<; $(CXX) -c $(CPPFLAGS) $(CXXFLAGS) $< | |
73 | ||
74 | %.d: %.cc | |
75 | @echo '(dep)' $<; $(CXX) -MM -MP -MF $@ $(CPPFLAGS) $(CXXFLAGS) $< | |
76 | ||
77 | $(GENERATED_SOURCES) $(GENERATED_HEADERS): compile | |
78 | @if [ ! -f $@ ]; then $(RM) compile; $(MAKE) compile; fi | |
79 | ||
80 | ||
81 | compile:: $(firstword $(TTCN3_COMPILER)) | |
82 | @if [ -f $@ ]; then $(RM) compile; $(MAKE) compile; fi | |
83 | # if [ -f $(GENERATED_SOURCES) ]; then rm -f $(GENERATED_SOURCES); $(MAKE) $(GENERATED_SOURCES); fi | |
84 | ||
85 | compile:: $(TTCN3_MODULES) $(PREPROCESSED_TTCN3_MODULES) $(ASN1_MODULES) | |
86 | # "modulepar boolean verbose" makes this unusable with old names | |
87 | $(TTCN3_COMPILER) $(COMPILER_FLAGS) $^ - $? | |
88 | touch $@ | |
89 | ||
90 | clean celan clena: | |
91 | -$(RM) $(TARGET) $(OBJECTS) $(GENERATED_HEADERS) \ | |
92 | $(GENERATED_SOURCES) $(PREPROCESSED_TTCN3_MODULES) compile \ | |
93 | tags *.log | |
94 | ||
95 | distclean: clean | |
96 | rm -f $(GENERATED_TTCN) $(DEPFILES) | |
97 | ||
98 | $(GENERATED_TTCN) convert: Schema1.xsd Schema2.xsd Importer.xsd | |
99 | $(TTCN3_DIR)/bin/xsd2ttcn -z $^ | |
100 | ||
101 | RUN := $(shell which colortitan 2>/dev/null) | |
102 | ifeq ($(firstword $(RUN)),no) | |
103 | # stupid /bin/which on Solaris writes errors to stdout instead of stderr | |
104 | RUN := | |
105 | endif | |
106 | ||
107 | run: $(TARGET) config.cfg | |
108 | $(RUN) ./$^ | |
109 | ||
110 | debug: | |
111 | $(MAKE) run RUN='gdb --args' | |
112 | ||
113 | ||
114 | dep: ; | |
115 | ||
116 | ifeq (,$(findstring n,$(MAKEFLAGS))) | |
117 | ifeq (,$(filter clean distclean,$(MAKECMDGOALS))) | |
118 | #-include $(DEPFILES) | |
119 | endif | |
120 | endif | |
121 | ||
122 | vpath %.xsd $(ABS_SRC) | |
123 |