Sync with 5.4.2
[deliverable/titan.core.git] / function_test / Semantic_Analyser / common.mk
CommitLineData
970ed795
EL
1# Common makefile for all the TTCN_* and ASN_* subdirectories
2
3# WARNING! This Makefile can be used with GNU make only.
4# Other versions of make may report syntax errors in it.
5
6#
7# Do NOT touch this line...
8#
9.PHONY: all archive check clean dep objects run
10
11.SUFFIXES: .d
12
13#
14# Set these variables...
15#
16
17
18# Flags for the TTCN-3 and ASN.1 compiler:
19COMPILER_FLAGS := -s -g
20
21
22# TTCN-3 modules of this project:
23TTCN3_MODULES := $(sort $(wildcard *A.ttcn *S[WE].ttcn *OK.ttcn))
24
25# ASN.1 modules of this project:
26ASN1_MODULES := $(wildcard *A.asn)
27
28# Remember, this makefile runs in one of the subdirectories.
29
30# C++ source & header files generated from the TTCN-3 & ASN.1 modules of
31# this project:
32GENERATED_SOURCES := $(TTCN3_MODULES:.ttcn=.cc) $(ASN1_MODULES:.asn=.cc)
33GENERATED_HEADERS := $(GENERATED_SOURCES:.cc=.hh)
34
35# C/C++ Source & header files of Test Ports, external functions and
36# other modules:
37USER_SOURCES :=
38USER_HEADERS := $(USER_SOURCES:.cc=.hh)
39
40# Object files (will not be built)
41OBJECTS := $(GENERATED_OBJECTS) $(USER_OBJECTS)
42
43GENERATED_OBJECTS := $(GENERATED_SOURCES:.cc=.o)
44
45USER_OBJECTS := $(USER_SOURCES:.cc=.o)
46
47DEPFILES := $(USER_OBJECTS:.o=.d) $(GENERATED_OBJECTS:.o=.d)
48
49# Other files of the project (Makefile, configuration files, etc.)
50# that will be added to the archived source files:
51OTHER_FILES := Makefile
52
53# lastword only in GNU make 3.81 and above :(
54COMMON_MK := $(word $(words $(MAKEFILE_LIST)), $(MAKEFILE_LIST))
55CW := $(COMMON_MK:common.mk=cw.pl)
56
57#
58# Rules for building the executable...
59#
60
61all: $(GENERATED_SOURCES) ;
62
63.cc.o .c.o:
64 $(CXX) -c $(CPPFLAGS) $(CXXFLAGS) -o $@ $<
65
66.cc.d .c.d:
67 @echo Creating dependency file for '$<'; set -e; \
68 $(CXX) $(CXXDEPFLAGS) $(CPPFLAGS) $(CXXFLAGS) $< \
69 | sed 's/\($*\)\.o[ :]*/\1.o $@ : /g' > $@; \
70 [ -s $@ ] || rm -f $@
71
72
73#
74# This is the "Run the compiler on every source you can find" target.
75#
76run check: $(TTCN3_MODULES) $(ASN1_MODULES)
77 @$(CW) $(COMPILER_FLAGS) $(subst A.,?.,$^)
78
79
80clean:
81 -$(RM) $(TARGET) $(OBJECTS) $(GENERATED_HEADERS) \
82 $(GENERATED_SOURCES) compile $(DEPFILES) \
83 tags *.log
84
85dep: $(GENERATED_SOURCES) $(USER_SOURCES) ;
86
87ifeq ($(findstring n,$(MAKEFLAGS)),)
88ifeq ($(filter clean distclean check compile archive diag,$(MAKECMDGOALS)),)
89# -include $(DEPFILES)
90endif
91endif
92
93
94diag:
95 $(TTCN3_DIR)/bin/compiler -v 2>&1
96 $(TTCN3_DIR)/bin/mctr_cli -v 2>&1
97 $(CXX) -v 2>&1
98 @echo TTCN3_DIR=$(TTCN3_DIR)
99 @echo OPENSSL_DIR=$(OPENSSL_DIR)
100 @echo XMLDIR=$(XMLDIR)
101 @echo PLATFORM=$(PLATFORM)
102
103#
104# Add your rules here if necessary...
105#
106
107%.hh: %.ttcn
108 mycompiler $(COMPILER_FLAGS) $<
109
110%.cc: %.ttcn
111 $(CW) $(COMPILER_FLAGS) $(subst A.,?.,$<)
112# || ( mycompiler $(COMPILER_FLAGS) $(subst A.,?.,$<) && fail )
113
114s: $(GENERATED_SOURCES)
115h: $(GENERATED_HEADERS)
116
117%.cc: %.asn
118 $(CW) $(COMPILER_FLAGS) $(subst A.,?.,$<)
119# || mycompiler $(COMPILER_FLAGS) $(subst A.,?.,$<)
120
121export HARNESS_ACTIVE=1
This page took 0.028095 seconds and 5 git commands to generate.