c-family: Enable -fpermissive for C and ObjC
[official-gcc.git] / libgomp / testsuite / Makefile.am
blob0cc91ccc4d1fe2ccb538537881e7ba13ca81bf66
1 ## Process this file with automake to produce Makefile.in.
3 AUTOMAKE_OPTIONS = foreign
5 # May be used by various substitution variables.
6 gcc_version := $(shell @get_gcc_base_ver@ $(top_srcdir)/../gcc/BASE-VER)
8 EXPECT = $(shell if test -f $(top_builddir)/../expect/expect; then \
9            echo $(top_builddir)/../expect/expect; else echo expect; fi)
11 _RUNTEST = $(shell if test -f $(top_srcdir)/../dejagnu/runtest; then \
12              echo $(top_srcdir)/../dejagnu/runtest; else echo runtest; fi)
13 RUNTESTDEFAULTFLAGS = --tool $$tool --srcdir $$srcdir
15 PWD_COMMAND = $${PWDCMD-pwd}
17 EXTRA_DEJAGNU_SITE_CONFIG = libgomp-site-extra.exp
19 # Instead of directly in ../testsuite/libgomp-test-support.exp.in, the
20 # following variables have to be "routed through" this Makefile, for expansion
21 # of the several (Makefile) variables used therein.
22 libgomp-test-support.exp: libgomp-test-support.pt.exp Makefile
23         cp $< $@.tmp
24         echo >> $@.tmp \
25           'set offload_additional_options "$(offload_additional_options)"'
26         echo >> $@.tmp \
27           'set offload_additional_lib_paths "$(offload_additional_lib_paths)"'
28         mv $@.tmp $@
30 site.exp: Makefile $(EXTRA_DEJAGNU_SITE_CONFIG)
31         @echo 'Making a new site.exp file ...'
32         @echo '## these variables are automatically generated by make ##' >site.tmp
33         @echo '# Do not edit here.  If you wish to override these values' >>site.tmp
34         @echo '# edit the last section' >>site.tmp
35         @echo 'set srcdir "$(srcdir)"' >>site.tmp
36         @echo "set objdir `pwd`" >>site.tmp
37         @echo 'set build_alias "$(build_alias)"' >>site.tmp
38         @echo 'set build_triplet $(build_triplet)' >>site.tmp
39         @echo 'set host_alias "$(host_alias)"' >>site.tmp
40         @echo 'set host_triplet $(host_triplet)' >>site.tmp
41         @echo 'set target_alias "$(target_alias)"' >>site.tmp
42         @echo 'set target_triplet $(target_triplet)' >>site.tmp
43         @list='$(EXTRA_DEJAGNU_SITE_CONFIG)'; for f in $$list; do \
44           echo "## Begin content included from file $$f.  Do not modify. ##" \
45            && cat `test -f "$$f" || echo '$(srcdir)/'`$$f \
46            && echo "## End content included from file $$f. ##" \
47            || exit 1; \
48          done >> site.tmp
49         @echo "## End of auto-generated content; you can edit from here. ##" >> site.tmp
50         @if test -f site.exp; then \
51            sed -e '1,/^## End of auto-generated content.*##/d' site.exp >> site.tmp; \
52          fi
53         @-rm -f site.bak
54         @test ! -f site.exp || mv site.exp site.bak
55         @mv site.tmp site.exp
57 %/site.exp: site.exp
58         -@test -d $* || mkdir $*
59         @srcdir=`cd $(srcdir); ${PWD_COMMAND}`;
60         @objdir=`${PWD_COMMAND}`/$*; \
61         sed -e "s|^set srcdir .*$$|set srcdir $$srcdir|" \
62             -e "s|^set objdir .*$$|set objdir $$objdir|" \
63             site.exp > $*/site.exp.tmp
64         @-rm -f $*/site.bak
65         @test ! -f $*/site.exp || mv $*/site.exp $*/site.bak
66         @mv $*/site.exp.tmp $*/site.exp
68 check_p_numbers0:=1 2 3 4 5 6 7 8 9
69 check_p_numbers1:=0 $(check_p_numbers0)
70 check_p_numbers2:=$(foreach i,$(check_p_numbers0),$(addprefix $(i),$(check_p_numbers1)))
71 check_p_numbers3:=$(addprefix 0,$(check_p_numbers1)) $(check_p_numbers2)
72 check_p_numbers4:=$(foreach i,$(check_p_numbers0),$(addprefix $(i),$(check_p_numbers3)))
73 check_p_numbers5:=$(addprefix 0,$(check_p_numbers3)) $(check_p_numbers4)
74 check_p_numbers6:=$(foreach i,$(check_p_numbers0),$(addprefix $(i),$(check_p_numbers5)))
75 check_p_numbers:=$(check_p_numbers0) $(check_p_numbers2) $(check_p_numbers4) $(check_p_numbers6)
76 # If unable to serialize execution testing, use just one parallel slot.
77 gcc_test_parallel_slots:=$(if $(FLOCK),$(if $(GCC_TEST_PARALLEL_SLOTS),$(GCC_TEST_PARALLEL_SLOTS),19),1)
78 check_p_subdirs=$(wordlist 1,$(gcc_test_parallel_slots),$(check_p_numbers))
79 check_DEJAGNU_libgomp_targets = $(addprefix check-DEJAGNUlibgomp,$(check_p_subdirs))
80 $(check_DEJAGNU_libgomp_targets): check-DEJAGNUlibgomp%: libgomp%/site.exp
82 check-DEJAGNU $(check_DEJAGNU_libgomp_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 libgomp-parallel || true; \
87           mkdir libgomp-parallel; \
88           $(MAKE) $(AM_MAKEFLAGS) $(check_DEJAGNU_libgomp_targets); \
89           rm -rf libgomp-parallel || true; \
90           for idx in $(check_p_subdirs); do \
91             if [ -d libgomp$$idx ]; then \
92               mv -f libgomp$$idx/libgomp.sum libgomp$$idx/libgomp.sum.sep; \
93               mv -f libgomp$$idx/libgomp.log libgomp$$idx/libgomp.log.sep; \
94             fi; \
95           done; \
96           $(SHELL) $(srcdir)/../../contrib/dg-extract-results.sh \
97             libgomp[0-9]*/libgomp.sum.sep > libgomp.sum; \
98           $(SHELL) $(srcdir)/../../contrib/dg-extract-results.sh -L \
99             libgomp[0-9]*/libgomp.log.sep > libgomp.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=libgomp; \
107         if [ -n "$*" ]; then \
108           if [ -f libgomp-parallel/finished ]; then rm -rf "$*"; exit 0; fi; \
109           GCC_RUNTEST_PARALLELIZE_DIR=`${PWD_COMMAND}`/libgomp-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
123 distclean-DEJAGNU:
124         -rm -f site.exp site.bak
125         -l='$(PACKAGE)'; for tool in $$l; do \
126           rm -f $$tool.sum $$tool.log; \
127         done
128 distclean-am: distclean-DEJAGNU
129 check-am:
130         @if test -n "$(filter -j%, $(MFLAGS))"; then \
131           num_cpus=@CPU_COUNT@; \
132           if type -p getconf 2>/dev/null >/dev/null; then \
133             num_cpus=`getconf _NPROCESSORS_ONLN 2>/dev/null`; \
134             case "$$num_cpus" in \
135               '' | 0* | *[!0-9]*) num_cpus=@CPU_COUNT@;; \
136             esac; \
137           fi; \
138           if test $$num_cpus -gt 8 && test -z "$$OMP_NUM_THREADS"; then \
139             OMP_NUM_THREADS=8; export OMP_NUM_THREADS; \
140             echo @@@ libgomp OMP_NUM_THREADS adjusted to 8 because of parallel make check and too many CPUs; \
141           fi; \
142         fi; \
143         $(MAKE) $(AM_MAKEFLAGS) check-DEJAGNU
144 all-local: libgomp-test-support.exp
146 .PHONY: check-DEJAGNU distclean-DEJAGNU