| 1 |
############################################################################## |
| 2 |
# Copyright (c) 2000-2021 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 v2.0 |
| 5 |
# which accompanies this distribution, and is available at |
| 6 |
# https://www.eclipse.org/org/documents/epl-2.0/EPL-2.0.html |
| 7 |
# |
| 8 |
# Contributors: |
| 9 |
# Baji, Laszlo |
| 10 |
# Balasko, Jeno |
| 11 |
# Raduly, Csaba |
| 12 |
# Szabo, Bence Janos |
| 13 |
# |
| 14 |
############################################################################## |
| 15 |
TOPDIR := ../.. |
| 16 |
include ../../Makefile.regression |
| 17 |
|
| 18 |
ORIG ?= . |
| 19 |
|
| 20 |
CPP := cpp |
| 21 |
|
| 22 |
# Flags for the C++ preprocessor (and makedepend as well): |
| 23 |
#CPPFLAGS += |
| 24 |
|
| 25 |
# Flags for preprocessing TTCN-3 files: |
| 26 |
#CPPFLAGS_TTCN3 += |
| 27 |
|
| 28 |
# Flags for the C++ compiler: |
| 29 |
CXXFLAGS += -g -fmessage-length=0 |
| 30 |
|
| 31 |
# Flags for the linker: |
| 32 |
LDFLAGS += -g |
| 33 |
|
| 34 |
WIN32_LIBS += -liconv |
| 35 |
INTERIX_LIBS += -L/usr/local/lib -liconv |
| 36 |
FREEBSD_LIBS += -liconv |
| 37 |
|
| 38 |
# Local flags for Titan (can be overridden from the environment or commandline) |
| 39 |
TTCNFLAGS := -b -r -x |
| 40 |
|
| 41 |
# Flags for the TTCN-3 and ASN.1 compiler |
| 42 |
# (common flags already set in Makefile.regression) |
| 43 |
COMPILER_FLAGS += $(TTCNFLAGS) -a |
| 44 |
|
| 45 |
# $(sort ) also eliminates 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 |
## |
| 53 |
|
| 54 |
# TTCN-3 modules of this project: |
| 55 |
TTCN3_MODULES = converter.ttcn $(wildcard $(ORIG)/xtd*.ttcn) |
| 56 |
# UTF8.ttcn |
| 57 |
|
| 58 |
# TTCN-3 modules to preprocess: |
| 59 |
TTCN3_PP_MODULES := $(wildcard $(ORIG)/*.ttcnpp) |
| 60 |
|
| 61 |
|
| 62 |
# Files to include in TTCN-3 preprocessed modules: |
| 63 |
TTCN3_INCLUDES = ../macros.ttcnin |
| 64 |
|
| 65 |
# TTCN-3 source files generated by the C preprocessor: |
| 66 |
PREPROCESSED_TTCN3_MODULES := $(notdir $(TTCN3_PP_MODULES:.ttcnpp=.ttcn)) |
| 67 |
|
| 68 |
|
| 69 |
# C++ source & header files generated from the TTCN-3 & ASN.1 modules of |
| 70 |
# this project: |
| 71 |
GENERATED_SOURCES := $(TTCN3_MODULES:.ttcn=.cc) $(PREPROCESSED_TTCN3_MODULES:.ttcn=.cc) $(ASN1_MODULES:.asn=.cc) |
| 72 |
GENERATED_HEADERS := $(GENERATED_SOURCES:.cc=.hh) |
| 73 |
ifdef CODE_SPLIT |
| 74 |
GENERATED_SOURCES := $(foreach file, $(GENERATED_SOURCES:.cc=), $(addprefix $(file), .cc _seq.cc _set.cc _seqof.cc _setof.cc _union.cc)) |
| 75 |
else ifdef SPLIT_TO_SLICES |
| 76 |
POSTFIXES := $(foreach file, $(SPLIT_TO_SLICES), $(addsuffix $(file), _part_)) |
| 77 |
POSTFIXES := $(foreach file, $(POSTFIXES), $(addprefix $(file), .cc)) |
| 78 |
GENERATED_SOURCES2 := $(foreach file, $(GENERATED_SOURCES:.cc=), $(addprefix $(file), $(POSTFIXES))) |
| 79 |
GENERATED_SOURCES += $(GENERATED_SOURCES2) |
| 80 |
endif |
| 81 |
|
| 82 |
# C/C++ Source & header files of Test Ports, external functions and |
| 83 |
# other modules: |
| 84 |
USER_SOURCES := iconver.cc |
| 85 |
USER_HEADERS := $(USER_SOURCES:.cc=.hh) |
| 86 |
|
| 87 |
# Object files of this project that are needed for the executable test suite: |
| 88 |
OBJECTS := $(GENERATED_SOURCES:.cc=.o) $(USER_SOURCES:.cc=.o) |
| 89 |
|
| 90 |
# The name of the executable test suite: |
| 91 |
TARGET := HN15589$(RT2_SUFFIX)$(EXESUFFIX) |
| 92 |
|
| 93 |
# |
| 94 |
# Rules for building the executable... |
| 95 |
# |
| 96 |
|
| 97 |
all: $(TARGET) |
| 98 |
|
| 99 |
objects: $(OBJECTS) ; |
| 100 |
|
| 101 |
ifeq ($(findstring dynamic,$(TTCN3_LIB)),) |
| 102 |
# not dynamic |
| 103 |
CORELIB_BINARY := $(TTCN3_DIR)/lib/lib$(TTCN3_LIB).a |
| 104 |
else |
| 105 |
CORELIB_BINARY := $(TTCN3_DIR)/lib/lib$(TTCN3_LIB).so |
| 106 |
endif |
| 107 |
|
| 108 |
# libttcn3.a appears twice; this should be harmless |
| 109 |
$(TARGET): $(OBJECTS) $(CORELIB_BINARY) |
| 110 |
$(CXX) $(LDFLAGS) -o $@ $(OBJECTS) \ |
| 111 |
-L$(TTCN3_DIR)/lib -l$(TTCN3_LIB) \ |
| 112 |
-L$(OPENSSL_DIR)/lib -lcrypto $($(PLATFORM)_LIBS) \ |
| 113 |
|| $(TTCN3_DIR)/bin/titanver $(OBJECTS) |
| 114 |
|
| 115 |
%.o: %.cc |
| 116 |
@echo '(C++)' $<; $(CXX) -c $(CPPFLAGS) $(CXXFLAGS) $< |
| 117 |
|
| 118 |
%.d: %.cc |
| 119 |
@echo '(dep)' $<; $(CXX) -MM -MP $(CPPFLAGS) $(CXXFLAGS) $< >$@ |
| 120 |
|
| 121 |
# The preprocessing step |
| 122 |
%.ttcn: %.ttcnpp $(TTCN3_INCLUDES) |
| 123 |
$(CPP) -x c -nostdinc $(CPPFLAGS_TTCN3) $< $@ |
| 124 |
|
| 125 |
preprocess: $(PREPROCESSED_TTCN3_MODULES) ; |
| 126 |
|
| 127 |
$(GENERATED_SOURCES) $(GENERATED_HEADERS): compile |
| 128 |
@if [ ! -f $@ ]; then $(RM) compile; $(MAKE) compile; fi |
| 129 |
|
| 130 |
check: $(TTCN3_MODULES) $(PREPROCESSED_TTCN3_MODULES) $(ASN1_MODULES) |
| 131 |
$(TTCN3_COMPILER) -s $(COMPILER_FLAGS) $^ |
| 132 |
|
| 133 |
compile:: $(firstword $(TTCN3_COMPILER)) |
| 134 |
@if [ -f $@ ]; then $(RM) compile; $(MAKE) compile; fi |
| 135 |
# if [ -f $(GENERATED_SOURCES) ]; then rm -f $(GENERATED_SOURCES); $(MAKE) $(GENERATED_SOURCES); fi |
| 136 |
|
| 137 |
compile:: $(TTCN3_MODULES) $(PREPROCESSED_TTCN3_MODULES) $(ASN1_MODULES) |
| 138 |
# "modulepar boolean verbose" makes this unusable with old names |
| 139 |
$(TTCN3_COMPILER) $(COMPILER_FLAGS) $^ - $? |
| 140 |
touch $@ |
| 141 |
|
| 142 |
clean celan clena: |
| 143 |
-$(RM) $(TARGET) $(OBJECTS) $(GENERATED_HEADERS) \ |
| 144 |
$(GENERATED_SOURCES) $(PREPROCESSED_TTCN3_MODULES) compile \ |
| 145 |
tags *.log |
| 146 |
|
| 147 |
distclean: clean |
| 148 |
-$(RM) $(DEPFILES) |
| 149 |
|
| 150 |
# |
| 151 |
# Add your rules here if necessary... |
| 152 |
# |
| 153 |
|
| 154 |
.SUFFIXES: .asn .ttcn .ttcnpp |
| 155 |
|
| 156 |
RUN := $(shell which colortitan 2>/dev/null) |
| 157 |
ifeq ($(firstword $(RUN)),no) |
| 158 |
# stupid /bin/which on Solaris writes errors to stdout instead of stderr |
| 159 |
RUN := |
| 160 |
endif |
| 161 |
|
| 162 |
XMLLINT := $(shell which xmllint 2>/dev/null) |
| 163 |
ifeq ($(firstword $(XMLLINT)),no) |
| 164 |
# stupid /bin/which on Solaris writes errors to stdout instead of stderr |
| 165 |
XMLLINT := |
| 166 |
endif |
| 167 |
|
| 168 |
run: $(TARGET) config.cfg |
| 169 |
$(RUN) ./$^ |
| 170 |
ifneq ($(XMLLINT),) # xmllint found in path |
| 171 |
perl log2xml.pl $(TARGET:.exe=).log > result.xml |
| 172 |
xmllint --schema flipflop-check.xsd result.xml |
| 173 |
endif |
| 174 |
$(RUN) ./$< xtdp.cfg |
| 175 |
ifneq ($(XMLLINT),) # xmllint found in path |
| 176 |
perl log2xml.pl $(TARGET:.exe=).log > xresult.xml |
| 177 |
xmllint --schema xsd/XTDP-Message.xsd xresult.xml |
| 178 |
endif |
| 179 |
|
| 180 |
debug: |
| 181 |
$(MAKE) run RUN='gdb --args' |
| 182 |
|
| 183 |
vpath %.cc $(TOP_SRC)/iconv |
| 184 |
vpath %.ttcn $(TOP_SRC)/iconv |
| 185 |
|
| 186 |
|
| 187 |
dep: ; |
| 188 |
|
| 189 |
DEPFILES := $(OBJECTS:.o=.d) |
| 190 |
|
| 191 |
ifeq (,$(findstring n,$(MAKEFLAGS))) |
| 192 |
ifeq (,$(filter clean distclean,$(MAKECMDGOALS))) |
| 193 |
-include $(DEPFILES) |
| 194 |
endif |
| 195 |
endif |
| 196 |
|