1 ###############################################################################
2 # Copyright (c) 2000-2015 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 # Make sure TOPDIR is an absolute path
9 TOPDIR
:= $(shell cd ..
/..
&& pwd
)
10 include $(TOPDIR
)/Makefile.regression
14 # This is a test for central storage and makefile generation
15 MFGEN
:= $(TTCN3_DIR
)/bin
/ttcn3_makefilegen
16 MFGEN_FLAGS
:= -sfp
$(RT2_FLAG
) $(SPLIT_FLAG
)
21 CSDIRS
:= base_ttcn base_asn base_mixed extended_ttcn all_bases user_ttcn \
22 user_all_bases separate_project separate_user
24 BASE_TTCN_FILES
:= base_ttcn.ttcnpp base_PT.
cc
25 BASE_TTCN_FILES_RELPATH
:= $(addprefix ..
/base_ttcn
/, $(BASE_TTCN_FILES
))
27 BASE_ASN_FILES
:= Base_asn.asn
28 BASE_ASN_FILES_RELPATH
:= $(addprefix ..
/base_asn
/, $(BASE_ASN_FILES
))
30 BASE_MIXED_FILES
:= base_mixed_ttcn.ttcn base_mixed_ttcnpp.ttcnpp \
31 base_mixed_PT.
cc Base_mixed_asn.asn
32 BASE_MIXED_FILES_RELPATH
:= $(addprefix ..
/base_mixed
/, $(BASE_MIXED_FILES
))
34 EXTENDED_TTCN_FILES
:= extended_ttcnpp.ttcnpp extended_ttcn.ttcn
35 EXTENDED_TTCN_FILES_RELPATH
:= $(addprefix ..
/extended_ttcn
/, \
36 $(EXTENDED_TTCN_FILES
))
38 SEPARATE_PROJECT_FILES
:= separate_ttcn.ttcn separate_ttcnpp.ttcnpp \
39 separate_PT.
cc separate_PT.hh
40 SEPARATE_PROJECT_FILES_RELPATH
:= $(addprefix ..
/separate_project
/, \
41 $(SEPARATE_PROJECT_FILES
))
43 SEPARATED_FILES_RELPATH
:= $(addprefix ..
/separated_files
/, \
44 $(SEPARATE_PROJECT_FILES
))
46 # Make executable alias.
47 # Actions containing $(MAKE) are exempt from -n, i.e. are always executed.
48 # Here they contain a mixture of makefilegen and make. The sub-make inherits
49 # the -n (do-nothing) flag but makefilegen is unaware of this.
50 # At extended_ttcn the second invocation of makefilegen fails to find files
51 # which should have been created by make.
53 # Workaround: use an alias, which is not exempted from -n
54 # Now all actions are merely printed.
58 #this tests if giving only the ".cc" of a port is enough
59 cd base_ttcn
&& $(MFGEN
) $(MFGEN_FLAGS
) -c
$(BASE_TTCN_FILES
) \
61 #this tests compilation without central storage
62 cd base_asn
&& $(MFGEN
) $(MFGEN_FLAGS
) $(BASE_ASN_FILES
) && \
64 #this tests whether we can give the header file of a test port
65 cd base_mixed
&& $(MFGEN
) $(MFGEN_FLAGS
) $(BASE_MIXED_FILES
) \
66 base_mixed_PT.hh
&& $(MAKE_PROG
) $@
67 #this tests giving in generated files
68 cd extended_ttcn
&& $(MFGEN
) $(MFGEN_FLAGS
) -c \
69 $(EXTENDED_TTCN_FILES
) $(BASE_TTCN_FILES_RELPATH
) && \
70 $(MAKE_PROG
) compile
&& $(MFGEN
) $(MFGEN_FLAGS
) -c \
71 $(EXTENDED_TTCN_FILES
) extended_ttcn.
cc extended_ttcn.hh \
72 $(BASE_TTCN_FILES_RELPATH
) && $(MAKE_PROG
) $@
73 #this tests if we can reach several projects as central storages
74 #and also this project has no files on its own
75 cd all_bases
&& $(MFGEN
) $(MFGEN_FLAGS
) -c \
76 $(BASE_TTCN_FILES_RELPATH
) $(BASE_ASN_FILES_RELPATH
) \
77 $(BASE_MIXED_FILES_RELPATH
) && $(MAKE_PROG
) $@
78 #this tests if we can use a project as central storage which also uses
79 #a project as central storage
80 cd user_ttcn
&& $(MFGEN
) $(MFGEN_FLAGS
) -c
-O fake.ttcnpp \
81 user_ttcn.ttcn
$(EXTENDED_TTCN_FILES_RELPATH
)\
82 $(BASE_TTCN_FILES_RELPATH
) && $(MAKE_PROG
) $@
83 #this tests if we can use a project which is used by all the project we
84 #use as central storage.
85 cd user_all_bases
&& $(MFGEN
) $(MFGEN_FLAGS
) -c \
86 user_all_bases.ttcn
$(BASE_TTCN_FILES_RELPATH
) \
87 $(BASE_ASN_FILES_RELPATH
) $(BASE_MIXED_FILES_RELPATH
) \
88 $(EXTENDED_TTCN_FILES_RELPATH
) && $(MAKE_PROG
) $@
89 #this tests if we can give the same file more than once
90 cd separate_project
&& $(MFGEN
) $(MFGEN_FLAGS
) -c \
91 $(SEPARATE_PROJECT_FILES
) $(SEPARATE_PROJECT_FILES
) \
92 $(SEPARATE_PROJECT_FILES_RELPATH
) \
93 $(SEPARATE_PROJECT_FILES_RELPATH
) && $(MAKE_PROG
) $@
94 #in some cases the project to be used as central storage must be moved
96 (cd separate_project
&& tar -cf
- *) |
(cd separated_files
&& tar -xf
-)
97 #this tests if we can use a moved and recompiled project as
98 #central storage and generates a gnu Makefile with absolute paths
99 #and puts a config file into the makefile which is not compilable
100 cd separate_user
&& $(MFGEN
) $(MFGEN_FLAGS
) -cga \
101 separate_user.ttcn config.cfg
$(SEPARATED_FILES_RELPATH
) && \
104 dep
clean distclean: emptydirs
105 #clean up all the projects and erase their Makefile one by one.
106 for
dir in
$(CSDIRS
); do
(cd
$$dir && if
[ -f Makefile
]; then \
107 $(MAKE
) $(subst dist,,$@
); $(RM
) Makefile
; fi
); done
108 cd separated_files
&& $(RM
) *.
*
111 mkdir
-p all_bases separated_files