cmd/go: check for another GCC error message
[official-gcc.git] / libgo / Makefile.am
blobd5ea8f6e9ab72d68b888e013d2b427e86dc94757
1 # Makefile.am -- Go library Makefile.
3 # Copyright 2009 The Go Authors. All rights reserved.
4 # Use of this source code is governed by a BSD-style
5 # license that can be found in the LICENSE file.
7 # Process this file with autoreconf to produce Makefile.in.
9 # Go support.
10 SUFFIXES = .c .go .gox .o .obj .lo .a
12 if LIBGO_IS_RTEMS
13 subdirs = testsuite
14 endif
16 SUBDIRS = ${subdirs}
18 gcc_version := $(shell $(GOC) -dumpversion)
20 MAINT_CHARSET = latin1
22 mkinstalldirs = $(SHELL) $(toplevel_srcdir)/mkinstalldirs
23 PWD_COMMAND = $${PWDCMD-pwd}
24 STAMP = echo timestamp >
26 toolexecdir = $(glibgo_toolexecdir)
27 toolexeclibdir = $(glibgo_toolexeclibdir)
28 toolexeclibgodir = $(nover_glibgo_toolexeclibdir)/go/$(gcc_version)/$(target_alias)
29 libexecsubdir = $(libexecdir)/gcc/$(target_alias)/$(gcc_version)
31 LIBFFI = @LIBFFI@
32 LIBFFIINCS = @LIBFFIINCS@
34 LIBATOMIC = @LIBATOMIC@
36 WARN_CFLAGS = $(WARN_FLAGS) $(WERROR)
38 # -I/-D flags to pass when compiling.
39 AM_CPPFLAGS = -I $(srcdir)/runtime $(LIBFFIINCS) $(PTHREAD_CFLAGS)
41 ACLOCAL_AMFLAGS = -I ./config -I ../config
43 AM_CFLAGS = -fexceptions -fnon-call-exceptions \
44         $(SPLIT_STACK) $(WARN_CFLAGS) \
45         $(STRINGOPS_FLAG) $(HWCAP_CFLAGS) $(OSCFLAGS) \
46         -I $(srcdir)/../libgcc -I $(srcdir)/../libbacktrace \
47         -I $(MULTIBUILDTOP)../../gcc/include
49 AM_LDFLAGS =
51 if USING_SPLIT_STACK
52 AM_LDFLAGS += -XCClinker $(SPLIT_STACK)
53 endif
55 if LIBGO_IS_AIX
56 # Using an import file for libgo avoid requiring to use the -brtl flag
57 # when builing a go program
58 AM_LDFLAGS += -Wl,-bbigtoc -Wl,-bI:$(srcdir)/libgo.imp
59 EXTRA_libgo_la_DEPENDENCIES = libgo.imp
60 endif
62 # Multilib support.
63 MAKEOVERRIDES=
65 # Work around what appears to be a GNU make  handling MAKEFLAGS
66 # values defined in terms of make variables, as is the case for CC and
67 # friends when we are called from the top level Makefile.
68 AM_MAKEFLAGS = \
69         "AR_FLAGS=$(AR_FLAGS)" \
70         "CC_FOR_BUILD=$(CC_FOR_BUILD)" \
71         "CC_FOR_TARGET=$(CC_FOR_TARGET)" \
72         "CFLAGS=$(CFLAGS)" \
73         "CXXFLAGS=$(CXXFLAGS)" \
74         "CFLAGS_FOR_BUILD=$(CFLAGS_FOR_BUILD)" \
75         "CFLAGS_FOR_TARGET=$(CFLAGS_FOR_TARGET)" \
76         "GOC_FOR_TARGET=$(GOC_FOR_TARGET)" \
77         "GOC=$(GOC)" \
78         "GOCFLAGS=$(GOCFLAGS)" \
79         "INSTALL=$(INSTALL)" \
80         "INSTALL_DATA=$(INSTALL_DATA)" \
81         "INSTALL_PROGRAM=$(INSTALL_PROGRAM)" \
82         "INSTALL_SCRIPT=$(INSTALL_SCRIPT)" \
83         "LDFLAGS=$(LDFLAGS)" \
84         "LIBCFLAGS=$(LIBCFLAGS)" \
85         "LIBCFLAGS_FOR_TARGET=$(LIBCFLAGS_FOR_TARGET)" \
86         "MAKE=$(MAKE)" \
87         "MAKEINFO=$(MAKEINFO) $(MAKEINFOFLAGS)" \
88         "PICFLAG=$(PICFLAG)" \
89         "PICFLAG_FOR_TARGET=$(PICFLAG_FOR_TARGET)" \
90         "SHELL=$(SHELL)" \
91         "RUNTESTFLAGS=$(RUNTESTFLAGS)" \
92         "exec_prefix=$(exec_prefix)" \
93         "infodir=$(infodir)" \
94         "libdir=$(libdir)" \
95         "includedir=$(includedir)" \
96         "prefix=$(prefix)" \
97         "tooldir=$(tooldir)" \
98         "gxx_include_dir=$(gxx_include_dir)" \
99         "AR=$(AR)" \
100         "AS=$(AS)" \
101         "LD=$(LD)" \
102         "RANLIB=$(RANLIB)" \
103         "NM=$(NM)" \
104         "NM_FOR_BUILD=$(NM_FOR_BUILD)" \
105         "NM_FOR_TARGET=$(NM_FOR_TARGET)" \
106         "DESTDIR=$(DESTDIR)" \
107         "WERROR=$(WERROR)"
109 # Subdir rules rely on $(FLAGS_TO_PASS)
110 FLAGS_TO_PASS = $(AM_MAKEFLAGS)
112 if GOC_IS_LLGO
113 toolexeclib_LTLIBRARIES = libgo-llgo.la
114 toolexeclib_LIBRARIES = libgobegin-llgo.a
115 else
116 toolexeclib_LTLIBRARIES = libgo.la
117 toolexeclib_LIBRARIES = libgobegin.a libgolibbegin.a
118 endif
120 noinst_LIBRARIES = libgotool.a
122 toolexeclibgo_DATA = \
123         bufio.gox \
124         bytes.gox \
125         context.gox \
126         crypto.gox \
127         encoding.gox \
128         errors.gox \
129         expvar.gox \
130         flag.gox \
131         fmt.gox \
132         hash.gox \
133         html.gox \
134         image.gox \
135         io.gox \
136         log.gox \
137         math.gox \
138         mime.gox \
139         net.gox \
140         os.gox \
141         path.gox \
142         reflect.gox \
143         regexp.gox \
144         runtime.gox \
145         sort.gox \
146         strconv.gox \
147         strings.gox \
148         sync.gox \
149         syscall.gox \
150         testing.gox \
151         time.gox \
152         unicode.gox
154 toolexeclibgoarchivedir = $(toolexeclibgodir)/archive
156 toolexeclibgoarchive_DATA = \
157         archive/tar.gox \
158         archive/zip.gox
160 toolexeclibgocompressdir = $(toolexeclibgodir)/compress
162 toolexeclibgocompress_DATA = \
163         compress/bzip2.gox \
164         compress/flate.gox \
165         compress/gzip.gox \
166         compress/lzw.gox \
167         compress/zlib.gox
169 toolexeclibgocontainerdir = $(toolexeclibgodir)/container
171 toolexeclibgocontainer_DATA = \
172         container/heap.gox \
173         container/list.gox \
174         container/ring.gox
176 toolexeclibgocryptodir = $(toolexeclibgodir)/crypto
178 toolexeclibgocrypto_DATA = \
179         crypto/aes.gox \
180         crypto/cipher.gox \
181         crypto/des.gox \
182         crypto/dsa.gox \
183         crypto/ecdsa.gox \
184         crypto/elliptic.gox \
185         crypto/hmac.gox \
186         crypto/md5.gox \
187         crypto/rand.gox \
188         crypto/rc4.gox \
189         crypto/rsa.gox \
190         crypto/sha1.gox \
191         crypto/sha256.gox \
192         crypto/sha512.gox \
193         crypto/subtle.gox \
194         crypto/tls.gox \
195         crypto/x509.gox
197 toolexeclibgocryptox509dir = $(toolexeclibgocryptodir)/x509
199 toolexeclibgocryptox509_DATA = \
200         crypto/x509/pkix.gox
202 toolexeclibgodatabasedir = $(toolexeclibgodir)/database
204 toolexeclibgodatabase_DATA = \
205         database/sql.gox
207 toolexeclibgodatabasesqldir = $(toolexeclibgodatabasedir)/sql
209 toolexeclibgodatabasesql_DATA = \
210         database/sql/driver.gox
212 toolexeclibgodebugdir = $(toolexeclibgodir)/debug
214 toolexeclibgodebug_DATA = \
215         debug/dwarf.gox \
216         debug/elf.gox \
217         debug/gosym.gox \
218         debug/macho.gox \
219         debug/pe.gox \
220         debug/plan9obj.gox \
221         debug/xcoff.gox
223 toolexeclibgoencodingdir = $(toolexeclibgodir)/encoding
225 toolexeclibgoencoding_DATA = \
226         encoding/ascii85.gox \
227         encoding/asn1.gox \
228         encoding/base32.gox \
229         encoding/base64.gox \
230         encoding/binary.gox \
231         encoding/csv.gox \
232         encoding/gob.gox \
233         encoding/hex.gox \
234         encoding/json.gox \
235         encoding/pem.gox \
236         encoding/xml.gox
238 toolexeclibgoexpdir = $(toolexeclibgodir)/exp
240 toolexeclibgoexp_DATA = \
241         exp/proxy.gox \
242         exp/terminal.gox
244 toolexeclibgogodir = $(toolexeclibgodir)/go
246 toolexeclibgogo_DATA = \
247         go/ast.gox \
248         go/build.gox \
249         go/constant.gox \
250         go/doc.gox \
251         go/format.gox \
252         go/importer.gox \
253         go/parser.gox \
254         go/printer.gox \
255         go/scanner.gox \
256         go/token.gox \
257         go/types.gox
259 toolexeclibgohashdir = $(toolexeclibgodir)/hash
261 toolexeclibgohash_DATA = \
262         hash/adler32.gox \
263         hash/crc32.gox \
264         hash/crc64.gox \
265         hash/fnv.gox
267 toolexeclibgohtmldir = $(toolexeclibgodir)/html
269 toolexeclibgohtml_DATA = \
270         html/template.gox
272 toolexeclibgoimagedir = $(toolexeclibgodir)/image
274 toolexeclibgoimage_DATA = \
275         image/color.gox \
276         image/draw.gox \
277         image/gif.gox \
278         image/jpeg.gox \
279         image/png.gox
281 toolexeclibgoimagecolordir = $(toolexeclibgoimagedir)/color
283 toolexeclibgoimagecolor_DATA = \
284         image/color/palette.gox
286 toolexeclibgoindexdir = $(toolexeclibgodir)/index
288 toolexeclibgoindex_DATA = \
289         index/suffixarray.gox
291 toolexeclibgoiodir = $(toolexeclibgodir)/io
293 toolexeclibgoio_DATA = \
294         io/ioutil.gox
296 toolexeclibgologdir = $(toolexeclibgodir)/log
298 toolexeclibgolog_DATA = \
299         log/syslog.gox
301 toolexeclibgomathdir = $(toolexeclibgodir)/math
303 toolexeclibgomath_DATA = \
304         math/big.gox \
305         math/bits.gox \
306         math/cmplx.gox \
307         math/rand.gox
309 toolexeclibgomimedir = $(toolexeclibgodir)/mime
311 toolexeclibgomime_DATA = \
312         mime/multipart.gox \
313         mime/quotedprintable.gox
315 toolexeclibgonetdir = $(toolexeclibgodir)/net
317 toolexeclibgonet_DATA = \
318         net/http.gox \
319         net/mail.gox \
320         net/rpc.gox \
321         net/smtp.gox \
322         net/textproto.gox \
323         net/url.gox
325 toolexeclibgonethttpdir = $(toolexeclibgonetdir)/http
327 toolexeclibgonethttp_DATA = \
328         net/http/cgi.gox \
329         net/http/cookiejar.gox \
330         net/http/fcgi.gox \
331         net/http/httptest.gox \
332         net/http/httptrace.gox \
333         net/http/httputil.gox \
334         net/http/pprof.gox
336 toolexeclibgonetrpcdir = $(toolexeclibgonetdir)/rpc
338 toolexeclibgonetrpc_DATA = \
339         net/rpc/jsonrpc.gox
341 toolexeclibgoosdir = $(toolexeclibgodir)/os
343 toolexeclibgoos_DATA = \
344         os/exec.gox \
345         os/signal.gox \
346         os/user.gox
348 toolexeclibgopathdir = $(toolexeclibgodir)/path
350 toolexeclibgopath_DATA = \
351         path/filepath.gox
353 toolexeclibgoregexpdir = $(toolexeclibgodir)/regexp
355 toolexeclibgoregexp_DATA = \
356         regexp/syntax.gox
358 toolexeclibgoruntimedir = $(toolexeclibgodir)/runtime
360 toolexeclibgoruntime_DATA = \
361         runtime/debug.gox \
362         runtime/pprof.gox \
363         runtime/trace.gox
365 toolexeclibgosyncdir = $(toolexeclibgodir)/sync
367 toolexeclibgosync_DATA = \
368         sync/atomic.gox
370 toolexeclibgotestingdir = $(toolexeclibgodir)/testing
372 toolexeclibgotesting_DATA = \
373         testing/iotest.gox \
374         testing/quick.gox
376 toolexeclibgotestinginternaldir = $(toolexeclibgotestingdir)/internal
378 toolexeclibgotestinginternal_DATA = \
379         testing/internal/testdeps.gox
381 toolexeclibgotextdir = $(toolexeclibgodir)/text
383 toolexeclibgotext_DATA = \
384         text/scanner.gox \
385         text/tabwriter.gox \
386         text/template.gox
388 toolexeclibgotexttemplatedir = $(toolexeclibgotextdir)/template
390 toolexeclibgotexttemplate_DATA = \
391         text/template/parse.gox
393 toolexeclibgounicodedir = $(toolexeclibgodir)/unicode
395 toolexeclibgounicode_DATA = \
396         unicode/utf16.gox \
397         unicode/utf8.gox
399 # Some packages are only needed for tests, so unlike the other
400 # internal packages nothing will explicitly depend on them.
401 # Force them to be built.
402 noinst_DATA = \
403         golang_org/x/net/internal/nettest.gox \
404         golang_org/x/net/nettest.gox \
405         internal/testenv.gox \
406         net/internal/socktest.gox \
407         os/signal/internal/pty.gox
409 if LIBGO_IS_RTEMS
410 rtems_task_variable_add_file = runtime/rtems-task-variable-add.c
411 else
412 rtems_task_variable_add_file =
413 endif
415 if LIBGO_IS_LINUX
416 runtime_getncpu_file = runtime/getncpu-linux.c
417 else
418 if LIBGO_IS_DARWIN
419 runtime_getncpu_file = runtime/getncpu-bsd.c
420 else
421 if LIBGO_IS_IRIX
422 runtime_getncpu_file = runtime/getncpu-irix.c
423 else
424 if LIBGO_IS_SOLARIS
425 runtime_getncpu_file = runtime/getncpu-solaris.c
426 else
427 if LIBGO_IS_FREEBSD
428 runtime_getncpu_file = runtime/getncpu-bsd.c
429 else
430 if LIBGO_IS_NETBSD
431 runtime_getncpu_file = runtime/getncpu-bsd.c
432 else
433 if LIBGO_IS_AIX
434 runtime_getncpu_file = runtime/getncpu-aix.c
435 else
436 runtime_getncpu_file = runtime/getncpu-none.c
437 endif
438 endif
439 endif
440 endif
441 endif
442 endif
443 endif
445 runtime_files = \
446         runtime/aeshash.c \
447         runtime/go-assert.c \
448         runtime/go-caller.c \
449         runtime/go-callers.c \
450         runtime/go-cdiv.c \
451         runtime/go-cgo.c \
452         runtime/go-construct-map.c \
453         runtime/go-ffi.c \
454         runtime/go-fieldtrack.c \
455         runtime/go-matherr.c \
456         runtime/go-memclr.c \
457         runtime/go-memcmp.c \
458         runtime/go-memequal.c \
459         runtime/go-memmove.c \
460         runtime/go-nanotime.c \
461         runtime/go-now.c \
462         runtime/go-nosys.c \
463         runtime/go-reflect-call.c \
464         runtime/go-runtime-error.c \
465         runtime/go-setenv.c \
466         runtime/go-signal.c \
467         runtime/go-strslice.c \
468         runtime/go-typedesc-equal.c \
469         runtime/go-unsafe-pointer.c \
470         runtime/go-unsetenv.c \
471         runtime/go-unwind.c \
472         runtime/go-varargs.c \
473         runtime/env_posix.c \
474         runtime/panic.c \
475         runtime/print.c \
476         runtime/proc.c \
477         runtime/runtime_c.c \
478         runtime/stack.c \
479         runtime/thread.c \
480         runtime/yield.c \
481         $(rtems_task_variable_add_file) \
482         $(runtime_getncpu_file)
484 version.go: s-version; @true
485 s-version: Makefile
486         rm -f version.go.tmp
487         echo "package sys" > version.go.tmp
488         echo 'const DefaultGoroot = "$(prefix)"' >> version.go.tmp
489         echo 'const TheVersion = "'`cat $(srcdir)/VERSION | sed 1q`' '`$(GOC) --version | sed 1q`'"' >> version.go.tmp
490         echo 'const Goexperiment = ``' >> version.go.tmp
491         echo 'const GOARCH = "'$(GOARCH)'"' >> version.go.tmp
492         echo 'const GOOS = "'$(GOOS)'"' >> version.go.tmp
493         echo 'const GccgoToolDir = "$(libexecsubdir)"' >> version.go.tmp
494         echo >> version.go.tmp
495         echo "type ArchFamilyType int" >> version.go.tmp
496         echo >> version.go.tmp
497         echo "const (" >> version.go.tmp
498         echo "  UNKNOWN ArchFamilyType = iota" >> version.go.tmp
499         for a in $(ALLGOARCHFAMILY); do \
500           echo "        $${a}" >> version.go.tmp; \
501         done
502         echo ")" >> version.go.tmp
503         echo >> version.go.tmp
504         for a in $(ALLGOARCH); do \
505           f=`echo $${a} | sed -e 's/\(.\).*/\1/' -e 'y/abcdefghijklmnopqrstuvwxyz/ABCDEFGHIJKLMNOPQRSTUVWXYZ/'`; \
506           n="$${f}`echo $${a} | sed -e 's/.//'`"; \
507           if test "$${a}" = "$(GOARCH)"; then \
508             echo "const Goarch$${n} = 1" >> version.go.tmp; \
509           else \
510             echo "const Goarch$${n} = 0" >> version.go.tmp; \
511           fi; \
512         done
513         echo >> version.go.tmp
514         echo "const (" >> version.go.tmp
515         echo "  ArchFamily = $(GOARCH_FAMILY)" >> version.go.tmp
516         echo "  BigEndian = $(GOARCH_BIGENDIAN)" >> version.go.tmp
517         echo "  CacheLineSize = $(GOARCH_CACHELINESIZE)" >> version.go.tmp
518         echo "  PhysPageSize = $(GOARCH_PHYSPAGESIZE)" >> version.go.tmp
519         echo "  PCQuantum = $(GOARCH_PCQUANTUM)" >> version.go.tmp
520         echo "  Int64Align = $(GOARCH_INT64ALIGN)" >> version.go.tmp
521         echo "  HugePageSize = $(GOARCH_HUGEPAGESIZE)" >> version.go.tmp
522         echo "  MinFrameSize = $(GOARCH_MINFRAMESIZE)" >> version.go.tmp
523         echo ")" >> version.go.tmp
524         echo >> version.go.tmp
525         for a in $(ALLGOOS); do \
526           f=`echo $${a} | sed -e 's/\(.\).*/\1/' -e 'y/abcdefghijklmnopqrstuvwxyz/ABCDEFGHIJKLMNOPQRSTUVWXYZ/'`; \
527           n="$${f}`echo $${a} | sed -e 's/.//'`"; \
528           if test "$${a}" = "$(GOOS)"; then \
529             echo "const Goos$${n} = 1" >> version.go.tmp; \
530           else \
531             echo "const Goos$${n} = 0" >> version.go.tmp; \
532           fi; \
533         done
534         echo >> version.go.tmp
535         echo "type Uintreg uintptr" >> version.go.tmp
536         $(SHELL) $(srcdir)/mvifdiff.sh version.go.tmp version.go
537         $(STAMP) $@
539 objabi.go: s-objabi; @true
540 s-objabi: Makefile
541         rm -f objabi.go.tmp
542         echo "package objabi" > objabi.go.tmp
543         echo "import \"runtime\"" >> objabi.go.tmp
544         echo 'const defaultGOROOT = `$(prefix)`' >> objabi.go.tmp
545         echo 'const defaultGO386 = `sse2`' >> objabi.go.tmp
546         echo 'const defaultGOARM = `5`' >> objabi.go.tmp
547         echo 'const defaultGOMIPS = `hardfloat`' >> objabi.go.tmp
548         echo 'const defaultGOOS = runtime.GOOS' >> objabi.go.tmp
549         echo 'const defaultGOARCH = runtime.GOARCH' >> objabi.go.tmp
550         echo 'const defaultGO_EXTLINK_ENABLED = ``' >> objabi.go.tmp
551         echo 'const version = `'`cat $(srcdir)/VERSION | sed 1q`' '`$(GOC) --version | sed 1q`'`' >> objabi.go.tmp
552         echo 'const stackGuardMultiplier = 1' >> objabi.go.tmp
553         echo 'const goexperiment = ``' >> objabi.go.tmp
554         $(SHELL) $(srcdir)/mvifdiff.sh objabi.go.tmp objabi.go
555         $(STAMP) $@
557 runtime_sysinfo.go: s-runtime_sysinfo; @true
558 s-runtime_sysinfo: $(srcdir)/mkrsysinfo.sh gen-sysinfo.go
559         GOARCH=$(GOARCH) GOOS=$(GOOS) $(SHELL) $(srcdir)/mkrsysinfo.sh
560         $(SHELL) $(srcdir)/mvifdiff.sh tmp-runtime_sysinfo.go runtime_sysinfo.go
561         $(STAMP) $@
563 sigtab.go: s-sigtab; @true
564 s-sigtab: $(srcdir)/mksigtab.sh gen-sysinfo.go
565         GOOS=$(GOOS) $(SHELL) $(srcdir)/mksigtab.sh > tmp-sigtab.go
566         $(SHELL) $(srcdir)/mvifdiff.sh tmp-sigtab.go sigtab.go
567         $(STAMP) $@
569 GCCGO_INSTALL_NAME := $(shell echo gccgo|sed '$(program_transform_name)')
570 GCC_INSTALL_NAME := $(shell echo gcc|sed '$(program_transform_name)')
571 GXX_INSTALL_NAME := $(shell echo g++|sed '$(program_transform_name)')
573 zdefaultcc.go: s-zdefaultcc; @true
574 s-zdefaultcc: Makefile
575         echo 'package cfg' > zdefaultcc.go.tmp
576         echo >> zdefaultcc.go.tmp
577         echo 'func DefaultGCCGO(goos, goarch string) string { return "$(bindir)/$(GCCGO_INSTALL_NAME)" }' >> zdefaultcc.go.tmp
578         echo 'func DefaultCC(goos, goarch string) string { return "$(GCC_INSTALL_NAME)" }' >> zdefaultcc.go.tmp
579         echo 'func DefaultCXX(goos, goarch string) string { return "$(GXX_INSTALL_NAME)" }' >> zdefaultcc.go.tmp
580         echo 'const DefaultPkgConfig = "pkg-config"' >> zdefaultcc.go.tmp
581         echo 'var OSArchSupportsCgo = map[string]bool{}' >> zdefaultcc.go.tmp
582         $(SHELL) $(srcdir)/../move-if-change zdefaultcc.go.tmp zdefaultcc.go
583         $(STAMP) $@ 
585 # _Complex_lock and _Reader_lock are Go translations of some AIX system
586 # types and should not be exported back to C
587 # semt is a Go translation of the C type sem_t; it fails to convert on
588 # some systems and need not be exported back to C.
589 # sigset conflicts with system type sigset on AIX, so we need to rename it
590 runtime.inc: s-runtime-inc; @true
591 s-runtime-inc: runtime.lo Makefile
592         rm -f runtime.inc.tmp2 runtime.inc.tmp3
593         grep -v "#define _" runtime.inc.tmp | grep -v "#define [cm][01234] " | grep -v "#define empty " > runtime.inc.tmp2
594         for pattern in '_[GP][a-z]' _Max _Lock _Sig _Trace _MHeap _Num; do \
595           grep "#define $$pattern" runtime.inc.tmp >> runtime.inc.tmp2; \
596         done
597         for TYPE in _Complex_lock _Reader_lock semt; do \
598           sed -e '/struct '$${TYPE}' {/,/^}/s/^.*$$//' runtime.inc.tmp2 > runtime.inc.tmp3; \
599           mv runtime.inc.tmp3 runtime.inc.tmp2; \
600         done
601         sed -e 's/sigset/sigset_go/' runtime.inc.tmp2 > runtime.inc.tmp3
602         $(SHELL) $(srcdir)/mvifdiff.sh runtime.inc.tmp3 runtime.inc
603         rm -f runtime.inc.tmp2 runtime.inc.tmp3
604         $(STAMP) $@
606 noinst_DATA += zstdpkglist.go zdefaultcc.go
608 # Generate the list of go std packages that were included in libgo
609 zstdpkglist.go: s-zstdpkglist; @true
610 s-zstdpkglist: Makefile
611         rm -f zstdpkglist.go.tmp
612         echo 'package load' > zstdpkglist.go.tmp
613         echo "" >> zstdpkglist.go.tmp
614         echo 'var stdpkg = map[string]bool{' >> zstdpkglist.go.tmp
615         echo $(libgo_go_objs) 'unsafe.lo' 'runtime/cgo.lo' | sed 's|[a-z0-9_/]*_c\.lo||g' | sed 's|\([a-z0-9_/]*\)\.lo|"\1": true,|g' >> zstdpkglist.go.tmp
616         echo '}' >> zstdpkglist.go.tmp
617         $(SHELL) $(srcdir)/mvifdiff.sh zstdpkglist.go.tmp zstdpkglist.go
618         $(STAMP) $@
620 if LIBGO_IS_LINUX
621 syscall_epoll_file = epoll.go
622 else
623 syscall_epoll_file =
624 endif
626 libcalls.go: s-libcalls; @true
627 s-libcalls: libcalls-list go/syscall/mksyscall.awk $(srcdir)/go/syscall/*.go
628         rm -f libcalls.go.tmp
629         $(AWK) -f $(srcdir)/go/syscall/mksyscall.awk `cat libcalls-list` > libcalls.go.tmp
630         $(SHELL) $(srcdir)/mvifdiff.sh libcalls.go.tmp libcalls.go
631         $(STAMP) $@
633 libcalls-list: s-libcalls-list; @true
634 s-libcalls-list: Makefile $(srcdir)/go/syscall/*.go
635         rm -f libcalls-list.tmp
636         $(SHELL) $(srcdir)/match.sh --goarch=$(GOARCH) --goos=$(GOOS) --srcdir=$(srcdir)/go/syscall $(matchargs_syscall) > libcalls-list.tmp
637         $(SHELL) $(srcdir)/mvifdiff.sh libcalls-list.tmp libcalls-list
638         $(STAMP) $@
640 syscall_arch.go: s-syscall_arch; @true
641 s-syscall_arch: Makefile
642         rm -f syscall_arch.go.tmp
643         echo "package syscall" > syscall_arch.go.tmp
644         echo 'const ARCH = "'$(GOARCH)'"' >> syscall_arch.go.tmp
645         echo 'const OS = "'$(GOOS)'"' >> syscall_arch.go.tmp
646         $(SHELL) $(srcdir)/mvifdiff.sh syscall_arch.go.tmp syscall_arch.go
647         $(STAMP) $@
649 SYSINFO_FLAGS = \
650         $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \
651         $(CPPFLAGS) $(OSCFLAGS) -O
653 gen-sysinfo.go: s-gen-sysinfo; @true
654 s-gen-sysinfo: $(srcdir)/sysinfo.c config.h
655         $(CC) $(SYSINFO_FLAGS) -fdump-go-spec=tmp-gen-sysinfo.go -std=gnu99 -S -o sysinfo.s $(srcdir)/sysinfo.c
656         rm -f sysinfo.s
657         $(SHELL) $(srcdir)/mvifdiff.sh tmp-gen-sysinfo.go gen-sysinfo.go
658         $(STAMP) $@
660 errno.i: s-errno; @true
661 s-errno:
662         echo '#include <errno.h>' | $(CC) $(SYSINFO_FLAGS) -x c - -E -dM > tmp-errno.i
663         $(SHELL) $(srcdir)/mvifdiff.sh tmp-errno.i errno.i
664         $(STAMP) $@
666 sysinfo.go: s-sysinfo; @true
667 s-sysinfo: $(srcdir)/mksysinfo.sh gen-sysinfo.go errno.i
668         GOOS=$(GOOS) $(SHELL) $(srcdir)/mksysinfo.sh
669         $(SHELL) $(srcdir)/mvifdiff.sh tmp-sysinfo.go sysinfo.go
670         $(STAMP) $@
672 # The epoll struct has an embedded union and is packed on x86_64,
673 # which is too complicated for mksysinfo.sh.  We find the offset of
674 # the only field we care about in configure.ac, and generate the
675 # struct here.
676 epoll.go: s-epoll; @true
677 s-epoll: Makefile
678         rm -f epoll.go.tmp
679         echo 'package syscall' > epoll.go.tmp
680         echo 'type EpollEvent struct {' >> epoll.go.tmp
681         echo '  Events uint32' >> epoll.go.tmp
682         case "$(SIZEOF_STRUCT_EPOLL_EVENT),$(STRUCT_EPOLL_EVENT_FD_OFFSET)" in \
683         0,0) echo 1>&2 "*** struct epoll_event data.fd offset unknown"; \
684            exit 1; ;; \
685         8,4) echo '     Fd int32' >> epoll.go.tmp; ;; \
686         12,4) echo '    Fd int32' >> epoll.go.tmp; \
687            echo '       Pad [4]byte' >> epoll.go.tmp; ;; \
688         12,8) echo '    Pad [4]byte' >> epoll.go.tmp; \
689            echo '       Fd int32' >> epoll.go.tmp; ;; \
690         16,8) echo '    Pad [4]byte' >> epoll.go.tmp; \
691            echo '       Fd int32' >> epoll.go.tmp; \
692            echo '       Pad2 [4]byte' >> epoll.go.tmp; ;; \
693         *) echo 1>&2 "*** struct epoll_event unsupported"; \
694            exit 1; ;; \
695         esac
696         echo '}' >> epoll.go.tmp
697         $(SHELL) $(srcdir)/mvifdiff.sh epoll.go.tmp epoll.go
698         $(STAMP) $@
700 if LIBGO_IS_LINUX
701 syscall_lib_clone_lo = syscall/clone_linux.lo
702 else
703 syscall_lib_clone_lo =
704 endif
706 PACKAGES = \
707         archive/tar \
708         archive/zip \
709         bufio \
710         bytes \
711         compress/bzip2 \
712         compress/flate \
713         compress/gzip \
714         compress/lzw \
715         compress/zlib \
716         container/heap \
717         container/list \
718         container/ring \
719         context \
720         crypto \
721         crypto/aes \
722         crypto/cipher \
723         crypto/des \
724         crypto/dsa \
725         crypto/ecdsa \
726         crypto/elliptic \
727         crypto/hmac \
728         crypto/internal/cipherhw \
729         crypto/md5 \
730         crypto/rand \
731         crypto/rc4 \
732         crypto/rsa \
733         crypto/sha1 \
734         crypto/sha256 \
735         crypto/sha512 \
736         crypto/subtle \
737         crypto/tls \
738         crypto/x509 \
739         crypto/x509/pkix \
740         database/sql \
741         database/sql/driver \
742         debug/dwarf \
743         debug/elf \
744         debug/gosym \
745         debug/macho \
746         debug/pe \
747         debug/plan9obj \
748         debug/xcoff \
749         encoding \
750         encoding/ascii85 \
751         encoding/asn1 \
752         encoding/base32 \
753         encoding/base64 \
754         encoding/binary \
755         encoding/csv \
756         encoding/gob \
757         encoding/hex \
758         encoding/json \
759         encoding/pem \
760         encoding/xml \
761         errors \
762         exp/proxy \
763         exp/terminal \
764         expvar \
765         flag \
766         fmt \
767         go/ast \
768         go/build \
769         go/constant \
770         go/doc \
771         go/format \
772         go/importer \
773         go/internal/gccgoimporter \
774         go/internal/gcimporter \
775         go/internal/srcimporter \
776         go/parser \
777         go/printer \
778         go/scanner \
779         go/token \
780         go/types \
781         golang_org/x/crypto/chacha20poly1305 \
782         golang_org/x/crypto/chacha20poly1305/internal/chacha20 \
783         golang_org/x/crypto/cryptobyte \
784         golang_org/x/crypto/cryptobyte/asn1 \
785         golang_org/x/crypto/curve25519 \
786         golang_org/x/crypto/poly1305 \
787         golang_org/x/net/http2/hpack \
788         golang_org/x/net/idna \
789         golang_org/x/net/internal/nettest \
790         golang_org/x/net/lex/httplex \
791         golang_org/x/net/nettest \
792         golang_org/x/net/proxy \
793         golang_org/x/text/secure/bidirule \
794         golang_org/x/text/transform \
795         golang_org/x/text/unicode/bidi \
796         golang_org/x/text/unicode/norm \
797         golang_org/x/text/width \
798         hash \
799         hash/adler32 \
800         hash/crc32 \
801         hash/crc64 \
802         hash/fnv \
803         html \
804         html/template \
805         image \
806         image/color \
807         image/color/palette \
808         image/draw \
809         image/gif \
810         image/internal/imageutil \
811         image/jpeg \
812         image/png \
813         index/suffixarray \
814         internal/nettrace \
815         internal/poll \
816         internal/race \
817         internal/singleflight \
818         internal/syscall/unix \
819         internal/testenv \
820         internal/trace \
821         io \
822         io/ioutil \
823         log \
824         log/syslog \
825         math \
826         math/big \
827         math/bits \
828         math/cmplx \
829         math/rand \
830         mime \
831         mime/multipart \
832         mime/quotedprintable \
833         net \
834         net/http \
835         net/http/cgi \
836         net/http/cookiejar \
837         net/http/fcgi \
838         net/http/httptest \
839         net/http/httptrace \
840         net/http/httputil \
841         net/http/internal \
842         net/http/pprof \
843         net/internal/socktest \
844         net/mail \
845         net/rpc \
846         net/rpc/jsonrpc \
847         net/smtp \
848         net/textproto \
849         net/url \
850         os \
851         os/exec \
852         os/signal \
853         os/signal/internal/pty \
854         os/user \
855         path \
856         path/filepath \
857         reflect \
858         regexp \
859         regexp/syntax \
860         runtime \
861         runtime/debug \
862         runtime/internal/atomic \
863         runtime/internal/sys \
864         runtime/pprof \
865         runtime/pprof/internal/profile \
866         runtime/trace \
867         sort \
868         strconv \
869         strings \
870         sync \
871         sync/atomic \
872         syscall \
873         testing \
874         testing/internal/testdeps \
875         testing/iotest \
876         testing/quick \
877         text/scanner \
878         text/tabwriter \
879         text/template \
880         text/template/parse \
881         time \
882         unicode \
883         unicode/utf16 \
884         unicode/utf8
886 libgo_go_objs = \
887         $(addsuffix .lo,$(PACKAGES)) \
888         bytes/index.lo \
889         reflect/makefunc_ffi_c.lo \
890         strings/index.lo \
891         $(syscall_lib_clone_lo) \
892         syscall/errno.lo \
893         syscall/signame.lo \
894         syscall/wait.lo \
895         $(golang_org_x_net_lif_lo) \
896         $(golang_org_x_net_route_lo) \
897         log/syslog/syslog_c.lo \
898         $(os_lib_inotify_lo) \
899         runtime/internal/atomic_c.lo \
900         sync/atomic_c.lo
902 libgo_ldflags = \
903         -version-info $(libtool_VERSION) $(PTHREAD_CFLAGS) $(AM_LDFLAGS)
905 libgo_libadd = \
906         $(libgo_go_objs) ../libbacktrace/libbacktrace.la \
907         $(LIBATOMIC) $(LIBFFI) $(PTHREAD_LIBS) $(MATH_LIBS) $(NET_LIBS)
909 libgo_la_SOURCES = $(runtime_files)
910 libgo_la_LDFLAGS = $(libgo_ldflags)
911 libgo_la_LIBADD = $(libgo_libadd)
913 libgo_llgo_la_SOURCES = $(runtime_files)
914 libgo_llgo_la_LDFLAGS = $(libgo_ldflags)
915 libgo_llgo_la_LIBADD = $(libgo_libadd)
917 libgobegin_a_SOURCES = \
918         runtime/go-main.c
920 libgobegin_llgo_a_SOURCES = \
921         runtime/go-main.c
923 # Use -fPIC for libgobegin so that it can be put in a PIE.
924 libgobegin_a_CFLAGS = $(AM_CFLAGS) -fPIC
925 libgobegin_llgo_a_CFLAGS = $(AM_CFLAGS) -fPIC
927 libgolibbegin_a_SOURCES = \
928         runtime/go-libmain.c
930 libgolibbegin_a_CFLAGS = $(AM_CFLAGS) -fPIC
932 GOTOOL_PACKAGES = \
933         cmd/go/internal/base \
934         cmd/go/internal/bug \
935         cmd/go/internal/cache \
936         cmd/go/internal/cfg \
937         cmd/go/internal/clean \
938         cmd/go/internal/cmdflag \
939         cmd/go/internal/doc \
940         cmd/go/internal/envcmd \
941         cmd/go/internal/fix \
942         cmd/go/internal/fmtcmd \
943         cmd/go/internal/generate \
944         cmd/go/internal/get \
945         cmd/go/internal/help \
946         cmd/go/internal/list \
947         cmd/go/internal/load \
948         cmd/go/internal/run \
949         cmd/go/internal/str \
950         cmd/go/internal/test \
951         cmd/go/internal/tool \
952         cmd/go/internal/version \
953         cmd/go/internal/vet \
954         cmd/go/internal/web \
955         cmd/go/internal/work \
956         cmd/internal/browser \
957         cmd/internal/buildid \
958         cmd/internal/edit \
959         cmd/internal/objabi \
960         cmd/internal/test2json \
961         cmd/vet/internal/cfg \
962         cmd/vet/internal/whitelist
964 libgotool_a_SOURCES =
965 libgotool_a_DEPENDENCIES = $(addsuffix .lo,$(GOTOOL_PACKAGES))
966 libgotool_a_LIBADD = $(addsuffix .o,$(GOTOOL_PACKAGES))
968 define STATIC_template
969 $(subst -,_,$(subst .,_,$(subst /,_,$(1))))_GOCFLAGS = -static
970 endef
972 $(foreach package,$(GOTOOL_PACKAGES),$(eval $(call STATIC_template,$(package).lo)))
974 # Make sure runtime.inc is built before compiling any .c file.
975 $(libgo_la_OBJECTS): runtime.inc
976 $(libgo_llgo_la_OBJECTS): runtime.inc
977 $(libgobegin_a_OBJECTS): runtime.inc
978 $(libgobegin_llgo_a_OBJECTS): runtime.inc
979 $(libgolibbegin_a_OBJECTS): runtime.inc
981 LTLDFLAGS = $(shell $(SHELL) $(top_srcdir)/../libtool-ldflags $(LDFLAGS))
983 GOCFLAGS = $(CFLAGS)
984 AM_GOCFLAGS = $(STRINGOPS_FLAG) $(GO_SPLIT_STACK)
985 GOCOMPILE = $(GOC) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_GOCFLAGS) $(GOCFLAGS)
987 LTGOCOMPILE = $(LIBTOOL) --tag GO --mode=compile $(GOC) $(INCLUDES) \
988         $(AM_GOCFLAGS) $(GOCFLAGS)
990 GOLINK = $(LIBTOOL) --tag GO --mode-link $(GOC) \
991         $(OPT_LDFLAGS) $(SECTION_LDFLAGS) $(AM_GOCFLAGS) $(LTLDFLAGS) -o $@
993 # Build the dependencies for a Go package.
994 BUILDDEPS = \
995         $(MKDIR_P) $(@D); \
996         dir=`echo $@ | sed -e 's/.lo.dep$$//'`; \
997         files=`$(SHELL) $(srcdir)/match.sh --goarch=$(GOARCH) --goos=$(GOOS) --srcdir=$(srcdir)/go/$$dir --extrafiles="$(extra_go_files_$(subst /,_,$(subst .lo.dep,,$@)))" $(matchargs_$(subst /,_,$(subst .lo.dep,,$@)))`; \
998         $(SHELL) $(srcdir)/godeps.sh `echo $@ | sed -e 's/.dep$$//'` $$files > $@.tmp; \
999         if ! cmp $@.tmp $@ >/dev/null 2>/dev/null; then \
1000           rm -f `echo $@ | sed -e 's/\.dep$$//'`; \
1001         fi; \
1002         mv -f $@.tmp $@
1004 # Build the .go files for a package, generating a .lo file.
1005 BUILDPACKAGE = \
1006         $(MKDIR_P) $(@D); \
1007         files=`echo $^ | sed -e 's/[^ ]*\.gox//g' -e 's/[^ ]*\.dep//'`; \
1008         $(LTGOCOMPILE) -I . -c -fgo-pkgpath=`echo $@ | sed -e 's/.lo$$//' -e 's|golang_org|vendor/golang_org|'` $($(subst -,_,$(subst .,_,$(subst /,_,$@)))_GOCFLAGS) -o $@ $$files
1010 # How to build a .gox file from a .lo file.
1011 # Matching .o file can either be in the same directory as the .lo (non-PIC
1012 # object) or in the .libs directory (PIC object).
1013 BUILDGOX = \
1014         f="$(basename $<).o"; \
1015         if test ! -f $$f; then \
1016           f="$(basename $(<D)/.libs/$(<F)).o"; \
1017         fi; \
1018         $(OBJCOPY) -j .go_export $$f $@.tmp; \
1019         $(SHELL) $(srcdir)/mvifdiff.sh $@.tmp `echo $@ | sed -e 's/s-gox/gox/'`
1021 GOTESTFLAGS =
1022 GOBENCH = 
1024 # Check a package.
1025 CHECK = \
1026         GC="$(GOC) $(GOCFLAGS) $($(subst /,_,$@)_GOCFLAGS) -L `${PWD_COMMAND}` -L `${PWD_COMMAND}`/.libs"; \
1027         export GC; \
1028         GOLIBS="$(extra_check_libs_$(subst /,_,$(@D))) $(MATH_LIBS) $(NET_LIBS) $(LIBS)"; \
1029         export GOLIBS; \
1030         RUNTESTFLAGS="$(RUNTESTFLAGS)"; \
1031         export RUNTESTFLAGS; \
1032         MAKE="$(MAKE)"; \
1033         export MAKE; \
1034         NM="$(NM)"; \
1035         export NM; \
1036         libgccdir=`${GOC} ${GOCFLAGS} -print-libgcc-file-name | sed -e 's|/[^/]*$$||'`; \
1037         LD_LIBRARY_PATH="`${PWD_COMMAND}`/.libs:$${libgccdir}:${LD_LIBRARY_PATH}"; \
1038         LD_LIBRARY_PATH=`echo $${LD_LIBRARY_PATH} | sed 's,::*,:,g;s,^:*,,;s,:*$$,,'`; \
1039         export LD_LIBRARY_PATH; \
1040         $(MKDIR_P) $(@D); \
1041         rm -f $@-testsum $@-testlog; \
1042         files=`$(SHELL) $(srcdir)/match.sh --goarch=$(GOARCH) --goos=$(GOOS) --srcdir=$(srcdir)/go/$(@D) --extrafiles="$(extra_go_files_$(subst /,_,$(@D)))" $(matchargs_$(subst /,_,$(@D)))`; \
1043         if test "$(USE_DEJAGNU)" = "yes"; then \
1044           $(SHELL) $(srcdir)/testsuite/gotest --goarch=$(GOARCH) --goos=$(GOOS) --dejagnu=yes --basedir=$(srcdir) --srcdir=$(srcdir)/go/$(@D) --pkgpath="$(@D)" --pkgfiles="$$files" --testname="$(@D)" $(GOTESTFLAGS); \
1045         elif test "$(GOBENCH)" != ""; then \
1046           $(SHELL) $(srcdir)/testsuite/gotest --goarch=$(GOARCH) --goos=$(GOOS) --basedir=$(srcdir) --srcdir=$(srcdir)/go/$(@D) --pkgpath="$(@D)" --pkgfiles="$$files" --bench="$(GOBENCH)" $(GOTESTFLAGS); \
1047         else \
1048           if $(SHELL) $(srcdir)/testsuite/gotest --goarch=$(GOARCH) --goos=$(GOOS) --basedir=$(srcdir) --srcdir=$(srcdir)/go/$(@D) --pkgpath="$(@D)" --pkgfiles="$$files" $(GOTESTFLAGS) >>$@-testlog 2>&1; then \
1049             echo "PASS: $(@D)" >> $@-testlog; \
1050             echo "PASS: $(@D)"; \
1051             echo "PASS: $(@D)" > $@-testsum; \
1052           else \
1053             echo "FAIL: $(@D)" >> $@-testlog; \
1054             cat $@-testlog; \
1055             echo "FAIL: $(@D)" > $@-testsum; \
1056             exit 1; \
1057           fi; \
1058         fi
1060 # Build all packages before checking any.
1061 CHECK_DEPS = \
1062         $(toolexeclibgo_DATA) \
1063         $(toolexeclibgoarchive_DATA) \
1064         $(toolexeclibgocompress_DATA) \
1065         $(toolexeclibgocontainer_DATA) \
1066         $(toolexeclibgocrypto_DATA) \
1067         $(toolexeclibgodebug_DATA) \
1068         $(toolexeclibgoencoding_DATA) \
1069         $(toolexeclibgoexp_DATA) \
1070         $(toolexeclibgogo_DATA) \
1071         $(toolexeclibgohash_DATA) \
1072         $(toolexeclibgoimage_DATA) \
1073         $(toolexeclibgoindex_DATA) \
1074         $(toolexeclibgoio_DATA) \
1075         $(toolexeclibgolog_DATA) \
1076         $(toolexeclibgomath_DATA) \
1077         $(toolexeclibgomime_DATA) \
1078         $(toolexeclibgonet_DATA) \
1079         $(toolexeclibgonethttp_DATA) \
1080         $(toolexeclibgoos_DATA) \
1081         $(toolexeclibgopath_DATA) \
1082         $(toolexeclibgorpc_DATA) \
1083         $(toolexeclibgoruntime_DATA) \
1084         $(toolexeclibgosync_DATA) \
1085         $(toolexeclibgotesting_DATA) \
1086         $(toolexeclibgotext_DATA) \
1087         $(toolexeclibgotexttemplate_DATA) \
1088         $(toolexeclibgounicode_DATA) \
1089         $(noinst_LIBRARIES)
1091 if GOC_IS_LLGO
1092 CHECK_DEPS += libgo-llgo.la libgobegin-llgo.a
1093 else
1094 CHECK_DEPS += libgo.la libgobegin.a
1095 endif
1097 # PACKAGE_template defines the rules for each package.
1098 # For example, for the package bufio, it produces:
1100 # @go_include@ bufio.lo.dep
1101 # bufio.lo.dep: $(srcdir)/go/bufio/*.go
1102 #       $(BUILDDEPS)
1103 # bufio.lo:
1104 #       $(BUILDPACKAGE)
1105 # bufio/check: $(CHECK_DEPS)
1106 #       @$(CHECK)
1107 # .PHONY: bufio/check
1109 # This is invoked with $(1) set to a package, which is a directory name,
1110 # such as "bufio" or "archive/tar".
1111 define PACKAGE_template
1112 @go_include@ $(1).lo.dep
1113 $(1).lo.dep: $(srcdir)/go/$(1)/*.go
1114         $$(BUILDDEPS)
1115 $(1).lo:
1116         $$(BUILDPACKAGE)
1117 $(1)/check: $$(CHECK_DEPS)
1118         @$$(CHECK)
1119 .PHONY: $(1)/check
1120 $(1).gox: $(1).s-gox; @true
1121 $(1).s-gox: $(1).lo
1122         $$(BUILDGOX)
1123         $$(STAMP) $$@
1124 endef
1126 # This line expands PACKAGE_template once for each package name listed
1127 # in $(PACKAGES).
1128 $(foreach package,$(PACKAGES),$(eval $(call PACKAGE_template,$(package))))
1129 $(foreach package,$(GOTOOL_PACKAGES),$(eval $(call PACKAGE_template,$(package))))
1131 # Pass -ffp-contract=off, or 386-specific options, when building the
1132 # math package.  MATH_FLAG is defined in configure.ac.
1133 math_lo_GOCFLAGS = $(MATH_FLAG)
1135 # Add the generated file runtime_sysinfo.go to the runtime package.
1136 extra_go_files_runtime = runtime_sysinfo.go sigtab.go
1137 runtime.lo.dep: $(extra_go_files_runtime)
1139 # Add generated files to the syscall package.
1140 extra_go_files_syscall = \
1141         libcalls.go \
1142         sysinfo.go \
1143         syscall_arch.go \
1144         $(syscall_epoll_file)
1145 syscall.lo.dep: $(extra_go_files_syscall)
1147 # Pass -fgo-compiling-runtime when compiling the runtime package.
1148 runtime_lo_GOCFLAGS = -fgo-c-header=runtime.inc.tmp -fgo-compiling-runtime
1149 runtime_check_GOCFLAGS = -fgo-compiling-runtime
1150 runtime_internal_atomic_lo_GOCFLAGS = -fgo-compiling-runtime
1151 runtime_internal_atomic_lo_check_GOCFLAGS = -fgo-compiling-runtime
1152 runtime_internal_sys_lo_GOCFLAGS = -fgo-compiling-runtime
1153 runtime_internal_sys_lo_check_GOCFLAGS = -fgo-compiling-runtime
1155 # If libffi is supported (the normal case) use the ffi build tag for
1156 # the runtime package.
1157 if USE_LIBFFI
1158 matchargs_runtime = --tag=libffi
1159 else
1160 matchargs_runtime =
1161 endif
1163 # At least for now, we need -static-libgo for this test, because
1164 # otherwise we can't get the line numbers.
1165 # Also use -fno-inline to get better results from the memory profiler.
1166 runtime_pprof_check_GOCFLAGS = -static-libgo -fno-inline
1168 extra_go_files_runtime_internal_sys = version.go
1169 runtime/internal/sys.lo.dep: $(extra_go_files_runtime_internal_sys)
1171 extra_go_files_cmd_internal_objabi = objabi.go
1172 cmd/internal/objabi.lo.dep: $(extra_go_files_cmd_internal_objabi)
1174 extra_go_files_cmd_go_internal_cfg = zdefaultcc.go
1175 cmd/go/internal/cfg.lo.dep: $(extra_go_files_cmd_go_internal_cfg)
1177 extra_go_files_cmd_go_internal_load = zstdpkglist.go
1178 cmd/go/internal/load.lo.dep: $(extra_go_files_cmd_go_internal_load)
1180 extra_check_libs_cmd_go_internal_cache = $(abs_builddir)/libgotool.a
1181 extra_check_libs_cmd_go_internal_generate = $(abs_builddir)/libgotool.a
1182 extra_check_libs_cmd_go_internal_get = $(abs_builddir)/libgotool.a
1183 extra_check_libs_cmd_go_internal_load = $(abs_builddir)/libgotool.a
1184 extra_check_libs_cmd_go_internal_work = $(abs_builddir)/libgotool.a
1186 extra_check_libs_cmd_vet_internal_cfg = $(abs_builddir)/libgotool.a
1188 # FIXME: The following C files may as well move to the runtime
1189 # directory and be treated like other C files.
1191 # Use C code to speed up {bytes,strings}.IndexByte and friends.
1192 bytes/index.lo: go/bytes/indexbyte.c runtime.inc
1193         @$(MKDIR_P) bytes
1194         $(LTCOMPILE) -c -o $@ $(srcdir)/go/bytes/indexbyte.c
1195 strings/index.lo: go/strings/indexbyte.c runtime.inc
1196         @$(MKDIR_P) strings
1197         $(LTCOMPILE) -c -o $@ $(srcdir)/go/strings/indexbyte.c
1199 # Use a C function with a fixed number of arguments to call a C
1200 # varargs function.
1201 log/syslog/syslog_c.lo: go/log/syslog/syslog_c.c runtime.inc
1202         @$(MKDIR_P) log/syslog
1203         $(LTCOMPILE) -c -o $@ $(srcdir)/go/log/syslog/syslog_c.c
1205 # The interface to libffi from the reflect package is written in C.
1206 reflect/makefunc_ffi_c.lo: go/reflect/makefunc_ffi_c.c runtime.inc
1207         @$(MKDIR_P) reflect
1208         $(LTCOMPILE) -c -o $@ $(srcdir)/go/reflect/makefunc_ffi_c.c
1210 # The atomic functions are written in C.
1211 runtime/internal/atomic_c.lo: go/runtime/internal/atomic/atomic.c runtime.inc
1212         @$(MKDIR_P) runtime/internal
1213         $(LTCOMPILE) -c -o $@ $(srcdir)/go/runtime/internal/atomic/atomic.c
1214 sync/atomic_c.lo: go/sync/atomic/atomic.c runtime.inc
1215         @$(MKDIR_P) sync
1216         $(LTCOMPILE) -c -o $@ $(srcdir)/go/sync/atomic/atomic.c
1218 # A few syscall functions are written in C.
1219 syscall/clone_linux.lo: go/syscall/clone_linux.c runtime.inc
1220         @$(MKDIR_P) syscall
1221         $(LTCOMPILE) -c -o $@ $(srcdir)/go/syscall/clone_linux.c
1222 syscall/errno.lo: go/syscall/errno.c runtime.inc
1223         @$(MKDIR_P) syscall
1224         $(LTCOMPILE) -c -o $@ $(srcdir)/go/syscall/errno.c
1225 syscall/signame.lo: go/syscall/signame.c runtime.inc
1226         @$(MKDIR_P) syscall
1227         $(LTCOMPILE) -c -o $@ $(srcdir)/go/syscall/signame.c
1228 syscall/wait.lo: go/syscall/wait.c runtime.inc
1229         @$(MKDIR_P) syscall
1230         $(LTCOMPILE) -c -o $@ $(srcdir)/go/syscall/wait.c
1232 # Solaris 11.4 changed the type of fields in struct stat.
1233 # Use a build tag, based on a configure check, to cope.
1234 if LIBGO_IS_SOLARIS
1235 if HAVE_STAT_TIMESPEC
1236 matchargs_os = --tag=solaristag
1237 else
1238 matchargs_os =
1239 endif
1240 else
1241 matchargs_os =
1242 endif
1244 if LIBGO_IS_BSD
1246 # Build golang_org/x/net/route only on BSD systems.
1248 $(eval $(call PACKAGE_template,golang_org/x/net/route))
1250 golang_org_x_net_route_lo = \
1251         golang_org/x/net/route.lo
1252 golang_org_x_net_route_check = \
1253         golang_org/x/net/route/check
1255 endif
1257 if LIBGO_IS_SOLARIS
1259 # Build golang_org/x/net/lif only on Solaris systems.
1261 $(eval $(call PACKAGE_template,golang_org/x/net/lif))
1263 golang_org_x_net_lif_lo = \
1264         golang_org/x/net/lif.lo
1265 golang_org_x_net_lif_check = \
1266         golang_org/x/net/lif/check
1268 endif
1270 TEST_PACKAGES = \
1271         bufio/check \
1272         bytes/check \
1273         context/check \
1274         crypto/check \
1275         errors/check \
1276         expvar/check \
1277         flag/check \
1278         fmt/check \
1279         hash/check \
1280         html/check \
1281         image/check \
1282         io/check \
1283         log/check \
1284         math/check \
1285         mime/check \
1286         net/check \
1287         os/check \
1288         path/check \
1289         reflect/check \
1290         regexp/check \
1291         runtime/check \
1292         sort/check \
1293         strconv/check \
1294         strings/check \
1295         sync/check \
1296         syscall/check \
1297         time/check \
1298         unicode/check \
1299         archive/tar/check \
1300         archive/zip/check \
1301         cmd/go/internal/cache/check \
1302         cmd/go/internal/generate/check \
1303         cmd/go/internal/get/check \
1304         cmd/go/internal/load/check \
1305         cmd/go/internal/work/check \
1306         cmd/internal/buildid/check \
1307         cmd/internal/edit/check \
1308         cmd/internal/objabi/check \
1309         cmd/internal/test2json/check \
1310         cmd/vet/internal/cfg/check \
1311         compress/bzip2/check \
1312         compress/flate/check \
1313         compress/gzip/check \
1314         compress/lzw/check \
1315         compress/zlib/check \
1316         container/heap/check \
1317         container/list/check \
1318         container/ring/check \
1319         crypto/aes/check \
1320         crypto/cipher/check \
1321         crypto/des/check \
1322         crypto/dsa/check \
1323         crypto/ecdsa/check \
1324         crypto/elliptic/check \
1325         crypto/hmac/check \
1326         crypto/md5/check \
1327         crypto/rand/check \
1328         crypto/rc4/check \
1329         crypto/rsa/check \
1330         crypto/sha1/check \
1331         crypto/sha256/check \
1332         crypto/sha512/check \
1333         crypto/subtle/check \
1334         crypto/tls/check \
1335         crypto/x509/check \
1336         database/sql/check \
1337         database/sql/driver/check \
1338         debug/dwarf/check \
1339         debug/elf/check \
1340         debug/macho/check \
1341         debug/pe/check \
1342         debug/plan9obj/check \
1343         debug/xcoff/check \
1344         encoding/ascii85/check \
1345         encoding/asn1/check \
1346         encoding/base32/check \
1347         encoding/base64/check \
1348         encoding/binary/check \
1349         encoding/csv/check \
1350         encoding/gob/check \
1351         encoding/hex/check \
1352         encoding/json/check \
1353         encoding/pem/check \
1354         encoding/xml/check \
1355         exp/proxy/check \
1356         exp/terminal/check \
1357         html/template/check \
1358         go/ast/check \
1359         go/build/check \
1360         go/constant/check \
1361         go/doc/check \
1362         go/format/check \
1363         go/importer/check \
1364         go/internal/gcimporter/check \
1365         go/internal/gccgoimporter/check \
1366         go/internal/srcimporter/check \
1367         go/parser/check \
1368         go/printer/check \
1369         go/scanner/check \
1370         go/token/check \
1371         go/types/check \
1372         golang_org/x/crypto/chacha20poly1305/check \
1373         golang_org/x/crypto/chacha20poly1305/internal/chacha20/check \
1374         golang_org/x/crypto/cryptobyte/check \
1375         golang_org/x/crypto/curve25519/check \
1376         golang_org/x/crypto/poly1305/check \
1377         golang_org/x/net/http2/hpack/check \
1378         golang_org/x/net/idna/check \
1379         golang_org/x/net/lex/httplex/check \
1380         $(golang_org_x_net_lif_check) \
1381         golang_org/x/net/proxy/check \
1382         $(golang_org_x_net_route_check) \
1383         hash/adler32/check \
1384         hash/crc32/check \
1385         hash/crc64/check \
1386         hash/fnv/check \
1387         image/color/check \
1388         image/draw/check \
1389         image/jpeg/check \
1390         image/png/check \
1391         index/suffixarray/check \
1392         internal/poll/check \
1393         internal/singleflight/check \
1394         internal/trace/check \
1395         io/ioutil/check \
1396         log/syslog/check \
1397         math/big/check \
1398         math/bits/check \
1399         math/cmplx/check \
1400         math/rand/check \
1401         mime/multipart/check \
1402         mime/quotedprintable/check \
1403         net/http/check \
1404         net/http/cgi/check \
1405         net/http/cookiejar/check \
1406         net/http/fcgi/check \
1407         net/http/httptest/check \
1408         net/http/httptrace/check \
1409         net/http/httputil/check \
1410         net/http/internal/check \
1411         net/internal/socktest/check \
1412         net/mail/check \
1413         net/rpc/check \
1414         net/smtp/check \
1415         net/textproto/check \
1416         net/url/check \
1417         net/rpc/jsonrpc/check \
1418         os/exec/check \
1419         os/signal/check \
1420         os/user/check \
1421         path/filepath/check \
1422         regexp/syntax/check \
1423         runtime/debug/check \
1424         runtime/internal/atomic/check \
1425         runtime/internal/sys/check \
1426         runtime/pprof/check \
1427         runtime/pprof/internal/profile/check \
1428         runtime/trace/check \
1429         sync/atomic/check \
1430         text/scanner/check \
1431         text/tabwriter/check \
1432         text/template/check \
1433         text/template/parse/check \
1434         testing/quick/check \
1435         unicode/utf16/check \
1436         unicode/utf8/check
1438 check: check-tail
1439 check-recursive: check-head
1441 check-head:
1442         @echo "Test Run By $${USER} on `date`" > libgo.head
1443         @echo "Native configuration is $(host_triplet)" >> libgo.head
1444         @echo >> libgo.head
1445         @echo "         === libgo tests ===" >> libgo.head
1446         @echo >> libgo.head
1448 check-tail: check-recursive check-multi
1449         @if test "$(USE_DEJAGNU)" = "yes"; then \
1450           exit 0; \
1451         fi; \
1452         lib=`${PWD_COMMAND} | sed -e 's,^.*/\([^/][^/]*\)$$,\1,'`; \
1453         for dir in . $(MULTIDIRS); do \
1454           mv ../$${dir}/$${lib}/libgo.sum ../$${dir}/$${lib}/libgo.sum.sep; \
1455           mv ../$${dir}/$${lib}/libgo.log ../$${dir}/$${lib}/libgo.log.sep; \
1456         done; \
1457         mv libgo.head libgo.sum; \
1458         cp libgo.sum libgo.log; \
1459         echo "Schedule of variations:" >> libgo.sum; \
1460         for dir in . $(MULTIDIRS); do \
1461           multidir=../$${dir}/$${lib}; \
1462           multivar=`cat $${multidir}/libgo.var`; \
1463           echo "    $${multivar}" >> libgo.sum; \
1464         done; \
1465         echo >> libgo.sum; \
1466         pass=0; fail=0; untested=0; \
1467         for dir in . $(MULTIDIRS); do \
1468           multidir=../$${dir}/$${lib}; \
1469           multivar=`cat $${multidir}/libgo.var`; \
1470           echo "Running target $${multivar}" >> libgo.sum; \
1471           echo "Running $(srcdir)/libgo.exp ..." >> libgo.sum; \
1472           cat $${multidir}/libgo.sum.sep >> libgo.sum; \
1473           cat $${multidir}/libgo.log.sep >> libgo.log; \
1474           if test -n "${MULTIDIRS}"; then \
1475             echo "              === libgo Summary for $${multivar} ===" >> libgo.sum; \
1476             echo >> libgo.sum; \
1477           fi; \
1478           p=`grep -c PASS $${multidir}/libgo.sum.sep`; \
1479           pass=`expr $$pass + $$p`; \
1480           if test "$$p" -ne "0" && test -n "${MULTIDIRS}"; then \
1481             echo "# of expected passes          $$p" >> libgo.sum; \
1482           fi; \
1483           p=`grep -c FAIL $${multidir}/libgo.sum.sep`; \
1484           fail=`expr $$fail + $$p`; \
1485           if test "$$p" -ne "0" && test -n "${MULTIDIRS}"; then \
1486             echo "# of unexpected failures      $$p" >> libgo.sum; \
1487           fi; \
1488           p=`grep -c UNTESTED $${multidir}/libgo.sum.sep`; \
1489           untested=`expr $$untested + $$p`; \
1490           if test "$$p" -ne "0" && test -n "${MULTIDIRS}"; then \
1491             echo "# of untested testcases               $$p" >> libgo.sum; \
1492           fi; \
1493         done; \
1494         echo >> libgo.sum; \
1495         echo "          === libgo Summary ===" >> libgo.sum; \
1496         echo >> libgo.sum; \
1497         if test "$$pass" -ne "0"; then \
1498           echo "# of expected passes            $$pass" >> libgo.sum; \
1499         fi; \
1500         if test "$$fail" -ne "0"; then \
1501           echo "# of unexpected failures        $$fail" >> libgo.sum; \
1502         fi; \
1503         if test "$$untested" -ne "0"; then \
1504           echo "# of untested testcases         $$untested" >> libgo.sum; \
1505         fi; \
1506         echo `echo $(GOC) | sed -e 's/ .*//'`  `$(GOC) -v 2>&1 | grep " version" | sed -n -e 's/.* \(version.*$$\)/\1/p'` >> libgo.sum; \
1507         echo >> libgo.log; \
1508         echo "runtest completed at `date`" >> libgo.log; \
1509         if test "$$fail" -ne "0"; then \
1510           status=1; \
1511         else \
1512           status=0; \
1513         fi; \
1514         exit $$status
1516 check-am:
1517         @rm -f libgo.sum libgo.log libgo.tail
1518         @multivar="unix"; \
1519         [ -z "$(MULTIFLAGS)" ] || multivar="$${multivar}/$(MULTIFLAGS)"; \
1520         echo "$${multivar}" > libgo.var
1521         @for f in $(TEST_PACKAGES); do \
1522            rm -f $$f-testsum $$f-testlog; \
1523          done
1524         -@$(MAKE) $(AM_MAKEFLAGS) -k $(TEST_PACKAGES)
1525         @for f in $(TEST_PACKAGES); do \
1526           if test -f $$f-testsum; then \
1527             cat $$f-testsum >> libgo.sum; \
1528           fi; \
1529           if test -f $$f-testlog; then \
1530             cat $$f-testlog >> libgo.log; \
1531           fi; \
1532         done
1534 check-multi:
1535         $(MULTIDO) $(AM_MAKEFLAGS) DO=check-am multi-do # $(MAKE)
1537 bench:
1538         -@$(MAKE) $(AM_MAKEFLAGS) -k $(TEST_PACKAGES) GOBENCH=.
1540 MOSTLYCLEANFILES = \
1541         s-runtime_sysinfo s-sigtab s-runtime-inc s-zstdpkglist \
1542         s-libcalls s-libcalls-list s-syscall_arch s-gen-sysinfo s-sysinfo \
1543         s-errno s-epoll \
1544         libgo.head libgo.sum.sep libgo.log.sep libgo.var \
1545         libcalls-list runtime.inc runtime.inc.tmp2 runtime.inc.tmp3
1547 mostlyclean-local:
1548         find . -name '*.lo' -print | xargs $(LIBTOOL) --mode=clean rm -f
1549         find . -name '*.$(OBJEXT)' -print | xargs rm -f
1550         find . -name '*-testsum' -print | xargs rm -f
1551         find . -name '*-testlog' -print | xargs rm -f
1553 CLEANFILES = *.go *.c s-* libgo.sum libgo.log runtime.inc
1555 clean-local:
1556         find . -name '*.la' -print | xargs $(LIBTOOL) --mode=clean rm -f
1557         find . -name '*.a' -print | xargs rm -f
1558         find . -name '*.gox' -print | xargs rm -f
1559         find . -name '*.s-gox' -print | xargs rm -f
1561 distclean-local:
1562         find . -name '*.lo.dep' -print | xargs rm -f