2015-01-09 22:23:09 +01:00
# Makefile for gotools
2016-06-07 10:54:22 +02:00
# Copyright (C) 2015-2016 Free Software Foundation, Inc.
2015-01-09 22:23:09 +01:00
#
# This file is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 3 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; see the file COPYING3. If not see
# <http://www.gnu.org/licenses/>.
Update GCC to autoconf 2.69, automake 1.15.1 (PR bootstrap/82856).
This patch updates GCC to use autoconf 2.69 and automake 1.15.1.
(That's not the latest automake version, but it's the one used by
binutils-gdb, with which consistency is desirable, and in any case
seems a useful incremental update that should make a future update to
1.16.1 easier.)
The changes are generally similar to the binutils-gdb ones, and are
copied from there where shared files and directories are involved
(there are some further changes to such shared directories, however,
which I'd expect to apply to binutils-gdb once this patch is in GCC).
Largely, obsolete AC_PREREQ calls are removed, while many
AC_LANG_SOURCE calls are added to avoid warnings from aclocal and
autoconf. Multilib support is no longer included in core automake,
meaning that multilib.am needs copying from automake's contrib
directory into the GCC source tree. Autoconf 2.69 has Go support, so
local copies of that support are removed. I hope the D support will
soon be submitted to upstream autoconf so the local copy of that can
be removed in a future update. Changes to how automake generates
runtest calls mean quotes are removed from RUNTEST definitions in five
lib*/testsuite/Makefile.am files (libatomic, libgomp, libitm,
libphobos, libvtv; some others have RUNTEST definitions without
quotes, which are still OK); libgo and libphobos also get
-Wno-override added to AM_INIT_AUTOMAKE so those overrides of RUNTEST
do not generate automake warnings.
Note that the regeneration did not include regeneration of
fixincludes/config.h.in (attempting such regeneration resulted in all
the USED_FOR_TARGET conditionals disappearing; and I don't see
anything in the fixincludes/ directory that would result in such
conditionals being generated, unlike in the gcc/ directory). Also
note that libvtv/testsuite/other-tests/Makefile.in was not
regenerated; that directory is not listed as a subdirectory for which
Makefile.in gets regenerated by calling "automake" in libvtv/, so I'm
not sure how it's meant to be regenerated.
While I mostly fixed warnings should running aclocal / automake /
autoconf, there were various such warnings from automake in the
libgfortran, libgo, libgomp, liboffloadmic, libsanitizer, libphobos
directories that I did not fix, preferring to leave those to the
relevant subsystem maintainers. Specifically, most of those warnings
were of the following form (example from libgfortran):
Makefile.am:48: warning: source file 'caf/single.c' is in a subdirectory,
Makefile.am:48: but option 'subdir-objects' is disabled
automake: warning: possible forward-incompatibility.
automake: At least a source file is in a subdirectory, but the 'subdir-objects'
automake: automake option hasn't been enabled. For now, the corresponding output
automake: object file(s) will be placed in the top-level directory. However,
automake: this behaviour will change in future Automake versions: they
will
automake: unconditionally cause object files to be placed in the same subdirectory
automake: of the corresponding sources.
automake: You are advised to start using 'subdir-objects' option throughout your
automake: project, to avoid future incompatibilities.
I think it's best for the relevant maintainers to add subdir-objects
and do any other associated Makefile.am changes needed. In some cases
the paths in the warnings involved ../; I don't know if that adds any
extra complications to the use of subdir-objects.
I've tested this with native, cross and Canadian cross builds. The
risk of any OS-specific issues should I hope be rather lower than if a
libtool upgrade were included (we *should* do such an upgrade at some
point, but it's more complicated - it involves identifying all our
local libtool changes to see if any aren't included in the upstream
version we update to, and reverting an upstream libtool patch that's
inappropriate for use in GCC); I think it would be better to get this
update into GCC so that people can test in different configurations
and we can fix any issues found, rather than to try to get more and
more testing done before it goes in.
top level:
2018-10-31 Joseph Myers <joseph@codesourcery.com>
PR bootstrap/82856
* multilib.am: New file. From automake.
Merge from binutils-gdb:
2018-06-19 Simon Marchi <simon.marchi@ericsson.com>
* libtool.m4: Use AC_LANG_SOURCE.
* configure.ac: Remove AC_PREREQ, use AC_LANG_SOURCE.
* ar-lib: New file.
* test-driver: New file.
* configure: Re-generate.
config:
2018-10-31 Joseph Myers <joseph@codesourcery.com>
PR bootstrap/82856
* math.m4, tls.m4: Use AC_LANG_SOURCE.
Merge from binutils-gdb:
2018-06-19 Simon Marchi <simon.marchi@ericsson.com>
* override.m4 (_GCC_AUTOCONF_VERSION): Bump from 2.64 to 2.69.
fixincludes:
2018-10-31 Joseph Myers <joseph@codesourcery.com>
PR bootstrap/82856
* configure.ac: Remove AC_PREREQ.
* aclocal.m4, configure: Regenerate.
gcc:
2018-10-31 Joseph Myers <joseph@codesourcery.com>
PR bootstrap/82856
* configure.ac: Remove AC_PREREQ. Use AC_LANG_SOURCE. Use single
line for second argument of AC_DEFINE_UNQUOTED.
* doc/install.texi (Tools/packages necessary for modifying GCC):
Update to autoconf 2.69 and automake 1.15.1.
* aclocal.m4, config.in, configure: Regenerate.
gnattools:
2018-10-31 Joseph Myers <joseph@codesourcery.com>
PR bootstrap/82856
* configure.ac: Remove AC_PREREQ.
* configure: Regenerate.
gotools:
2018-10-31 Joseph Myers <joseph@codesourcery.com>
PR bootstrap/82856
* config/go.m4: Remove file.
* Makefile.am (ACLOCAL_AMFLAGS): Do not use -I ./config.
* configure.ac: Remove AC_PREREQ. Do not include config/go.m4.
* Makefile.in, aclocal.m4, configure: Regenerate.
intl:
2018-10-31 Joseph Myers <joseph@codesourcery.com>
PR bootstrap/82856
Merge from binutils-gdb:
2018-06-19 Simon Marchi <simon.marchi@ericsson.com>
* configure.ac: Add AC_USE_SYSTEM_EXTENSIONS, remove AC_PREREQ.
* configure: Re-generate.
* config.h.in: Re-generate.
* aclocal.m4: Re-generate.
libada:
2018-10-31 Joseph Myers <joseph@codesourcery.com>
PR bootstrap/82856
* configure.ac: Remove AC_PREREQ.
* configure: Regenerate.
libatomic:
2018-10-31 Joseph Myers <joseph@codesourcery.com>
PR bootstrap/82856
* Makefile.am: Include multilib.am.
* acinclude.m4: Use AC_LANG_SOURCE.
* configure.ac: Remove AC_PREREQ.
* testsuite/Makefile.am (RUNTEST): Remove quotes.
* Makefile.in, aclocal.m4, configure, testsuite/Makefile.in:
Regenerate.
libbacktrace:
2018-10-31 Joseph Myers <joseph@codesourcery.com>
PR bootstrap/82856
* Makefile.am: Include multilib.am.
* configure.ac: Remove AC_PREREQ. Use AC_LANG_SOURCE.
* Makefile.in, aclocal.m4, config.h.in, configure: Regenerate.
libcc1:
2018-10-31 Joseph Myers <joseph@codesourcery.com>
PR bootstrap/82856
* configure.ac: Remove AC_PREREQ.
* Makefile.in, aclocal.m4, configure: Regenerate.
libcpp:
2018-10-31 Joseph Myers <joseph@codesourcery.com>
PR bootstrap/82856
* configure.ac: Remove AC_PREREQ. Use AC_LANG_SOURCE.
* aclocal.m4, config.in, configure: Regenerate.
libdecnumber:
2018-10-31 Joseph Myers <joseph@codesourcery.com>
PR bootstrap/82856
Merge from binutils-gdb:
2018-06-19 Simon Marchi <simon.marchi@ericsson.com>
* configure.ac: Remove AC_PREREQ.
* configure: Re-generate.
* aclocal.m4.
libffi:
2018-10-31 Joseph Myers <joseph@codesourcery.com>
PR bootstrap/82856
* Makefile.am: Include multilib.am.
(AUTOMAKE_OPTIONS): Add info-in-builddir.
(CLEANFILES): Remove doc/libffi.info.
* configure.ac: Remove AC_PREREQ.
* Makefile.in, aclocal.m4, configure, fficonfig.h.in,
include/Makefile.in, man/Makefile.in, testsuite/Makefile.in:
Regenerate.
libgcc:
2018-10-31 Joseph Myers <joseph@codesourcery.com>
PR bootstrap/82856
* configure.ac: Remove AC_PREREQ. Use AC_LANG_SOURCE.
* configure: Regenerate.
libgfortran:
2018-10-31 Joseph Myers <joseph@codesourcery.com>
PR bootstrap/82856
* Makefile.am: Include multilib.am.
* configure.ac: Remove AC_PREREQ.
* Makefile.in, aclocal.m4, config.h.in, configure: Regenerate.
libgo [logically part of this change but omitted from the commit]:
2018-10-31 Joseph Myers <joseph@codesourcery.com>
PR bootstrap/82856
* Makefile.am: Include multilib.am.
* config/go.m4: Remove file.
* config/libtool.m4: Use AC_LANG_SOURCE.
* configure.ac: Remove AC_PREREQ. Use AC_LANG_SOURCE. Use
-Wno-override in AM_INIT_AUTOMAKE call.
* Makefile.in, aclocal.m4, configure, testsuite/Makefile.in:
Regenerate.
libgomp:
2018-10-31 Joseph Myers <joseph@codesourcery.com>
PR bootstrap/82856
* Makefile.am: Include multilib.am
(AUTOMAKE_OPTIONS): Add info-in-builddir.
(CLEANFILES): Remove libgomp.info.
* configure.ac: Remove AC_PREREQ.
* testsuite/Makefile.am (RUNTEST): Remove quotes.
* Makefile.in, aclocal.m4, configure, testsuite/Makefile.in:
Regenerate.
libhsail-rt:
2018-10-31 Joseph Myers <joseph@codesourcery.com>
PR bootstrap/82856
* configure.ac: Remove AC_PREREQ.
* Makefile.in, aclocal.m4, configure: Regenerate.
libiberty:
2018-10-31 Joseph Myers <joseph@codesourcery.com>
PR bootstrap/82856
Merge from binutils-gdb:
2018-06-19 Simon Marchi <simon.marchi@ericsson.com>
* configure.ac: Remove AC_PREREQ.
* configure: Re-generate.
* config.in: Re-generate.
libitm:
2018-10-31 Joseph Myers <joseph@codesourcery.com>
PR bootstrap/82856
* Makefile.am: Include multilib.am.
(AUTOMAKE_OPTIONS): Add info-in-builddir.
(CLEANFILES): Remove libitm.info.
* configure.ac: Remove AC_PREREQ.
* testsuite/Makefile.am (RUNTEST): Remove quotes.
* Makefile.in, aclocal.m4, configure, testsuite/Makefile.in:
Regenerate.
libobjc:
2018-10-31 Joseph Myers <joseph@codesourcery.com>
PR bootstrap/82856
* configure.ac: Remove AC_PREREQ.
* aclocal.m4, config.h.in, configure: Regenerate.
liboffloadmic:
2018-10-31 Joseph Myers <joseph@codesourcery.com>
PR bootstrap/82856
* Makefile.am: Include multilib.am.
* configure.ac: Remove AC_PREREQ.
* plugin/Makefile.am: Include multilib.am.
* plugin/configure.ac: Remove AC_PREREQ.
* Makefile.in, aclocal.m4, configure, plugin/Makefile.in,
plugin/aclocal.m4, plugin/configure: Regenerate.
libphobos:
2018-10-31 Joseph Myers <joseph@codesourcery.com>
PR bootstrap/82856
* Makefile.am: Include multilib.am.
* configure.ac: Remove AC_PREREQ. Use -Wno-override in
AM_INIT_AUTOMAKE call.
* m4/autoconf.m4: Add extra argument to AC_LANG_DEFINE call.
* m4/druntime/os.m4: Use AC_LANG_SOURCE.
* testsuite/Makefile.am (RUNTEST): Remove quotes.
* Makefile.in, aclocal.m4, configure, libdruntime/Makefile.in,
src/Makefile.in, testsuite/Makefile.in: Regenerate.
libquadmath:
2018-10-31 Joseph Myers <joseph@codesourcery.com>
PR bootstrap/82856
* Makefile.am: Include multilib.am.
(AUTOMAKE_OPTIONS): Remove 1.8. Add info-in-builddir.
(all-local): Define outside conditional code.
(CLEANFILES): Remove libquadmath.info.
* configure.ac: Remove AC_PREREQ.
* Makefile.in, aclocal.m4, config.h.in, configure: Regenerate.
libsanitizer:
2018-10-31 Joseph Myers <joseph@codesourcery.com>
PR bootstrap/82856
* Makefile.am: Include multilib.am.
* configure.ac: Remove AC_PREREQ. Use AC_LANG_SOURCE.
* Makefile.in, aclocal.m4, asan/Makefile.in, configure,
interception/Makefile.in, libbacktrace/Makefile.in,
lsan/Makefile.in, sanitizer_common/Makefile.in, tsan/Makefile.in,
ubsan/Makefile.in: Regenerate.
libssp:
2018-10-31 Joseph Myers <joseph@codesourcery.com>
PR bootstrap/82856
* Makefile.am: Include multilib.am.
(AUTOMAKE_OPTIONS): Remove 1.9.5.
* configure.ac: Remove AC_PREREQ. Quote argument to
AC_RUN_IFELSE.
* Makefile.in, aclocal.m4, configure: Regenerate.
libstdc++-v3:
2018-10-31 Joseph Myers <joseph@codesourcery.com>
PR bootstrap/82856
* Makefile.am: Include multilib.am.
* configure.ac: Remove AC_PREREQ.
* Makefile.in, aclocal.m4, configure, doc/Makefile.in,
include/Makefile.in, libsupc++/Makefile.in, po/Makefile.in,
python/Makefile.in, src/Makefile.in, src/c++11/Makefile.in,
src/c++17/Makefile.in, src/c++98/Makefile.in,
src/filesystem/Makefile.in, testsuite/Makefile.in: Regenerate.
libvtv:
2018-10-31 Joseph Myers <joseph@codesourcery.com>
PR bootstrap/82856
* Makefile.am: Include multilib.am.
* configure.ac: Remove AC_PREREQ.
* testsuite/Makefile.am (RUNTEST): Remove quotes.
* Makefile.in, aclocal.m4, configure, testsuite/Makefile.in:
Regenerate.
lto-plugin:
2018-10-31 Joseph Myers <joseph@codesourcery.com>
PR bootstrap/82856
* configure.ac: Remove AC_PREREQ. Use AC_LANG_SOURCE.
* Makefile.in, aclocal.m4, config.h.in, configure: Regenerate.
zlib:
2018-10-31 Joseph Myers <joseph@codesourcery.com>
PR bootstrap/82856
* Makefile.am: Include multilib.am.
Merge from binutils-gdb:
2018-06-19 Simon Marchi <simon.marchi@ericsson.com>
* configure.ac: Modernize AC_INIT call, remove AC_PREREQ.
* Makefile.am (AUTOMAKE_OPTIONS): Remove 1.8, cygnus, add foreign.
* Makefile.in: Re-generate.
* aclocal.m4: Re-generate.
* configure: Re-generate.
From-SVN: r265695
2018-10-31 18:03:16 +01:00
ACLOCAL_AMFLAGS = -I ../config
2015-01-09 22:23:09 +01:00
gcc_version := $( shell $( GCC_FOR_TARGET) -dumpversion)
libexecsubdir = $( libexecdir) /gcc/$( target_noncanonical) /$( gcc_version)
mkinstalldirs = $( SHELL) $( toplevel_srcdir) /mkinstalldirs
PWD_COMMAND = $$ { PWDCMD-pwd}
STAMP = echo timestamp >
libgodir = ../$( target_noncanonical) /libgo
LIBGODEP = $( libgodir) /libgo.la
2017-09-14 19:11:35 +02:00
LIBGOTOOL = $( libgodir) /libgotool.a
2015-01-10 01:23:48 +01:00
i f N A T I V E
# Use the compiler we just built.
2015-12-02 20:27:58 +01:00
GOCOMPILER = $( GOC_FOR_TARGET) $( XGCC_FLAGS_FOR_TARGET)
2015-01-10 01:23:48 +01:00
e l s e
GOCOMPILER = $( GOC)
e n d i f
2015-01-09 22:23:09 +01:00
GOCFLAGS = $( CFLAGS_FOR_TARGET)
2015-01-10 01:23:48 +01:00
GOCOMPILE = $( GOCOMPILER) $( GOCFLAGS)
2015-01-09 22:23:09 +01:00
2017-05-19 00:44:12 +02:00
AM_GOCFLAGS = -I $( libgodir)
2015-01-24 00:11:59 +01:00
AM_LDFLAGS = -L $( libgodir) -L $( libgodir) /.libs
2015-03-12 17:44:36 +01:00
GOLINK = $( GOCOMPILER) $( GOCFLAGS) $( AM_GOCFLAGS) $( LDFLAGS) $( AM_LDFLAGS) -o $@
2015-01-09 22:23:09 +01:00
2017-06-14 21:26:21 +02:00
libgosrcdir = $( srcdir) /../libgo/go
cmdsrcdir = $( libgosrcdir) /cmd
2017-06-29 18:01:38 +02:00
libgomiscdir = $( srcdir) /../libgo/misc
2015-01-09 22:23:09 +01:00
go_cmd_go_files = \
2015-10-31 22:29:38 +01:00
$( cmdsrcdir) /go/alldocs.go \
2015-01-09 22:23:09 +01:00
$( cmdsrcdir) /go/go11.go \
2017-09-14 19:11:35 +02:00
$( cmdsrcdir) /go/main.go
2015-01-09 22:23:09 +01:00
go_cmd_gofmt_files = \
$( cmdsrcdir) /gofmt/doc.go \
$( cmdsrcdir) /gofmt/gofmt.go \
2016-02-03 22:58:02 +01:00
$( cmdsrcdir) /gofmt/internal.go \
2015-01-09 22:23:09 +01:00
$( cmdsrcdir) /gofmt/rewrite.go \
$( cmdsrcdir) /gofmt/simplify.go
go_cmd_cgo_files = \
$( cmdsrcdir) /cgo/ast.go \
2022-02-11 23:53:56 +01:00
$( cmdsrcdir) /cgo/ast_go118.go \
2015-01-09 22:23:09 +01:00
$( cmdsrcdir) /cgo/doc.go \
$( cmdsrcdir) /cgo/gcc.go \
$( cmdsrcdir) /cgo/godefs.go \
$( cmdsrcdir) /cgo/main.go \
$( cmdsrcdir) /cgo/out.go \
$( cmdsrcdir) /cgo/util.go
2018-01-09 02:23:08 +01:00
go_cmd_vet_files = \
$( cmdsrcdir) /vet/doc.go \
2019-01-18 20:04:36 +01:00
$( cmdsrcdir) /vet/main.go
2018-01-09 02:23:08 +01:00
go_cmd_buildid_files = \
$( cmdsrcdir) /buildid/buildid.go \
$( cmdsrcdir) /buildid/doc.go
go_cmd_test2json_files = \
$( cmdsrcdir) /test2json/main.go
2015-01-09 22:23:09 +01:00
GCCGO_INSTALL_NAME := $( shell echo gccgo| sed '$(program_transform_name)' )
GCC_INSTALL_NAME := $( shell echo gcc| sed '$(program_transform_name)' )
GXX_INSTALL_NAME := $( shell echo g++| sed '$(program_transform_name)' )
zdefaultcc.go : s -zdefaultcc ; @true
s-zdefaultcc : Makefile
echo 'package main' > zdefaultcc.go.tmp
2018-01-09 02:23:08 +01:00
echo 'func defaultGCCGO(goos, goarch string) string { return "$(bindir)/$(GCCGO_INSTALL_NAME)" }' >> zdefaultcc.go.tmp
echo 'func defaultCC(goos, goarch string) string { return "$(GCC_INSTALL_NAME)" }' >> zdefaultcc.go.tmp
echo 'func defaultCXX(goos, goarch string) string { return "$(GXX_INSTALL_NAME)" }' >> zdefaultcc.go.tmp
2017-01-14 01:05:42 +01:00
echo 'const defaultPkgConfig = "pkg-config"' >> zdefaultcc.go.tmp
2015-01-09 22:23:09 +01:00
$( SHELL) $( srcdir) /../move-if-change zdefaultcc.go.tmp zdefaultcc.go
$( STAMP) $@
2017-06-29 18:01:38 +02:00
MOSTLYCLEANFILES = \
zdefaultcc.go s-zdefaultcc \
2017-08-30 20:27:17 +02:00
check-gccgo check-gcc gotools.head *-testlog gotools.sum gotools.log \
*.sent
2017-06-29 18:01:38 +02:00
mostlyclean-local :
2019-02-13 01:10:06 +01:00
if test -d check-go-dir; then chmod -R u+w check-go-dir; fi
2020-12-23 18:57:37 +01:00
rm -rf check-go-dir cgo-test-dir carchive-test-dir \
2021-02-02 21:39:34 +01:00
check-vet-dir check-embed-dir gocache-test
2015-01-10 01:23:48 +01:00
2015-01-09 22:23:09 +01:00
i f N A T I V E
# For a native build we build the programs using the newly built libgo
# and install them as regular programs.
bin_PROGRAMS = go$( EXEEXT) gofmt$( EXEEXT)
2018-01-09 02:23:08 +01:00
noinst_PROGRAMS = cgo$( EXEEXT) vet$( EXEEXT) buildid$( EXEEXT) test2json$( EXEEXT)
2015-01-23 02:42:08 +01:00
man_MANS = go.1 gofmt.1
2015-01-09 22:23:09 +01:00
2017-09-14 19:11:35 +02:00
go$(EXEEXT) : $( go_cmd_go_files ) $( LIBGOTOOL ) $( LIBGODEP )
$( GOLINK) $( go_cmd_go_files) $( LIBGOTOOL) $( LIBS) $( NET_LIBS)
2015-01-09 22:23:09 +01:00
gofmt$(EXEEXT) : $( go_cmd_gofmt_files ) $( LIBGODEP )
2020-01-03 00:05:27 +01:00
$( GOLINK) $( go_cmd_gofmt_files) $( LIBGOTOOL) $( LIBS) $( NET_LIBS)
2018-01-09 02:23:08 +01:00
cgo$(EXEEXT) : $( go_cmd_cgo_files ) zdefaultcc .go $( LIBGOTOOL ) $( LIBGODEP )
$( GOLINK) $( go_cmd_cgo_files) zdefaultcc.go $( LIBGOTOOL) $( LIBS) $( NET_LIBS)
vet$(EXEEXT) : $( go_cmd_vet_files ) $( LIBGOTOOL ) $( LIBGODEP )
$( GOLINK) $( go_cmd_vet_files) $( LIBGOTOOL) $( LIBS) $( NET_LIBS)
buildid$(EXEEXT) : $( go_cmd_buildid_files ) $( LIBGOTOOL ) $( LIBGODEP )
$( GOLINK) $( go_cmd_buildid_files) $( LIBGOTOOL) $( LIBS) $( NET_LIBS)
test2json$(EXEEXT) : $( go_cmd_test 2json_files ) $( LIBGOTOOL ) $( LIBGODEP )
$( GOLINK) $( go_cmd_test2json_files) $( LIBGOTOOL) $( LIBS) $( NET_LIBS)
install-exec-local : $( noinst_PROGRAMS )
2015-01-22 05:19:11 +01:00
$( MKDIR_P) $( DESTDIR) $( libexecsubdir)
2018-01-09 02:23:08 +01:00
for f in $( noinst_PROGRAMS) ; do \
rm -f $( DESTDIR) $( libexecsubdir) /$$ f; \
$( INSTALL_PROGRAM) $$ f $( DESTDIR) $( libexecsubdir) /$$ f; \
done
2015-01-22 05:19:11 +01:00
uninstall-local :
2018-01-09 02:23:08 +01:00
for f in $( noinst_PROGRAMS) ; do \
rm -f $( DESTDIR) $( libexecsubdir) /$$ f; \
done
2015-01-22 05:19:11 +01:00
2017-09-19 09:51:49 +02:00
GOTESTFLAGS =
2018-01-19 06:04:51 +01:00
# Number of seconds before tests time out.
2019-03-01 06:25:36 +01:00
GOTOOLS_TEST_TIMEOUT = 1200
2018-01-19 06:04:51 +01:00
2017-06-14 21:26:21 +02:00
# Run tests using the go tool, and frob the output to look like that
# generated by DejaGNU. The main output of this is two files:
# gotools.sum and gotools.log.
# check-head starts generating the log files in DejaGNU format. This
# is a separate target so that the date is approximately when we start
# running the tests.
check-head :
@echo " Test Run By $$ {USER} on `date` " > gotools.head
@echo " Native configuration is $( host_triplet) " >> gotools.head
@echo >> gotools.head
@echo " === gotools tests ===" >> gotools.head
@echo >> gotools.head
# check-gccgo is a little shell script that executes gccgo with the
2018-02-08 16:34:42 +01:00
# options to pick up the newly built libgo and libstdc++.
2017-06-14 21:26:21 +02:00
check-gccgo : Makefile
2017-08-30 20:27:17 +02:00
rm -f $@ $@ .tmp
echo "#!/bin/sh" > $@ .tmp
2017-06-14 21:26:21 +02:00
abs_libgodir = ` cd $( libgodir) && $( PWD_COMMAND) ` ; \
2018-02-08 16:34:42 +01:00
echo " $( GOCOMPILE) " '"$$@"' " -I $$ {abs_libgodir} -L $$ {abs_libgodir} -L $$ {abs_libgodir}/.libs -B $$ {abs_libgodir}/../libstdc++-v3/src/.libs -B $$ {abs_libgodir}/../libstdc++-v3/libsupc++/.libs " >> $@ .tmp
2017-08-30 20:27:17 +02:00
chmod +x $@ .tmp
mv -f $@ .tmp $@
# check-gcc is a little shell script that executes the newly built gcc
2018-02-08 16:34:42 +01:00
# with the options to pick up the newly built libgo and libstdc++.
2017-08-30 20:27:17 +02:00
check-gcc : Makefile
rm -f $@ $@ .tmp
echo "#!/bin/sh" > $@ .tmp
abs_libgodir = ` cd $( libgodir) && $( PWD_COMMAND) ` ; \
2018-02-08 16:34:42 +01:00
echo " $( GCC_FOR_TARGET) " '"$$@"' " -L $$ {abs_libgodir} -L $$ {abs_libgodir}/.libs -B $$ {abs_libgodir}/../libstdc++-v3/src/.libs -B $$ {abs_libgodir}/../libstdc++-v3/libsupc++/.libs " >> $@ .tmp
2017-08-30 20:27:17 +02:00
chmod +x $@ .tmp
mv -f $@ .tmp $@
2017-06-14 21:26:21 +02:00
# CHECK_ENV sets up the environment to run the newly built go tool.
2017-06-29 18:01:38 +02:00
# If you change this, change ECHO_ENV, below.
2017-09-14 19:11:35 +02:00
# The fl shell variable is used to avoid having FAIL appear
# in the log unnecessarily.
2017-06-14 21:26:21 +02:00
CHECK_ENV = \
PATH = ` echo $( abs_builddir) :$$ { PATH} | sed 's,::*,:,g;s,^:*,,;s,:*$$,,' ` ; \
export PATH; \
GCCGO = " $( abs_builddir) /check-gccgo " ; \
export GCCGO; \
2017-08-30 20:27:17 +02:00
CC = " $( abs_builddir) /check-gcc " ; \
export CC; \
2017-06-14 21:26:21 +02:00
GCCGOTOOLDIR = " $( abs_builddir) " ; \
export GCCGOTOOLDIR; \
GO_TESTING_GOTOOLS = yes; \
export GO_TESTING_GOTOOLS; \
abs_libgodir = ` cd $( libgodir) && $( PWD_COMMAND) ` ; \
LD_LIBRARY_PATH = ` echo $$ { abs_libgodir} /.libs:$$ { LD_LIBRARY_PATH} | sed 's,::*,:,g;s,^:*,,;s,:*$$,,' ` ; \
2017-07-15 19:50:18 +02:00
export LD_LIBRARY_PATH; \
GOROOT = $$ { abs_libgodir} ; \
2017-09-14 19:11:35 +02:00
export GOROOT; \
2018-05-04 18:23:51 +02:00
GOCACHE = $( abs_builddir) /gocache-test; \
export GOCACHE; \
2017-09-14 19:11:35 +02:00
fl1 = "FA" ; fl2 = "IL" ; fl = " $$ {fl1} $$ {fl2} " ;
2017-06-14 21:26:21 +02:00
2017-06-29 18:01:38 +02:00
# ECHO_ENV is a variant of CHECK_ENV to put into a testlog file.
# It assumes that abs_libgodir is set.
2018-05-04 18:23:51 +02:00
ECHO_ENV = PATH = ` echo $( abs_builddir) :$$ { PATH} | sed 's,::*,:,g;s,^:*,,;s,:*$$,,' ` GCCGO = '$(abs_builddir)/check-gccgo' CC = '$(abs_builddir)/check-gcc' GCCGOTOOLDIR = '$(abs_builddir)' GO_TESTING_GOTOOLS = yes LD_LIBRARY_PATH = ` echo $$ { abs_libgodir} /.libs:$$ { LD_LIBRARY_PATH} | sed 's,::*,:,g;s,^:*,,;s,:*$$,,' ` GOROOT = ` echo $$ { abs_libgodir} GOCACHE = '$(abs_builddir)/gocache-test' `
2017-06-29 18:01:38 +02:00
2018-01-09 02:23:08 +01:00
# check-go-tool runs `go test cmd/go` in our environment.
check-go-tool : go $( EXEEXT ) $( noinst_PROGRAMS ) check -head check -gccgo check -gcc
2019-05-27 21:21:22 +02:00
if test -d check-go-dir; then chmod -R u+w check-go-dir; fi
2017-06-29 18:01:38 +02:00
rm -rf check-go-dir cmd_go-testlog
2017-06-14 21:26:21 +02:00
$( MKDIR_P) check-go-dir/src/cmd/go
2020-12-23 18:57:37 +01:00
cp $( libgosrcdir) /go.mod check-go-dir/src/
cp $( cmdsrcdir) /go.mod check-go-dir/src/cmd/
$( MKDIR_P) check-go-dir/src/vendor check-go-dir/src/cmd/vendor
cp $( libgosrcdir) /vendor/modules.txt check-go-dir/src/vendor/
cp $( libgosrcdir) /cmd/vendor/modules.txt check-go-dir/src/cmd/vendor/
2017-06-14 21:26:21 +02:00
cp $( cmdsrcdir) /go/*.go check-go-dir/src/cmd/go/
2017-09-14 19:11:35 +02:00
cp -r $( cmdsrcdir) /go/internal check-go-dir/src/cmd/go/
cp $( libgodir) /zdefaultcc.go check-go-dir/src/cmd/go/internal/cfg/
2017-06-14 21:26:21 +02:00
cp -r $( cmdsrcdir) /go/testdata check-go-dir/src/cmd/go/
2017-09-14 19:11:35 +02:00
cp -r $( cmdsrcdir) /internal check-go-dir/src/cmd/
2020-01-03 00:05:27 +01:00
$( MKDIR_P) check-go-dir/src/cmd/vendor/golang.org/x
cp -r $( libgosrcdir) /golang.org/x/mod check-go-dir/src/cmd/vendor/golang.org/x/
cp -r $( libgosrcdir) /golang.org/x/crypto check-go-dir/src/cmd/vendor/golang.org/x/
cp -r $( libgosrcdir) /golang.org/x/xerrors check-go-dir/src/cmd/vendor/golang.org/x/
2022-02-11 23:53:56 +01:00
cp -r $( libgosrcdir) /golang.org/x/tools check-go-dir/src/cmd/vendor/golang.org/x/
2018-01-09 02:23:08 +01:00
cp $( libgodir) /objabi.go check-go-dir/src/cmd/internal/objabi/
2017-06-29 18:01:38 +02:00
@abs_libgodir= ` cd $( libgodir) && $( PWD_COMMAND) ` ; \
abs_checkdir = ` cd check-go-dir && $( PWD_COMMAND) ` ; \
2018-01-19 06:04:51 +01:00
echo " cd check-go-dir/src/cmd/go && $( ECHO_ENV) GOPATH= $$ {abs_checkdir} $( abs_builddir) /go $( EXEEXT) test -test.short -test.timeout= $( GOTOOLS_TEST_TIMEOUT) s -test.v " > cmd_go-testlog
2017-06-14 21:26:21 +02:00
$( CHECK_ENV) \
GOPATH = ` cd check-go-dir && $( PWD_COMMAND) ` ; \
export GOPATH; \
2018-01-19 06:04:51 +01:00
( cd check-go-dir/src/cmd/go && $( abs_builddir) /go$( EXEEXT) test -test.short -test.timeout= $( GOTOOLS_TEST_TIMEOUT) s -test.v) >> cmd_go-testlog 2>& 1 || echo " --- $$ {fl}: go test cmd/go (0.00s) " >> cmd_go-testlog
2017-09-19 09:51:49 +02:00
grep '^--- ' cmd_go-testlog | sed -e 's/^--- \(.*\) ([^)]*)$$/\1/' | sort -k 2
2017-06-14 21:26:21 +02:00
2017-06-29 18:01:38 +02:00
# check-runtime runs `go test runtime` in our environment.
# The runtime package is also tested as part of libgo,
# but the runtime tests use the go tool heavily, so testing
# here too will catch more problems.
2018-01-09 02:23:08 +01:00
check-runtime : go $( EXEEXT ) $( noinst_PROGRAMS ) check -head check -gccgo check -gcc
2020-12-23 18:57:37 +01:00
rm -f runtime-testlog
2017-06-29 18:01:38 +02:00
@abs_libgodir= ` cd $( libgodir) && $( PWD_COMMAND) ` ; \
LD_LIBRARY_PATH = ` echo $$ { abs_libgodir} /.libs:$$ { LD_LIBRARY_PATH} | sed 's,::*,:,g;s,^:*,,;s,:*$$,,' ` ; \
2019-01-18 20:04:36 +01:00
export LD_LIBRARY_PATH; \
2017-06-29 18:01:38 +02:00
GOARCH = ` $( abs_builddir) /go$( EXEEXT) env GOARCH` ; \
GOOS = ` $( abs_builddir) /go$( EXEEXT) env GOOS` ; \
2021-09-21 20:44:26 +02:00
files = ` $( SHELL) $( libgosrcdir) /../match.sh --goarch= $$ { GOARCH} --goos= $$ { GOOS} --srcdir= $( libgosrcdir) /runtime --extrafiles= " $( libgodir) /runtime_linknames.go $( libgodir) /runtime_sysinfo.go $( libgodir) /sigtab.go $( libgodir) /goroot.go " --tag= libffi` ; \
2022-02-13 02:12:41 +01:00
echo " $( ECHO_ENV) GC=' $( abs_builddir) /check-gccgo -fgo-compiling-runtime' GOARCH= $$ {GOARCH} GOOS= $$ {GOOS} $( SHELL) $( libgosrcdir) /../testsuite/gotest --goarch= $$ {GOARCH} --goos= $$ {GOOS} --basedir= $( libgosrcdir) /.. --srcdir= $( libgosrcdir) /runtime --pkgpath=runtime --pkgfiles=' $$ {files}' $( GOTESTFLAGS) -test.timeout= $( GOTOOLS_TEST_TIMEOUT) s -test.v " > runtime-testlog
2017-06-29 18:01:38 +02:00
$( CHECK_ENV) \
GC = " $$ {GCCGO} -fgo-compiling-runtime " ; \
export GC; \
GOARCH = ` $( abs_builddir) /go$( EXEEXT) env GOARCH` ; \
GOOS = ` $( abs_builddir) /go$( EXEEXT) env GOOS` ; \
2021-09-21 20:44:26 +02:00
files = ` $( SHELL) $( libgosrcdir) /../match.sh --goarch= $$ { GOARCH} --goos= $$ { GOOS} --srcdir= $( libgosrcdir) /runtime --extrafiles= " $( libgodir) /runtime_linknames.go $( libgodir) /runtime_sysinfo.go $( libgodir) /sigtab.go $( libgodir) /goroot.go " --tag= libffi` ; \
2018-03-21 16:46:37 +01:00
$( SHELL) $( libgosrcdir) /../testsuite/gotest --goarch= $$ { GOARCH} --goos= $$ { GOOS} --basedir= $( libgosrcdir) /.. --srcdir= $( libgosrcdir) /runtime --pkgpath= runtime --pkgfiles= " $$ {files} " $( GOTESTFLAGS) -test.timeout= $( GOTOOLS_TEST_TIMEOUT) s -test.v >> runtime-testlog 2>& 1 || echo " --- $$ {fl}: go test runtime (0.00s) " >> runtime-testlog
2017-09-19 09:51:49 +02:00
grep '^--- ' runtime-testlog | sed -e 's/^--- \(.*\) ([^)]*)$$/\1/' | sort -k 2
2017-06-29 18:01:38 +02:00
2019-09-06 20:12:46 +02:00
# check-cgo-test runs `go test` in misc/cgo/test.
2018-01-09 02:23:08 +01:00
check-cgo-test : go $( EXEEXT ) $( noinst_PROGRAMS ) check -head check -gccgo check -gcc
2017-06-29 18:01:38 +02:00
rm -rf cgo-test-dir cgo-testlog
$( MKDIR_P) cgo-test-dir/misc/cgo
2020-12-23 18:57:37 +01:00
echo 'module misc' > cgo-test-dir/misc/go.mod
2017-06-29 18:01:38 +02:00
cp -r $( libgomiscdir) /cgo/test cgo-test-dir/misc/cgo/
@abs_libgodir= ` cd $( libgodir) && $( PWD_COMMAND) ` ; \
2018-01-19 06:04:51 +01:00
echo " cd cgo-test-dir/misc/cgo/test && $( ECHO_ENV) GOTRACEBACK=2 $( abs_builddir) /go $( EXEEXT) test -test.short -test.timeout= $( GOTOOLS_TEST_TIMEOUT) s -test.v " > cgo-testlog
2017-06-29 18:01:38 +02:00
$( CHECK_ENV) \
GOTRACEBACK = 2; \
export GOTRACEBACK; \
2018-01-19 06:04:51 +01:00
( cd cgo-test-dir/misc/cgo/test && $( abs_builddir) /go$( EXEEXT) test -test.short -test.timeout= $( GOTOOLS_TEST_TIMEOUT) s -test.v) >> cgo-testlog 2>& 1 || echo " --- $$ {fl}: go test misc/cgo/test (0.00s) " >> cgo-testlog
2017-09-19 09:51:49 +02:00
grep '^--- ' cgo-testlog | sed -e 's/^--- \(.*\) ([^)]*)$$/\1/' | sort -k 2
2017-06-29 18:01:38 +02:00
2019-09-06 20:12:46 +02:00
# check-carchive-test runs `go test` in misc/cgo/testcarchive.
2017-06-29 18:01:38 +02:00
# in our environment.
2018-01-09 02:23:08 +01:00
check-carchive-test : go $( EXEEXT ) $( noinst_PROGRAMS ) check -head check -gccgo check -gcc
2017-06-29 18:01:38 +02:00
rm -rf carchive-test-dir carchive-testlog
$( MKDIR_P) carchive-test-dir/misc/cgo
2020-12-23 18:57:37 +01:00
echo 'module misc' > carchive-test-dir/misc/go.mod
2017-06-29 18:01:38 +02:00
cp -r $( libgomiscdir) /cgo/testcarchive carchive-test-dir/misc/cgo/
@abs_libgodir= ` cd $( libgodir) && $( PWD_COMMAND) ` ; \
2019-09-06 20:12:46 +02:00
echo " cd carchive-test-dir/misc/cgo/testcarchive && $( ECHO_ENV) LIBRARY_PATH=`echo $$ {abs_libgodir}/.libs` $( abs_builddir) /go $( EXEEXT) test -test.timeout= $( GOTOOLS_TEST_TIMEOUT) s -test.v " > carchive-testlog
2017-06-29 18:01:38 +02:00
$( CHECK_ENV) \
LIBRARY_PATH = ` echo $$ { abs_libgodir} /.libs:$$ { LIBRARY_PATH} | sed 's,::*,:,g;s,^:*,,;s,:*$$,,' ` ; \
export LIBRARY_PATH; \
2019-09-06 20:12:46 +02:00
( cd carchive-test-dir/misc/cgo/testcarchive && $( abs_builddir) /go$( EXEEXT) test -test.timeout= $( GOTOOLS_TEST_TIMEOUT) s -test.v) >> carchive-testlog 2>& 1 || echo " --- $$ {fl}: go test misc/cgo/testcarchive (0.00s) " >> carchive-testlog
2017-09-19 09:51:49 +02:00
grep '^--- ' carchive-testlog | sed -e 's/^--- \(.*\) ([^)]*)$$/\1/' | sort -k 2
2017-06-29 18:01:38 +02:00
2018-01-09 02:23:08 +01:00
# check-vet runs `go test cmd/vet` in our environment.
check-vet : go $( EXEEXT ) $( noinst_PROGRAMS ) check -head check -gccgo check -gcc
rm -rf check-vet-dir cmd_vet-testlog
2019-01-18 20:04:36 +01:00
$( MKDIR_P) check-vet-dir/src/cmd/internal check-vet-dir/src/cmd/vendor/golang.org/x
2020-12-23 18:57:37 +01:00
cp $( libgosrcdir) /go.mod check-vet-dir/src/
cp $( cmdsrcdir) /go.mod check-vet-dir/src/cmd/
$( MKDIR_P) check-vet-dir/src/vendor check-vet-dir/src/cmd/vendor
cp $( libgosrcdir) /vendor/modules.txt check-vet-dir/src/vendor/
cp $( libgosrcdir) /cmd/vendor/modules.txt check-vet-dir/src/cmd/vendor/
2018-01-09 02:23:08 +01:00
cp -r $( cmdsrcdir) /vet check-vet-dir/src/cmd/
2018-09-24 23:46:21 +02:00
cp -r $( cmdsrcdir) /internal/objabi check-vet-dir/src/cmd/internal
cp $( libgodir) /objabi.go check-vet-dir/src/cmd/internal/objabi/
2019-01-18 20:04:36 +01:00
cp -r $( libgosrcdir) /golang.org/x/tools check-vet-dir/src/cmd/vendor/golang.org/x/
2018-01-09 02:23:08 +01:00
@abs_libgodir= ` cd $( libgodir) && $( PWD_COMMAND) ` ; \
abs_checkdir = ` cd check-vet-dir && $( PWD_COMMAND) ` ; \
2018-01-19 06:04:51 +01:00
echo " cd check-vet-dir/src/cmd/vet && $( ECHO_ENV) GOPATH= $$ {abs_checkdir} $( abs_builddir) /go $( EXEEXT) test -test.short -test.timeout= $( GOTOOLS_TEST_TIMEOUT) s -test.v " > cmd_vet-testlog
2018-01-09 02:23:08 +01:00
$( CHECK_ENV) \
GOPATH = ` cd check-vet-dir && $( PWD_COMMAND) ` ; \
export GOPATH; \
2018-01-19 06:04:51 +01:00
( cd check-vet-dir/src/cmd/vet && $( abs_builddir) /go$( EXEEXT) test -test.short -test.timeout= $( GOTOOLS_TEST_TIMEOUT) s -test.v) >> cmd_vet-testlog 2>& 1 || echo " --- $$ {fl}: go test cmd/vet (0.00s) " >> cmd_vet-testlog
2018-01-09 02:23:08 +01:00
grep '^--- ' cmd_vet-testlog | sed -e 's/^--- \(.*\) ([^)]*)$$/\1/' | sort -k 2
2021-02-02 21:39:34 +01:00
# check-embed runs `go test embed/internal/embedtest` in our environment.
check-embed : go $( EXEEXT ) $( noinst_PROGRAMS ) check -head check -gccgo check -gcc
rm -rf check-embed-dir embed-testlog
$( MKDIR_P) check-embed-dir/src/embed/internal
cp $( libgosrcdir) /go.mod check-embed-dir/src/
$( MKDIR_P) check-embed-dir/src/vendor
cp $( libgosrcdir) /vendor/modules.txt check-embed-dir/src/vendor/
cp -r $( libgosrcdir) /embed/internal/embedtest check-embed-dir/src/embed/internal
@abs_libgodir= ` cd $( libgodir) && $( PWD_COMMAND) ` ; \
abs_checkdir = ` cd check-embed-dir && $( PWD_COMMAND) ` ; \
echo " cd check-embed-dir/src/embed/internal/embedtest && $( ECHO_ENV) GOPATH= $$ {abs_checkdir} $( abs_builddir) /go $( EXEEXT) test -test.short -test.timeout= $( GOTOOLS_TEST_TIMEOUT) s -test.v " > embed-testlog
$( CHECK_ENV) \
GOPATH = ` cd check-embed-dir && $( PWD_COMMAND) ` ; \
export GOPATH; \
( cd check-embed-dir/src/embed/internal/embedtest && $( abs_builddir) /go$( EXEEXT) test -test.short -test.timeout= $( GOTOOLS_TEST_TIMEOUT) s -test.v) >> embed-testlog 2>& 1 || echo " --- $$ {fl}: go test embed/internal/embedtest (0.00s) " >> embed-testlog
grep '^--- ' embed-testlog | sed -e 's/^--- \(.*\) ([^)]*)$$/\1/' | sort -k 2
2017-06-14 21:26:21 +02:00
# The check targets runs the tests and assembles the output files.
2021-02-02 21:39:34 +01:00
check : check -head check -go -tool check -runtime check -cgo -test check -carchive -test check -vet check -embed
2017-06-29 18:01:38 +02:00
@mv gotools.head gotools.sum
@cp gotools.sum gotools.log
2021-02-02 21:39:34 +01:00
@for file in cmd_go-testlog runtime-testlog cgo-testlog carchive-testlog cmd_vet-testlog embed-testlog; do \
2017-06-14 21:26:21 +02:00
testname = ` echo $$ { file} | sed -e 's/-testlog//' -e 's|_|/|' ` ; \
echo " Running $$ {testname} " >> gotools.sum; \
echo " Running $$ {testname} " >> gotools.log; \
sed -e 's/^--- \(.*\) ([^)]*)$$/\1/' < $$ { file} >> gotools.log; \
2017-09-19 09:51:49 +02:00
grep '^--- ' $$ { file} | sed -e 's/^--- \(.*\) ([^)]*)$$/\1/' -e 's/SKIP/UNTESTED/' | sort -k 2 >> gotools.sum; \
2017-06-14 21:26:21 +02:00
done
@echo >> gotools.sum
@echo " === gotools Summary ===" >> gotools.sum
2017-06-29 18:01:38 +02:00
@pass= ` grep -c '^PASS' gotools.sum` ; \
2017-06-14 21:26:21 +02:00
if test " $$ {pass} " -ne "0" ; then \
echo " # of expected passes $$ {pass} " >> gotools.sum; \
fi
2017-06-29 18:01:38 +02:00
@fail= ` grep -c '^FAIL' gotools.sum` ; \
2017-06-14 21:26:21 +02:00
if test " $$ {fail} " -ne "0" ; then \
echo " # of unexpected failures $$ {fail} " >> gotools.sum; \
fi
2017-06-29 18:01:38 +02:00
@untested= ` grep -c '^UNTESTED' gotools.sum` ; \
2017-06-14 21:26:21 +02:00
if test " $$ {untested} " -ne "0" ; then \
echo " # of untested testcases $$ {untested} " >> gotools.sum; \
fi
2017-06-29 18:01:38 +02:00
@echo ` echo $( GOC_FOR_TARGET) | sed -e 's/ .*//' ` ` $( GOC_FOR_TARGET) -v 2>& 1 | grep " version" | sed -n -e 's/.* \(version.*$$\)/\1/p' ` >> gotools.sum
@echo >> gotools.log
@echo "runtest completed at `date`" >> gotools.log
@if grep '^FAIL' gotools.sum >/dev/null 2>& 1; then exit 1; fi
2017-06-14 21:26:21 +02:00
2021-02-02 21:39:34 +01:00
.PHONY : check check -head check -go -tool check -runtime check -cgo -test
.PHONY : check -carchive -test check -vet check -embed
2017-06-14 21:26:21 +02:00
2015-01-09 22:23:09 +01:00
e l s e
# For a non-native build we have to build the programs using a
# previously built host (or build -> host) Go compiler. We should
# only do this if such a compiler is available. We also need to get
# the right values for GOARCH and GOOS in the default build context in
# the go/build package. Figure this out later.
e n d i f