Emit SIMD moves as mov
[official-gcc.git] / gotools / Makefile.am
blob010c5bb554b4c5aaf4e41797bd438c91224173c7
1 # Makefile for gotools
2 #   Copyright (C) 2015-2016 Free Software Foundation, Inc.
4 # This file 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 of the License, or
7 # (at your option) any later version.
8
9 # This program 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 this program; see the file COPYING3.  If not see
16 # <http://www.gnu.org/licenses/>.
18 ACLOCAL_AMFLAGS = -I ./config -I ../config
20 gcc_version := $(shell $(GCC_FOR_TARGET) -dumpversion)
22 libexecsubdir = $(libexecdir)/gcc/$(target_noncanonical)/$(gcc_version)
24 mkinstalldirs = $(SHELL) $(toplevel_srcdir)/mkinstalldirs
25 PWD_COMMAND = $${PWDCMD-pwd}
26 STAMP = echo timestamp >
28 libgodir = ../$(target_noncanonical)/libgo
29 LIBGODEP = $(libgodir)/libgo.la
31 if NATIVE
32 # Use the compiler we just built.
33 GOCOMPILER = $(GOC_FOR_TARGET) $(XGCC_FLAGS_FOR_TARGET)
34 else
35 GOCOMPILER = $(GOC)
36 endif
38 GOCFLAGS = $(CFLAGS_FOR_TARGET)
39 GOCOMPILE = $(GOCOMPILER) $(GOCFLAGS)
41 AM_GOCFLAGS = -I $(libgodir)
42 AM_LDFLAGS = -L $(libgodir) -L $(libgodir)/.libs
43 GOLINK = $(GOCOMPILER) $(GOCFLAGS) $(AM_GOCFLAGS) $(LDFLAGS) $(AM_LDFLAGS) -o $@
45 libgosrcdir = $(srcdir)/../libgo/go
46 cmdsrcdir = $(libgosrcdir)/cmd
48 go_cmd_go_files = \
49         $(cmdsrcdir)/go/alldocs.go \
50         $(cmdsrcdir)/go/bug.go \
51         $(cmdsrcdir)/go/build.go \
52         $(cmdsrcdir)/go/clean.go \
53         $(cmdsrcdir)/go/context.go \
54         $(cmdsrcdir)/go/discovery.go \
55         $(cmdsrcdir)/go/doc.go \
56         $(cmdsrcdir)/go/env.go \
57         $(cmdsrcdir)/go/fix.go \
58         $(cmdsrcdir)/go/fmt.go \
59         $(cmdsrcdir)/go/generate.go \
60         $(cmdsrcdir)/go/get.go \
61         $(cmdsrcdir)/go/go11.go \
62         $(cmdsrcdir)/go/help.go \
63         $(cmdsrcdir)/go/http.go \
64         $(cmdsrcdir)/go/list.go \
65         $(cmdsrcdir)/go/main.go \
66         $(cmdsrcdir)/go/note.go \
67         $(cmdsrcdir)/go/pkg.go \
68         $(cmdsrcdir)/go/run.go \
69         $(cmdsrcdir)/go/signal.go \
70         $(cmdsrcdir)/go/signal_unix.go \
71         $(cmdsrcdir)/go/test.go \
72         $(cmdsrcdir)/go/testflag.go \
73         $(cmdsrcdir)/go/tool.go \
74         $(cmdsrcdir)/go/vcs.go \
75         $(cmdsrcdir)/go/version.go \
76         $(cmdsrcdir)/go/vet.go \
77         $(libgodir)/zstdpkglist.go
79 go_cmd_gofmt_files = \
80         $(cmdsrcdir)/gofmt/doc.go \
81         $(cmdsrcdir)/gofmt/gofmt.go \
82         $(cmdsrcdir)/gofmt/internal.go \
83         $(cmdsrcdir)/gofmt/rewrite.go \
84         $(cmdsrcdir)/gofmt/simplify.go
86 go_cmd_cgo_files = \
87         $(cmdsrcdir)/cgo/ast.go \
88         $(cmdsrcdir)/cgo/doc.go \
89         $(cmdsrcdir)/cgo/gcc.go \
90         $(cmdsrcdir)/cgo/godefs.go \
91         $(cmdsrcdir)/cgo/main.go \
92         $(cmdsrcdir)/cgo/out.go \
93         $(cmdsrcdir)/cgo/util.go
95 GCCGO_INSTALL_NAME := $(shell echo gccgo|sed '$(program_transform_name)')
96 GCC_INSTALL_NAME := $(shell echo gcc|sed '$(program_transform_name)')
97 GXX_INSTALL_NAME := $(shell echo g++|sed '$(program_transform_name)')
99 zdefaultcc.go: s-zdefaultcc; @true
100 s-zdefaultcc: Makefile
101         echo 'package main' > zdefaultcc.go.tmp
102         echo 'const defaultGCCGO = "$(bindir)/$(GCCGO_INSTALL_NAME)"' >> zdefaultcc.go.tmp
103         echo 'const defaultCC = "$(bindir)/$(GCC_INSTALL_NAME)"' >> zdefaultcc.go.tmp
104         echo 'const defaultCXX = "$(bindir)/$(GXX_INSTALL_NAME)"' >> zdefaultcc.go.tmp
105         echo 'const defaultPkgConfig = "pkg-config"' >> zdefaultcc.go.tmp
106         $(SHELL) $(srcdir)/../move-if-change zdefaultcc.go.tmp zdefaultcc.go
107         $(STAMP) $@ 
109 MOSTLYCLEANFILES = zdefaultcc.go s-zdefaultcc
111 if NATIVE
113 # For a native build we build the programs using the newly built libgo
114 # and install them as regular programs.
116 bin_PROGRAMS = go$(EXEEXT) gofmt$(EXEEXT)
117 noinst_PROGRAMS = cgo$(EXEEXT)
118 man_MANS = go.1 gofmt.1
120 go$(EXEEXT): $(go_cmd_go_files) zdefaultcc.go $(LIBGODEP)
121         $(GOLINK) $(go_cmd_go_files) zdefaultcc.go $(LIBS) $(NET_LIBS)
122 gofmt$(EXEEXT): $(go_cmd_gofmt_files) $(LIBGODEP)
123         $(GOLINK) $(go_cmd_gofmt_files) $(LIBS) $(NET_LIBS)
124 cgo$(EXEEXT): $(go_cmd_cgo_files) zdefaultcc.go $(LIBGODEP)
125         $(GOLINK) $(go_cmd_cgo_files) zdefaultcc.go $(LIBS) $(NET_LIBS)
127 install-exec-local: cgo$(EXEEXT)
128         $(MKDIR_P) $(DESTDIR)$(libexecsubdir)
129         rm -f $(DESTDIR)$(libexecsubdir)/cgo$(exeext)
130         $(INSTALL_PROGRAM) cgo$(exeext) $(DESTDIR)$(libexecsubdir)/cgo$(exeext)
132 uninstall-local:
133         rm -f $(DESTDIR)$(libexecsubdir)/cgo$(exeext)
135 # Run tests using the go tool, and frob the output to look like that
136 # generated by DejaGNU.  The main output of this is two files:
137 # gotools.sum and gotools.log.
139 # check-head starts generating the log files in DejaGNU format.  This
140 # is a separate target so that the date is approximately when we start
141 # running the tests.
142 check-head:
143         @echo "Test Run By $${USER} on `date`" > gotools.head
144         @echo "Native configuration is $(host_triplet)" >> gotools.head
145         @echo >> gotools.head
146         @echo "         === gotools tests ===" >> gotools.head
147         @echo >> gotools.head
149 # check-gccgo is a little shell script that executes gccgo with the
150 # options to pick up the newly built libgo.
151 check-gccgo: Makefile
152         rm -f $@
153         echo "#!/bin/sh" > $@
154         abs_libgodir=`cd $(libgodir) && $(PWD_COMMAND)`; \
155         echo "$(GOCOMPILE)" '"$$@"' "-I $${abs_libgodir} -L $${abs_libgodir} -L $${abs_libgodir}/.libs" >> $@
156         chmod +x $@
158 # CHECK_ENV sets up the environment to run the newly built go tool.
159 CHECK_ENV = \
160         PATH=`echo $(abs_builddir):$${PATH} | sed 's,::*,:,g;s,^:*,,;s,:*$$,,'`; \
161         export PATH; \
162         GCCGO="$(abs_builddir)/check-gccgo"; \
163         export GCCGO; \
164         GCCGOTOOLDIR="$(abs_builddir)"; \
165         export GCCGOTOOLDIR; \
166         GO_TESTING_GOTOOLS=yes; \
167         export GO_TESTING_GOTOOLS; \
168         abs_libgodir=`cd $(libgodir) && $(PWD_COMMAND)`; \
169         LD_LIBRARY_PATH=`echo $${abs_libgodir}/.libs:$${LD_LIBRARY_PATH} | sed 's,::*,:,g;s,^:*,,;s,:*$$,,'`; \
170         export LD_LIBRARY_PATH;
172 # check-go-tools runs `go test cmd/go` in our environment.
173 check-go-tool: go$(EXEEXT) check-head check-gccgo
174         rm -rf check-go-dir
175         $(MKDIR_P) check-go-dir/src/cmd/go
176         cp $(cmdsrcdir)/go/*.go check-go-dir/src/cmd/go/
177         cp $(libgodir)/zstdpkglist.go check-go-dir/src/cmd/go/
178         cp zdefaultcc.go check-go-dir/src/cmd/go/
179         cp -r $(cmdsrcdir)/go/testdata check-go-dir/src/cmd/go/
180         $(CHECK_ENV) \
181         GOPATH=`cd check-go-dir && $(PWD_COMMAND)`; \
182         export GOPATH; \
183         (cd check-go-dir/src/cmd/go && $(abs_builddir)/go$(EXEEXT) test -test.short -test.v) > cmd_go-testlog 2>&1 || true
184         grep '^--- ' cmd_go-testlog | sed -e 's/^--- \(.*\) ([^)]*)$$/\1/'
186 # The check targets runs the tests and assembles the output files.
187 check: check-head check-go-tool
188         mv gotools.head gotools.sum
189         cp gotools.sum gotools.log
190         for file in cmd_go-testlog; do \
191           testname=`echo $${file} | sed -e 's/-testlog//' -e 's|_|/|'`; \
192           echo "Running $${testname}" >> gotools.sum; \
193           echo "Running $${testname}" >> gotools.log; \
194           sed -e 's/^--- \(.*\) ([^)]*)$$/\1/' < $${file} >> gotools.log; \
195           grep '^--- ' $${file} | sed -e 's/^--- \(.*\) ([^)]*)$$/\1/' -e 's/SKIP/UNTESTED/' >> gotools.sum; \
196         done
197         @echo >> gotools.sum
198         @echo "         === gotools Summary ===" >> gotools.sum
199         pass=`grep -c '^PASS' gotools.sum`; \
200         if test "$${pass}" -ne "0"; then \
201           echo "# of expected passes            $${pass}" >> gotools.sum; \
202         fi
203         fail=`grep -c '^FAIL' gotools.sum`; \
204         if test "$${fail}" -ne "0"; then \
205           echo "# of unexpected failures        $${fail}" >> gotools.sum; \
206         fi
207         untested=`grep -c '^UNTESTED' gotools.sum`; \
208         if test "$${untested}" -ne "0"; then \
209           echo "# of untested testcases         $${untested}" >> gotools.sum; \
210         fi
211         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
212         echo >> gotools.log
213         echo "runtest completed at `date`" >> gotools.log
214         if grep '^FAIL' gotools.sum >/dev/null 2>&1; then exit 1; fi
216 .PHONY: check check-head check-go-tool
218 else
220 # For a non-native build we have to build the programs using a
221 # previously built host (or build -> host) Go compiler.  We should
222 # only do this if such a compiler is available.  We also need to get
223 # the right values for GOARCH and GOOS in the default build context in
224 # the go/build package.  Figure this out later.
226 endif
228 mostlyclean-local:
229         rm -rf check-go-dir