OSDN Git Service

* testsuite/Makefile.am: Add definition of AM_CXXFLAGS.
[pf3gnuchains/gcc-fork.git] / libstdc++-v3 / testsuite / Makefile.am
1 ## Makefile for the testsuite subdirectory of the GNU C++ Standard library.
2 ##
3 ## Copyright (C) 2001, 2002, 2003 Free Software Foundation, Inc.
4 ##
5 ## This file is part of the libstdc++ version 3 distribution.
6 ## Process this file with automake to produce Makefile.in.
7
8 ## This file is part of the GNU ISO C++ Library.  This library is free
9 ## software; you can redistribute it and/or modify it under the
10 ## terms of the GNU General Public License as published by the
11 ## Free Software Foundation; either version 2, or (at your option)
12 ## any later version.
13
14 ## This library is distributed in the hope that it will be useful,
15 ## but WITHOUT ANY WARRANTY; without even the implied warranty of
16 ## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
17 ## GNU General Public License for more details.
18
19 ## You should have received a copy of the GNU General Public License along
20 ## with this library; see the file COPYING.  If not, write to the Free
21 ## Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307,
22 ## USA.
23
24 AUTOMAKE_OPTIONS = dejagnu
25
26 include $(top_srcdir)/fragment.am
27
28 AM_MAKEFLAGS = -j1
29 AM_RUNTESTFLAGS =
30
31 ## CXX is actually a "C" compiler. These are real C++ programs.
32 testsuite_flags_script=${glibcxx_builddir}/scripts/testsuite_flags
33 CXX         = $(shell ${testsuite_flags_script} --build-cxx)
34 AM_CXXFLAGS = $(shell ${testsuite_flags_script} --cxxflags)
35
36 GLIBGCC_DIR=`$(CC) -print-libgcc-file-name | sed 's,/[^/]*$$,,'`
37 GLIBCXX_DIR=${glibcxx_builddir}/src/.libs
38
39 CXXLINK = \
40         $(LIBTOOL) --tag=CXX --mode=link $(CXX) \
41         -R $(GLIBGCC_DIR) -R $(GLIBCXX_DIR) \
42         $(AM_CXXFLAGS) $(CXXFLAGS) $(LDFLAGS) -o $@
43
44 # Generated lists of files to run.  All of these names are valid make
45 # targets, if you wish to generate a list manually.
46 lists_of_files = \
47    testsuite_files \
48    testsuite_files_interactive \
49    testsuite_files_performance
50
51 ## Build support library.
52 noinst_LIBRARIES = libv3test.a
53 libv3test_a_SOURCES = testsuite_hooks.cc testsuite_allocator.cc
54
55 ## Build support utilities.
56 if GLIBCXX_TEST_ABI
57 noinst_PROGRAMS = abi_check
58 else
59 noinst_PROGRAMS =
60 endif
61 abi_check_SOURCES = abi_check.cc
62
63 all-local: stamp_wchar testsuite_files
64
65 # Enable wchar_t tests if capable.
66 if GLIBCXX_TEST_WCHAR_T
67 stamp_wchar:
68         touch testsuite_wchar_t
69 else
70 stamp_wchar:
71 endif
72
73 # We need more things in site.exp, but automake completely controls the
74 # creation of that file; there's no way to append to it without messing up
75 # the dependancy chains.  So we overrule automake.  This rule is exactly
76 # what it would have generated, plus our own additions.
77 site.exp: Makefile
78         @echo 'Making a new site.exp file...'
79         @echo '## these variables are automatically generated by make ##' >site.tmp
80         @echo '# Do not edit here.  If you wish to override these values' >>site.tmp
81         @echo '# edit the last section' >>site.tmp
82         @echo 'set srcdir $(srcdir)' >>site.tmp
83         @echo "set objdir `pwd`" >>site.tmp
84         @echo 'set build_alias "$(build_alias)"' >>site.tmp
85         @echo 'set build_triplet $(build_triplet)' >>site.tmp
86         @echo 'set host_alias "$(host_alias)"' >>site.tmp
87         @echo 'set host_triplet $(host_triplet)' >>site.tmp
88         @echo 'set target_alias "$(target_alias)"' >>site.tmp
89         @echo 'set target_triplet $(target_triplet)' >>site.tmp
90         @echo 'set target_triplet $(target_triplet)' >>site.tmp
91         @echo 'set libiconv "$(LIBICONV)"' >>site.tmp
92         @echo '## All variables above are generated by configure. Do Not Edit ##' >>site.tmp
93         @test ! -f site.exp || \
94           sed '1,/^## All variables above are.*##/ d' site.exp >> site.tmp
95         @-rm -f site.bak
96         @test ! -f site.exp || mv site.exp site.bak
97         @mv site.tmp site.exp
98
99 # This is automatically run after the generated check-DEJAGNU rule.
100 check-local: check-abi
101
102 baseline_file = ${baseline_dir}/baseline_symbols.txt
103 extract_symvers = $(glibcxx_srcdir)/scripts/extract_symvers
104
105 current_symbols.txt: ${extract_symvers} ../src/.libs/libstdc++.so
106           -@(${extract_symvers} ../src/.libs/libstdc++.so current_symbols.txt)
107
108 baseline_symbols:
109         -@(output=${baseline_file}; \
110           if test ! -f $${output}; then \
111             echo "Baseline file doesn't exist."; \
112             echo "Try 'make new-abi-baseline' to create it."; \
113             exit 1; \
114           fi; true)
115
116 new-abi-baseline:
117         -@$(mkinstalldirs) ${baseline_dir}
118         -@(output=${baseline_file}; \
119           if test -f $${output}; then \
120             output=$${output}.new; \
121             t=`echo $${output} | sed 's=.*config/abi/=='`; \
122             echo "Baseline file already exists, writing to $${t} instead."; \
123           fi; \
124           ${extract_symvers} ../src/.libs/libstdc++.so $${output})
125
126 if GLIBCXX_TEST_ABI
127 # Use 'new-abi-baseline' to create an initial symbol file.  Then run
128 # 'check-abi' to test for changes against that file.
129 check-abi: abi_check baseline_symbols current_symbols.txt
130         -@./abi_check --check ./current_symbols.txt ${baseline_file} \
131           2>&1 | tee libstdc++-abi.sum
132         -@cp libstdc++-abi.sum libstdc++-abi.log
133
134 check-abi-verbose: abi_check baseline_symbols current_symbols.txt
135         -@./abi_check --check-verbose ./current_symbols.txt ${baseline_file} \
136           2>&1 | tee libstdc++-abi.sum
137         -@cp libstdc++-abi.sum libstdc++-abi.log
138
139 else
140 check-abi:
141 check-abi-verbose:
142 endif
143
144
145 # These two special 'check-script' rules use the bash script
146 # 'check_survey' to do testing. This script is not as portable as the
147 # dejagnu test harness, and is thus off by default. It does produce
148 # interesting output however, including various performance analysis
149 # items like compile time, execution time, and binary size.
150 survey_script = ${glibcxx_builddir}/scripts/check_survey
151 check-script: ${survey_script}
152         -@(chmod + ${survey_script}; \
153           ${survey_script} 0)
154
155 check-script-install: ${survey_script}
156         -@(chmod + ${survey_script}; \
157           ${survey_script} 0)
158
159
160 # Runs the testsuite/performance tests.
161 # Some of these tests create large (~75MB) files, allocate huge
162 # ammounts of memory, or otherwise tie up machine resources. Thus,
163 # running this is off by default.
164 performance_script=${glibcxx_srcdir}/scripts/check_performance
165 check-performance: testsuite_files_performance ${performance_script}
166         -@(chmod + ${performance_script}; \
167           ${performance_script} ${glibcxx_srcdir} ${glibcxx_builddir})
168
169
170 # This rule generates all of the testsuite_files* lists at once.
171 ${lists_of_files}:
172         ${glibcxx_srcdir}/scripts/create_testsuite_files \
173           ${glibcxx_srcdir}/testsuite `${PWD_COMMAND}`
174
175
176 .PHONY: baseline_symbols new-abi-baseline check-abi check-abi-verbose \
177 check-script check-script-install check-performance
178
179 # By adding these files here, automake will remove them for 'make clean'
180 CLEANFILES = *.txt *.tst *.exe core* filebuf_* tmp* ostream_* *.log *.sum \
181              testsuite_* site.exp abi_check baseline_symbols