Commit | Line | Data |
---|---|---|
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: | |
19 | COMPILER_FLAGS := -s -g | |
20 | ||
21 | ||
22 | # TTCN-3 modules of this project: | |
23 | TTCN3_MODULES := $(sort $(wildcard *A.ttcn *S[WE].ttcn *OK.ttcn)) | |
24 | ||
25 | # ASN.1 modules of this project: | |
26 | ASN1_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: | |
32 | GENERATED_SOURCES := $(TTCN3_MODULES:.ttcn=.cc) $(ASN1_MODULES:.asn=.cc) | |
33 | GENERATED_HEADERS := $(GENERATED_SOURCES:.cc=.hh) | |
34 | ||
35 | # C/C++ Source & header files of Test Ports, external functions and | |
36 | # other modules: | |
37 | USER_SOURCES := | |
38 | USER_HEADERS := $(USER_SOURCES:.cc=.hh) | |
39 | ||
40 | # Object files (will not be built) | |
41 | OBJECTS := $(GENERATED_OBJECTS) $(USER_OBJECTS) | |
42 | ||
43 | GENERATED_OBJECTS := $(GENERATED_SOURCES:.cc=.o) | |
44 | ||
45 | USER_OBJECTS := $(USER_SOURCES:.cc=.o) | |
46 | ||
47 | DEPFILES := $(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: | |
51 | OTHER_FILES := Makefile | |
52 | ||
53 | # lastword only in GNU make 3.81 and above :( | |
54 | COMMON_MK := $(word $(words $(MAKEFILE_LIST)), $(MAKEFILE_LIST)) | |
55 | CW := $(COMMON_MK:common.mk=cw.pl) | |
56 | ||
57 | # | |
58 | # Rules for building the executable... | |
59 | # | |
60 | ||
61 | all: $(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 | # | |
76 | run check: $(TTCN3_MODULES) $(ASN1_MODULES) | |
77 | @$(CW) $(COMPILER_FLAGS) $(subst A.,?.,$^) | |
78 | ||
79 | ||
80 | clean: | |
81 | -$(RM) $(TARGET) $(OBJECTS) $(GENERATED_HEADERS) \ | |
82 | $(GENERATED_SOURCES) compile $(DEPFILES) \ | |
83 | tags *.log | |
84 | ||
85 | dep: $(GENERATED_SOURCES) $(USER_SOURCES) ; | |
86 | ||
87 | ifeq ($(findstring n,$(MAKEFLAGS)),) | |
88 | ifeq ($(filter clean distclean check compile archive diag,$(MAKECMDGOALS)),) | |
89 | # -include $(DEPFILES) | |
90 | endif | |
91 | endif | |
92 | ||
93 | ||
94 | diag: | |
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 | ||
114 | s: $(GENERATED_SOURCES) | |
115 | h: $(GENERATED_HEADERS) | |
116 | ||
117 | %.cc: %.asn | |
118 | $(CW) $(COMPILER_FLAGS) $(subst A.,?.,$<) | |
119 | # || mycompiler $(COMPILER_FLAGS) $(subst A.,?.,$<) | |
120 | ||
121 | export HARNESS_ACTIVE=1 |