]>
Commit | Line | Data |
---|---|---|
b4c522fa | 1 | ## Makefile for the testsuite subdirectory of the D Standard library. |
a5544970 | 2 | ## Copyright (C) 2016-2019 Free Software Foundation, Inc. |
b4c522fa IB |
3 | ## |
4 | ## GCC is free software; you can redistribute it and/or modify | |
5 | ## it under the terms of the GNU General Public License as published by | |
6 | ## the Free Software Foundation; either version 3, or (at your option) | |
7 | ## any later version. | |
8 | ## | |
9 | ## GCC is distributed in the hope that it will be useful, | |
10 | ## but WITHOUT ANY WARRANTY; without even the implied warranty of | |
11 | ## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
12 | ## GNU General Public License for more details. | |
13 | ## | |
14 | ## You should have received a copy of the GNU General Public License | |
15 | ## along with GCC; see the file COPYING3. If not see | |
16 | ## <http://www.gnu.org/licenses/>. | |
17 | ||
18 | # Process this file with automake to produce Makefile.in. | |
19 | ||
df63d1b7 | 20 | AUTOMAKE_OPTIONS = foreign |
b4c522fa IB |
21 | |
22 | # Setup the testing framework, if you have one | |
23 | EXPECT = $(shell if test -f $(top_builddir)/../expect/expect; then \ | |
24 | echo $(top_builddir)/../expect/expect; else echo expect; fi) | |
25 | ||
26 | _RUNTEST = $(shell if test -f $(top_srcdir)/../dejagnu/runtest; then \ | |
27 | echo $(top_srcdir)/../dejagnu/runtest; else echo runtest; fi) | |
df63d1b7 IB |
28 | RUNTESTDEFAULTFLAGS = --tool $$tool --srcdir $$srcdir |
29 | ||
30 | check_p_subno=$(word 2,$(subst _, ,$*)) | |
31 | check_p_numbers0:=1 2 3 4 5 6 7 8 9 | |
32 | check_p_numbers1:=0 $(check_p_numbers0) | |
33 | check_p_numbers2:=$(foreach i,$(check_p_numbers0),$(addprefix $(i),$(check_p_numbers1))) | |
34 | check_p_numbers3:=$(addprefix 0,$(check_p_numbers1)) $(check_p_numbers2) | |
35 | check_p_numbers4:=$(foreach i,$(check_p_numbers0),$(addprefix $(i),$(check_p_numbers3))) | |
36 | check_p_numbers5:=$(addprefix 0,$(check_p_numbers3)) $(check_p_numbers4) | |
37 | check_p_numbers6:=$(foreach i,$(check_p_numbers0),$(addprefix $(i),$(check_p_numbers5))) | |
38 | check_p_numbers:=$(check_p_numbers0) $(check_p_numbers2) $(check_p_numbers4) $(check_p_numbers6) | |
39 | check_p_subdirs=$(wordlist 1,$(if $(GCC_TEST_PARALLEL_SLOTS),$(GCC_TEST_PARALLEL_SLOTS),10),$(check_p_numbers)) | |
40 | check_DEJAGNU_libphobos_targets = $(addprefix check-DEJAGNUlibphobos,$(check_p_subdirs)) | |
41 | $(check_DEJAGNU_libphobos_targets): check-DEJAGNUlibphobos%: libphobos%/site.exp | |
42 | ||
43 | site.exp: Makefile $(EXTRA_DEJAGNU_SITE_CONFIG) | |
44 | @echo 'Making a new site.exp file ...' | |
45 | @echo '## these variables are automatically generated by make ##' >site.tmp | |
46 | @echo '# Do not edit here. If you wish to override these values' >>site.tmp | |
47 | @echo '# edit the last section' >>site.tmp | |
48 | @echo 'set srcdir "$(srcdir)"' >>site.tmp | |
49 | @echo "set objdir `pwd`" >>site.tmp | |
50 | @echo 'set build_alias "$(build_alias)"' >>site.tmp | |
51 | @echo 'set build_triplet $(build_triplet)' >>site.tmp | |
52 | @echo 'set host_alias "$(host_alias)"' >>site.tmp | |
53 | @echo 'set host_triplet $(host_triplet)' >>site.tmp | |
54 | @echo 'set target_alias "$(target_alias)"' >>site.tmp | |
55 | @echo 'set target_triplet $(target_triplet)' >>site.tmp | |
56 | @list='$(EXTRA_DEJAGNU_SITE_CONFIG)'; for f in $$list; do \ | |
57 | echo "## Begin content included from file $$f. Do not modify. ##" \ | |
58 | && cat `test -f "$$f" || echo '$(srcdir)/'`$$f \ | |
59 | && echo "## End content included from file $$f. ##" \ | |
60 | || exit 1; \ | |
61 | done >> site.tmp | |
62 | @echo "## End of auto-generated content; you can edit from here. ##" >> site.tmp | |
63 | @if test -f site.exp; then \ | |
64 | sed -e '1,/^## End of auto-generated content.*##/d' site.exp >> site.tmp; \ | |
65 | fi | |
66 | @-rm -f site.bak | |
67 | @test ! -f site.exp || mv site.exp site.bak | |
68 | @mv site.tmp site.exp | |
69 | ||
70 | %/site.exp: site.exp | |
71 | -@test -d $* || mkdir $* | |
72 | @srcdir=`cd $(srcdir); ${PWD_COMMAND}`; | |
73 | @objdir=`${PWD_COMMAND}`/$*; \ | |
74 | sed -e "s|^set srcdir .*$$|set srcdir $$srcdir|" \ | |
75 | -e "s|^set objdir .*$$|set objdir $$objdir|" \ | |
76 | site.exp > $*/site.exp.tmp | |
77 | @-rm -f $*/site.bak | |
78 | @test ! -f $*/site.exp || mv $*/site.exp $*/site.bak | |
79 | @mv $*/site.exp.tmp $*/site.exp | |
80 | ||
81 | # Run the testsuite in normal mode. | |
82 | check-DEJAGNU $(check_DEJAGNU_libphobos_targets): check-DEJAGNU%: site.exp | |
83 | $(if $*,@)AR="$(AR)"; export AR; \ | |
84 | RANLIB="$(RANLIB)"; export RANLIB; \ | |
85 | if [ -z "$*" ] && [ -n "$(filter -j%, $(MFLAGS))" ]; then \ | |
86 | rm -rf libphobos-parallel || true; \ | |
87 | mkdir libphobos-parallel; \ | |
88 | $(MAKE) $(AM_MAKEFLAGS) $(check_DEJAGNU_libphobos_targets); \ | |
89 | rm -rf libphobos-parallel || true; \ | |
90 | for idx in $(check_p_subdirs); do \ | |
91 | if [ -d libphobos$$idx ]; then \ | |
92 | mv -f libphobos$$idx/libphobos.sum libphobos$$idx/libphobos.sum.sep; \ | |
93 | mv -f libphobos$$idx/libphobos.log libphobos$$idx/libphobos.log.sep; \ | |
94 | fi; \ | |
95 | done; \ | |
96 | $(SHELL) $(srcdir)/../../contrib/dg-extract-results.sh \ | |
97 | libphobos[0-9]*/libphobos.sum.sep > libphobos.sum; \ | |
98 | $(SHELL) $(srcdir)/../../contrib/dg-extract-results.sh -L \ | |
99 | libphobos[0-9]*/libphobos.log.sep > libphobos.log; \ | |
100 | exit 0; \ | |
101 | fi; \ | |
102 | srcdir=`$(am__cd) $(srcdir) && pwd`; export srcdir; \ | |
103 | EXPECT=$(EXPECT); export EXPECT; \ | |
104 | runtest=$(_RUNTEST); \ | |
105 | if [ -z "$$runtest" ]; then runtest=runtest; fi; \ | |
106 | tool=libphobos; \ | |
107 | if [ -n "$*" ]; then \ | |
108 | if [ -f libphobos-parallel/finished ]; then rm -rf "$*"; exit 0; fi; \ | |
109 | GCC_RUNTEST_PARALLELIZE_DIR=`${PWD_COMMAND}`/libphobos-parallel; \ | |
110 | export GCC_RUNTEST_PARALLELIZE_DIR; \ | |
111 | cd "$*"; \ | |
112 | fi; \ | |
113 | if $(SHELL) -c "$$runtest --version" > /dev/null 2>&1; then \ | |
114 | $$runtest $(AM_RUNTESTFLAGS) $(RUNTESTDEFAULTFLAGS) \ | |
115 | $(RUNTESTFLAGS); \ | |
116 | if [ -n "$*" ]; then \ | |
117 | touch $$GCC_RUNTEST_PARALLELIZE_DIR/finished; \ | |
118 | fi; \ | |
119 | else \ | |
120 | echo "WARNING: could not find \`runtest'" 1>&2; :;\ | |
121 | fi | |
122 | ||
123 | check-am: | |
124 | $(MAKE) $(AM_MAKEFLAGS) check-DEJAGNU | |
125 | ||
126 | .PHONY: check-DEJAGNU | |
b4c522fa IB |
127 | |
128 | AM_MAKEFLAGS = "EXEEXT=$(EXEEXT)" | |
129 | ||
df63d1b7 IB |
130 | CLEANFILES = *.exe *.log *.o *.sum site.exp |
131 | ||
132 | # To remove runtest-parallel directories. | |
133 | clean-local: | |
134 | rm -rf libphobos* |