PR rtl-optimization/84682
[official-gcc.git] / libgo / Makefile.am
blob8f7acfe66fefcfbe8e3d2569973899b373fc611d
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 toolexeclibgogodir = $(toolexeclibgodir)/go
240 toolexeclibgogo_DATA = \
241         go/ast.gox \
242         go/build.gox \
243         go/constant.gox \
244         go/doc.gox \
245         go/format.gox \
246         go/importer.gox \
247         go/parser.gox \
248         go/printer.gox \
249         go/scanner.gox \
250         go/token.gox \
251         go/types.gox
253 toolexeclibgohashdir = $(toolexeclibgodir)/hash
255 toolexeclibgohash_DATA = \
256         hash/adler32.gox \
257         hash/crc32.gox \
258         hash/crc64.gox \
259         hash/fnv.gox
261 toolexeclibgohtmldir = $(toolexeclibgodir)/html
263 toolexeclibgohtml_DATA = \
264         html/template.gox
266 toolexeclibgoimagedir = $(toolexeclibgodir)/image
268 toolexeclibgoimage_DATA = \
269         image/color.gox \
270         image/draw.gox \
271         image/gif.gox \
272         image/jpeg.gox \
273         image/png.gox
275 toolexeclibgoimagecolordir = $(toolexeclibgoimagedir)/color
277 toolexeclibgoimagecolor_DATA = \
278         image/color/palette.gox
280 toolexeclibgoindexdir = $(toolexeclibgodir)/index
282 toolexeclibgoindex_DATA = \
283         index/suffixarray.gox
285 toolexeclibgoiodir = $(toolexeclibgodir)/io
287 toolexeclibgoio_DATA = \
288         io/ioutil.gox
290 toolexeclibgologdir = $(toolexeclibgodir)/log
292 toolexeclibgolog_DATA = \
293         log/syslog.gox
295 toolexeclibgomathdir = $(toolexeclibgodir)/math
297 toolexeclibgomath_DATA = \
298         math/big.gox \
299         math/bits.gox \
300         math/cmplx.gox \
301         math/rand.gox
303 toolexeclibgomimedir = $(toolexeclibgodir)/mime
305 toolexeclibgomime_DATA = \
306         mime/multipart.gox \
307         mime/quotedprintable.gox
309 toolexeclibgonetdir = $(toolexeclibgodir)/net
311 toolexeclibgonet_DATA = \
312         net/http.gox \
313         net/mail.gox \
314         net/rpc.gox \
315         net/smtp.gox \
316         net/textproto.gox \
317         net/url.gox
319 toolexeclibgonethttpdir = $(toolexeclibgonetdir)/http
321 toolexeclibgonethttp_DATA = \
322         net/http/cgi.gox \
323         net/http/cookiejar.gox \
324         net/http/fcgi.gox \
325         net/http/httptest.gox \
326         net/http/httptrace.gox \
327         net/http/httputil.gox \
328         net/http/pprof.gox
330 toolexeclibgonetrpcdir = $(toolexeclibgonetdir)/rpc
332 toolexeclibgonetrpc_DATA = \
333         net/rpc/jsonrpc.gox
335 toolexeclibgoosdir = $(toolexeclibgodir)/os
337 toolexeclibgoos_DATA = \
338         os/exec.gox \
339         os/signal.gox \
340         os/user.gox
342 toolexeclibgopathdir = $(toolexeclibgodir)/path
344 toolexeclibgopath_DATA = \
345         path/filepath.gox
347 toolexeclibgoregexpdir = $(toolexeclibgodir)/regexp
349 toolexeclibgoregexp_DATA = \
350         regexp/syntax.gox
352 toolexeclibgoruntimedir = $(toolexeclibgodir)/runtime
354 toolexeclibgoruntime_DATA = \
355         runtime/debug.gox \
356         runtime/pprof.gox \
357         runtime/trace.gox
359 toolexeclibgosyncdir = $(toolexeclibgodir)/sync
361 toolexeclibgosync_DATA = \
362         sync/atomic.gox
364 toolexeclibgotestingdir = $(toolexeclibgodir)/testing
366 toolexeclibgotesting_DATA = \
367         testing/iotest.gox \
368         testing/quick.gox
370 toolexeclibgotestinginternaldir = $(toolexeclibgotestingdir)/internal
372 toolexeclibgotestinginternal_DATA = \
373         testing/internal/testdeps.gox
375 toolexeclibgotextdir = $(toolexeclibgodir)/text
377 toolexeclibgotext_DATA = \
378         text/scanner.gox \
379         text/tabwriter.gox \
380         text/template.gox
382 toolexeclibgotexttemplatedir = $(toolexeclibgotextdir)/template
384 toolexeclibgotexttemplate_DATA = \
385         text/template/parse.gox
387 toolexeclibgounicodedir = $(toolexeclibgodir)/unicode
389 toolexeclibgounicode_DATA = \
390         unicode/utf16.gox \
391         unicode/utf8.gox
393 # Some packages are only needed for tests, so unlike the other
394 # internal packages nothing will explicitly depend on them.
395 # Force them to be built.
396 noinst_DATA = \
397         golang_org/x/net/internal/nettest.gox \
398         golang_org/x/net/nettest.gox \
399         internal/testenv.gox \
400         internal/trace.gox \
401         net/internal/socktest.gox \
402         os/signal/internal/pty.gox
404 if LIBGO_IS_RTEMS
405 rtems_task_variable_add_file = runtime/rtems-task-variable-add.c
406 else
407 rtems_task_variable_add_file =
408 endif
410 if LIBGO_IS_LINUX
411 runtime_getncpu_file = runtime/getncpu-linux.c
412 else
413 if LIBGO_IS_DARWIN
414 runtime_getncpu_file = runtime/getncpu-bsd.c
415 else
416 if LIBGO_IS_IRIX
417 runtime_getncpu_file = runtime/getncpu-irix.c
418 else
419 if LIBGO_IS_SOLARIS
420 runtime_getncpu_file = runtime/getncpu-solaris.c
421 else
422 if LIBGO_IS_FREEBSD
423 runtime_getncpu_file = runtime/getncpu-bsd.c
424 else
425 if LIBGO_IS_NETBSD
426 runtime_getncpu_file = runtime/getncpu-bsd.c
427 else
428 if LIBGO_IS_AIX
429 runtime_getncpu_file = runtime/getncpu-aix.c
430 else
431 runtime_getncpu_file = runtime/getncpu-none.c
432 endif
433 endif
434 endif
435 endif
436 endif
437 endif
438 endif
440 runtime_files = \
441         runtime/aeshash.c \
442         runtime/go-assert.c \
443         runtime/go-caller.c \
444         runtime/go-callers.c \
445         runtime/go-cdiv.c \
446         runtime/go-cgo.c \
447         runtime/go-construct-map.c \
448         runtime/go-ffi.c \
449         runtime/go-fieldtrack.c \
450         runtime/go-matherr.c \
451         runtime/go-memclr.c \
452         runtime/go-memcmp.c \
453         runtime/go-memequal.c \
454         runtime/go-memmove.c \
455         runtime/go-nanotime.c \
456         runtime/go-now.c \
457         runtime/go-nosys.c \
458         runtime/go-reflect-call.c \
459         runtime/go-runtime-error.c \
460         runtime/go-setenv.c \
461         runtime/go-signal.c \
462         runtime/go-strslice.c \
463         runtime/go-typedesc-equal.c \
464         runtime/go-unsafe-pointer.c \
465         runtime/go-unsetenv.c \
466         runtime/go-unwind.c \
467         runtime/go-varargs.c \
468         runtime/env_posix.c \
469         runtime/panic.c \
470         runtime/print.c \
471         runtime/proc.c \
472         runtime/runtime_c.c \
473         runtime/stack.c \
474         runtime/thread.c \
475         runtime/yield.c \
476         $(rtems_task_variable_add_file) \
477         $(runtime_getncpu_file)
479 version.go: s-version; @true
480 s-version: Makefile
481         rm -f version.go.tmp
482         echo "package sys" > version.go.tmp
483         echo 'func init() { DefaultGoroot = "$(prefix)" }' >> version.go.tmp
484         echo 'const TheVersion = "'`cat $(srcdir)/VERSION | sed 1q`' '`$(GOC) --version | sed 1q`'"' >> version.go.tmp
485         echo 'const Goexperiment = ``' >> version.go.tmp
486         echo 'const GOARCH = "'$(GOARCH)'"' >> version.go.tmp
487         echo 'const GOOS = "'$(GOOS)'"' >> version.go.tmp
488         echo 'const GccgoToolDir = "$(libexecsubdir)"' >> version.go.tmp
489         echo >> version.go.tmp
490         echo "type ArchFamilyType int" >> version.go.tmp
491         echo >> version.go.tmp
492         echo "const (" >> version.go.tmp
493         echo "  UNKNOWN ArchFamilyType = iota" >> version.go.tmp
494         for a in $(ALLGOARCHFAMILY); do \
495           echo "        $${a}" >> version.go.tmp; \
496         done
497         echo ")" >> version.go.tmp
498         echo >> version.go.tmp
499         for a in $(ALLGOARCH); do \
500           f=`echo $${a} | sed -e 's/\(.\).*/\1/' -e 'y/abcdefghijklmnopqrstuvwxyz/ABCDEFGHIJKLMNOPQRSTUVWXYZ/'`; \
501           n="$${f}`echo $${a} | sed -e 's/.//'`"; \
502           if test "$${a}" = "$(GOARCH)"; then \
503             echo "const Goarch$${n} = 1" >> version.go.tmp; \
504           else \
505             echo "const Goarch$${n} = 0" >> version.go.tmp; \
506           fi; \
507         done
508         echo >> version.go.tmp
509         echo "const (" >> version.go.tmp
510         echo "  ArchFamily = `$(SHELL) $(srcdir)/goarch.sh $(GOARCH) family`" >> version.go.tmp
511         echo "  BigEndian = `$(SHELL) $(srcdir)/goarch.sh $(GOARCH) bigendian`" >> version.go.tmp
512         echo "  CacheLineSize = `$(SHELL) $(srcdir)/goarch.sh $(GOARCH) cachelinesize`" >> version.go.tmp
513         echo "  DefaultPhysPageSize = `$(SHELL) $(srcdir)/goarch.sh $(GOARCH) defaultphyspagesize`" >> version.go.tmp
514         echo "  HugePageSize = `$(SHELL) $(srcdir)/goarch.sh $(GOARCH) hugepagesize`" >> version.go.tmp
515         echo "  Int64Align = `$(SHELL) $(srcdir)/goarch.sh $(GOARCH) int64align`" >> version.go.tmp
516         echo "  MinFrameSize = `$(SHELL) $(srcdir)/goarch.sh $(GOARCH) minframesize`" >> version.go.tmp
517         echo "  PCQuantum = `$(SHELL) $(srcdir)/goarch.sh $(GOARCH) pcquantum`" >> version.go.tmp
518         echo ")" >> version.go.tmp
519         echo >> version.go.tmp
520         for a in $(ALLGOOS); do \
521           f=`echo $${a} | sed -e 's/\(.\).*/\1/' -e 'y/abcdefghijklmnopqrstuvwxyz/ABCDEFGHIJKLMNOPQRSTUVWXYZ/'`; \
522           n="$${f}`echo $${a} | sed -e 's/.//'`"; \
523           if test "$${a}" = "$(GOOS)"; then \
524             echo "const Goos$${n} = 1" >> version.go.tmp; \
525           else \
526             echo "const Goos$${n} = 0" >> version.go.tmp; \
527           fi; \
528         done
529         echo >> version.go.tmp
530         echo "type Uintreg uintptr" >> version.go.tmp
531         $(SHELL) $(srcdir)/mvifdiff.sh version.go.tmp version.go
532         $(STAMP) $@
534 objabi.go: s-objabi; @true
535 s-objabi: Makefile
536         rm -f objabi.go.tmp
537         echo "package objabi" > objabi.go.tmp
538         echo "import \"runtime\"" >> objabi.go.tmp
539         echo 'func init() { defaultGOROOT = `$(prefix)` }' >> objabi.go.tmp
540         echo 'const defaultGO386 = `sse2`' >> objabi.go.tmp
541         echo 'const defaultGOARM = `5`' >> objabi.go.tmp
542         echo 'const defaultGOMIPS = `hardfloat`' >> objabi.go.tmp
543         echo 'const defaultGOOS = runtime.GOOS' >> objabi.go.tmp
544         echo 'const defaultGOARCH = runtime.GOARCH' >> objabi.go.tmp
545         echo 'const defaultGO_EXTLINK_ENABLED = ``' >> objabi.go.tmp
546         echo 'const version = `'`cat $(srcdir)/VERSION | sed 1q`' '`$(GOC) --version | sed 1q`'`' >> objabi.go.tmp
547         echo 'const stackGuardMultiplier = 1' >> objabi.go.tmp
548         echo 'const goexperiment = ``' >> objabi.go.tmp
549         $(SHELL) $(srcdir)/mvifdiff.sh objabi.go.tmp objabi.go
550         $(STAMP) $@
552 gccgosizes.go: s-gccgosizes; @true
553 s-gccgosizes: Makefile goarch.sh
554         rm -f gccgosizes.go.tmp
555         echo "package types" > gccgosizes.go.tmp
556         echo >> gccgosizes.go.tmp
557         echo "var gccgoArchSizes = map[string]*StdSizes{" >> gccgosizes.go.tmp
558         for a in $(ALLGOARCH); do \
559           ptrsize=`$(SHELL) $(srcdir)/goarch.sh $$a ptrsize`; \
560           maxalign=`$(SHELL) $(srcdir)/goarch.sh $$a maxalign`; \
561           echo "        \"$$a\": {$${ptrsize}, $${maxalign}}," >> gccgosizes.go.tmp; \
562         done
563         echo "}" >> gccgosizes.go.tmp
564         $(SHELL) $(srcdir)/mvifdiff.sh gccgosizes.go.tmp gccgosizes.go
565         $(STAMP) $@
567 runtime_sysinfo.go: s-runtime_sysinfo; @true
568 s-runtime_sysinfo: $(srcdir)/mkrsysinfo.sh gen-sysinfo.go
569         GOARCH=$(GOARCH) GOOS=$(GOOS) $(SHELL) $(srcdir)/mkrsysinfo.sh
570         $(SHELL) $(srcdir)/mvifdiff.sh tmp-runtime_sysinfo.go runtime_sysinfo.go
571         $(STAMP) $@
573 sigtab.go: s-sigtab; @true
574 s-sigtab: $(srcdir)/mksigtab.sh gen-sysinfo.go
575         GOOS=$(GOOS) $(SHELL) $(srcdir)/mksigtab.sh > tmp-sigtab.go
576         $(SHELL) $(srcdir)/mvifdiff.sh tmp-sigtab.go sigtab.go
577         $(STAMP) $@
579 GCCGO_INSTALL_NAME := $(shell echo gccgo|sed '$(program_transform_name)')
580 GCC_INSTALL_NAME := $(shell echo gcc|sed '$(program_transform_name)')
581 GXX_INSTALL_NAME := $(shell echo g++|sed '$(program_transform_name)')
583 zdefaultcc.go: s-zdefaultcc; @true
584 s-zdefaultcc: Makefile
585         echo 'package cfg' > zdefaultcc.go.tmp
586         echo >> zdefaultcc.go.tmp
587         echo 'func DefaultGCCGO(goos, goarch string) string { return "$(bindir)/$(GCCGO_INSTALL_NAME)" }' >> zdefaultcc.go.tmp
588         echo 'func DefaultCC(goos, goarch string) string { return "$(GCC_INSTALL_NAME)" }' >> zdefaultcc.go.tmp
589         echo 'func DefaultCXX(goos, goarch string) string { return "$(GXX_INSTALL_NAME)" }' >> zdefaultcc.go.tmp
590         echo 'const DefaultPkgConfig = "pkg-config"' >> zdefaultcc.go.tmp
591         echo 'var OSArchSupportsCgo = map[string]bool{}' >> zdefaultcc.go.tmp
592         $(SHELL) $(srcdir)/../move-if-change zdefaultcc.go.tmp zdefaultcc.go
593         $(STAMP) $@ 
595 # _Complex_lock and _Reader_lock are Go translations of some AIX system
596 # types and should not be exported back to C
597 # semt is a Go translation of the C type sem_t; it fails to convert on
598 # some systems and need not be exported back to C.
599 # sigset conflicts with system type sigset on AIX, so we need to rename it
600 runtime.inc: s-runtime-inc; @true
601 s-runtime-inc: runtime.lo Makefile
602         rm -f runtime.inc.tmp2 runtime.inc.tmp3
603         grep -v "#define _" runtime.inc.tmp | grep -v "#define [cm][01234] " | grep -v "#define empty " > runtime.inc.tmp2
604         for pattern in '_[GP][a-z]' _Max _Lock _Sig _Trace _MHeap _Num; do \
605           grep "#define $$pattern" runtime.inc.tmp >> runtime.inc.tmp2; \
606         done
607         for TYPE in _Complex_lock _Reader_lock semt; do \
608           sed -e '/struct '$${TYPE}' {/,/^}/s/^.*$$//' runtime.inc.tmp2 > runtime.inc.tmp3; \
609           mv runtime.inc.tmp3 runtime.inc.tmp2; \
610         done
611         sed -e 's/sigset/sigset_go/' runtime.inc.tmp2 > runtime.inc.tmp3
612         $(SHELL) $(srcdir)/mvifdiff.sh runtime.inc.tmp3 runtime.inc
613         rm -f runtime.inc.tmp2 runtime.inc.tmp3
614         $(STAMP) $@
616 noinst_DATA += zstdpkglist.go zdefaultcc.go
618 # Generate the list of go std packages that were included in libgo
619 zstdpkglist.go: s-zstdpkglist; @true
620 s-zstdpkglist: Makefile
621         rm -f zstdpkglist.go.tmp
622         echo 'package load' > zstdpkglist.go.tmp
623         echo "" >> zstdpkglist.go.tmp
624         echo 'var stdpkg = map[string]bool{' >> zstdpkglist.go.tmp
625         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
626         echo '}' >> zstdpkglist.go.tmp
627         $(SHELL) $(srcdir)/mvifdiff.sh zstdpkglist.go.tmp zstdpkglist.go
628         $(STAMP) $@
630 if LIBGO_IS_LINUX
631 syscall_epoll_file = epoll.go
632 else
633 syscall_epoll_file =
634 endif
636 libcalls.go: s-libcalls; @true
637 s-libcalls: libcalls-list go/syscall/mksyscall.awk $(srcdir)/go/syscall/*.go
638         rm -f libcalls.go.tmp
639         $(AWK) -f $(srcdir)/go/syscall/mksyscall.awk `cat libcalls-list` > libcalls.go.tmp
640         $(SHELL) $(srcdir)/mvifdiff.sh libcalls.go.tmp libcalls.go
641         $(STAMP) $@
643 libcalls-list: s-libcalls-list; @true
644 s-libcalls-list: Makefile $(srcdir)/go/syscall/*.go
645         rm -f libcalls-list.tmp
646         $(SHELL) $(srcdir)/match.sh --goarch=$(GOARCH) --goos=$(GOOS) --srcdir=$(srcdir)/go/syscall $(matchargs_syscall) > libcalls-list.tmp
647         $(SHELL) $(srcdir)/mvifdiff.sh libcalls-list.tmp libcalls-list
648         $(STAMP) $@
650 syscall_arch.go: s-syscall_arch; @true
651 s-syscall_arch: Makefile
652         rm -f syscall_arch.go.tmp
653         echo "package syscall" > syscall_arch.go.tmp
654         echo 'const ARCH = "'$(GOARCH)'"' >> syscall_arch.go.tmp
655         echo 'const OS = "'$(GOOS)'"' >> syscall_arch.go.tmp
656         $(SHELL) $(srcdir)/mvifdiff.sh syscall_arch.go.tmp syscall_arch.go
657         $(STAMP) $@
659 SYSINFO_FLAGS = \
660         $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \
661         $(CPPFLAGS) $(OSCFLAGS) -O
663 gen-sysinfo.go: s-gen-sysinfo; @true
664 s-gen-sysinfo: $(srcdir)/sysinfo.c config.h
665         $(CC) $(SYSINFO_FLAGS) -fdump-go-spec=tmp-gen-sysinfo.go -std=gnu99 -S -o sysinfo.s $(srcdir)/sysinfo.c
666         rm -f sysinfo.s
667         $(SHELL) $(srcdir)/mvifdiff.sh tmp-gen-sysinfo.go gen-sysinfo.go
668         $(STAMP) $@
670 errno.i: s-errno; @true
671 s-errno:
672         echo '#include <errno.h>' | $(CC) $(SYSINFO_FLAGS) -x c - -E -dM > tmp-errno.i
673         $(SHELL) $(srcdir)/mvifdiff.sh tmp-errno.i errno.i
674         $(STAMP) $@
676 sysinfo.go: s-sysinfo; @true
677 s-sysinfo: $(srcdir)/mksysinfo.sh gen-sysinfo.go errno.i
678         GOARCH=$(GOARCH) GOOS=$(GOOS) $(SHELL) $(srcdir)/mksysinfo.sh
679         $(SHELL) $(srcdir)/mvifdiff.sh tmp-sysinfo.go sysinfo.go
680         $(STAMP) $@
682 # The epoll struct has an embedded union and is packed on x86_64,
683 # which is too complicated for mksysinfo.sh.  We find the offset of
684 # the only field we care about in configure.ac, and generate the
685 # struct here.
686 epoll.go: s-epoll; @true
687 s-epoll: Makefile
688         rm -f epoll.go.tmp
689         echo 'package syscall' > epoll.go.tmp
690         echo 'type EpollEvent struct {' >> epoll.go.tmp
691         echo '  Events uint32' >> epoll.go.tmp
692         case "$(SIZEOF_STRUCT_EPOLL_EVENT),$(STRUCT_EPOLL_EVENT_FD_OFFSET)" in \
693         0,0) echo 1>&2 "*** struct epoll_event data.fd offset unknown"; \
694            exit 1; ;; \
695         8,4) echo '     Fd int32' >> epoll.go.tmp; ;; \
696         12,4) echo '    Fd int32' >> epoll.go.tmp; \
697            echo '       Pad [4]byte' >> epoll.go.tmp; ;; \
698         12,8) echo '    Pad [4]byte' >> epoll.go.tmp; \
699            echo '       Fd int32' >> epoll.go.tmp; ;; \
700         16,8) echo '    Pad [4]byte' >> epoll.go.tmp; \
701            echo '       Fd int32' >> epoll.go.tmp; \
702            echo '       Pad2 [4]byte' >> epoll.go.tmp; ;; \
703         *) echo 1>&2 "*** struct epoll_event unsupported"; \
704            exit 1; ;; \
705         esac
706         echo '}' >> epoll.go.tmp
707         $(SHELL) $(srcdir)/mvifdiff.sh epoll.go.tmp epoll.go
708         $(STAMP) $@
710 if LIBGO_IS_LINUX
711 syscall_lib_clone_lo = syscall/clone_linux.lo
712 else
713 syscall_lib_clone_lo =
714 endif
716 PACKAGES = \
717         archive/tar \
718         archive/zip \
719         bufio \
720         bytes \
721         compress/bzip2 \
722         compress/flate \
723         compress/gzip \
724         compress/lzw \
725         compress/zlib \
726         container/heap \
727         container/list \
728         container/ring \
729         context \
730         crypto \
731         crypto/aes \
732         crypto/cipher \
733         crypto/des \
734         crypto/dsa \
735         crypto/ecdsa \
736         crypto/elliptic \
737         crypto/hmac \
738         crypto/internal/cipherhw \
739         crypto/md5 \
740         crypto/rand \
741         crypto/rc4 \
742         crypto/rsa \
743         crypto/sha1 \
744         crypto/sha256 \
745         crypto/sha512 \
746         crypto/subtle \
747         crypto/tls \
748         crypto/x509 \
749         crypto/x509/pkix \
750         database/sql \
751         database/sql/driver \
752         debug/dwarf \
753         debug/elf \
754         debug/gosym \
755         debug/macho \
756         debug/pe \
757         debug/plan9obj \
758         debug/xcoff \
759         encoding \
760         encoding/ascii85 \
761         encoding/asn1 \
762         encoding/base32 \
763         encoding/base64 \
764         encoding/binary \
765         encoding/csv \
766         encoding/gob \
767         encoding/hex \
768         encoding/json \
769         encoding/pem \
770         encoding/xml \
771         errors \
772         expvar \
773         flag \
774         fmt \
775         go/ast \
776         go/build \
777         go/constant \
778         go/doc \
779         go/format \
780         go/importer \
781         go/internal/gccgoimporter \
782         go/internal/gcimporter \
783         go/internal/srcimporter \
784         go/parser \
785         go/printer \
786         go/scanner \
787         go/token \
788         go/types \
789         golang_org/x/crypto/chacha20poly1305 \
790         golang_org/x/crypto/chacha20poly1305/internal/chacha20 \
791         golang_org/x/crypto/cryptobyte \
792         golang_org/x/crypto/cryptobyte/asn1 \
793         golang_org/x/crypto/curve25519 \
794         golang_org/x/crypto/poly1305 \
795         golang_org/x/net/http2/hpack \
796         golang_org/x/net/idna \
797         golang_org/x/net/internal/nettest \
798         golang_org/x/net/lex/httplex \
799         golang_org/x/net/nettest \
800         golang_org/x/net/proxy \
801         golang_org/x/text/secure/bidirule \
802         golang_org/x/text/transform \
803         golang_org/x/text/unicode/bidi \
804         golang_org/x/text/unicode/norm \
805         golang_org/x/text/width \
806         hash \
807         hash/adler32 \
808         hash/crc32 \
809         hash/crc64 \
810         hash/fnv \
811         html \
812         html/template \
813         image \
814         image/color \
815         image/color/palette \
816         image/draw \
817         image/gif \
818         image/internal/imageutil \
819         image/jpeg \
820         image/png \
821         index/suffixarray \
822         internal/nettrace \
823         internal/poll \
824         internal/race \
825         internal/singleflight \
826         internal/syscall/unix \
827         internal/testenv \
828         internal/testlog \
829         internal/trace \
830         io \
831         io/ioutil \
832         log \
833         log/syslog \
834         math \
835         math/big \
836         math/bits \
837         math/cmplx \
838         math/rand \
839         mime \
840         mime/multipart \
841         mime/quotedprintable \
842         net \
843         net/http \
844         net/http/cgi \
845         net/http/cookiejar \
846         net/http/fcgi \
847         net/http/httptest \
848         net/http/httptrace \
849         net/http/httputil \
850         net/http/internal \
851         net/http/pprof \
852         net/internal/socktest \
853         net/mail \
854         net/rpc \
855         net/rpc/jsonrpc \
856         net/smtp \
857         net/textproto \
858         net/url \
859         os \
860         os/exec \
861         os/signal \
862         os/signal/internal/pty \
863         os/user \
864         path \
865         path/filepath \
866         reflect \
867         regexp \
868         regexp/syntax \
869         runtime \
870         runtime/debug \
871         runtime/internal/atomic \
872         runtime/internal/sys \
873         runtime/pprof \
874         runtime/pprof/internal/profile \
875         runtime/trace \
876         sort \
877         strconv \
878         strings \
879         sync \
880         sync/atomic \
881         syscall \
882         testing \
883         testing/internal/testdeps \
884         testing/iotest \
885         testing/quick \
886         text/scanner \
887         text/tabwriter \
888         text/template \
889         text/template/parse \
890         time \
891         unicode \
892         unicode/utf16 \
893         unicode/utf8
895 libgo_go_objs = \
896         $(addsuffix .lo,$(PACKAGES)) \
897         bytes/index.lo \
898         reflect/makefunc_ffi_c.lo \
899         strings/index.lo \
900         $(syscall_lib_clone_lo) \
901         syscall/errno.lo \
902         syscall/signame.lo \
903         syscall/wait.lo \
904         $(golang_org_x_net_lif_lo) \
905         $(golang_org_x_net_route_lo) \
906         log/syslog/syslog_c.lo \
907         $(os_lib_inotify_lo) \
908         runtime/internal/atomic_c.lo \
909         sync/atomic_c.lo
911 libgo_ldflags = \
912         -version-info $(libtool_VERSION) $(PTHREAD_CFLAGS) $(AM_LDFLAGS)
914 libgo_libadd = \
915         $(libgo_go_objs) ../libbacktrace/libbacktrace.la \
916         $(LIBATOMIC) $(LIBFFI) $(PTHREAD_LIBS) $(MATH_LIBS) $(NET_LIBS)
918 libgo_la_SOURCES = $(runtime_files)
919 libgo_la_LDFLAGS = $(libgo_ldflags)
920 libgo_la_LIBADD = $(libgo_libadd)
922 libgo_llgo_la_SOURCES = $(runtime_files)
923 libgo_llgo_la_LDFLAGS = $(libgo_ldflags)
924 libgo_llgo_la_LIBADD = $(libgo_libadd)
926 libgobegin_a_SOURCES = \
927         runtime/go-main.c
929 libgobegin_llgo_a_SOURCES = \
930         runtime/go-main.c
932 # Use -fPIC for libgobegin so that it can be put in a PIE.
933 libgobegin_a_CFLAGS = $(AM_CFLAGS) -fPIC
934 libgobegin_llgo_a_CFLAGS = $(AM_CFLAGS) -fPIC
936 libgolibbegin_a_SOURCES = \
937         runtime/go-libmain.c
939 libgolibbegin_a_CFLAGS = $(AM_CFLAGS) -fPIC
941 GOTOOL_PACKAGES = \
942         cmd/go/internal/base \
943         cmd/go/internal/bug \
944         cmd/go/internal/cache \
945         cmd/go/internal/cfg \
946         cmd/go/internal/clean \
947         cmd/go/internal/cmdflag \
948         cmd/go/internal/doc \
949         cmd/go/internal/envcmd \
950         cmd/go/internal/fix \
951         cmd/go/internal/fmtcmd \
952         cmd/go/internal/generate \
953         cmd/go/internal/get \
954         cmd/go/internal/help \
955         cmd/go/internal/list \
956         cmd/go/internal/load \
957         cmd/go/internal/run \
958         cmd/go/internal/str \
959         cmd/go/internal/test \
960         cmd/go/internal/tool \
961         cmd/go/internal/version \
962         cmd/go/internal/vet \
963         cmd/go/internal/web \
964         cmd/go/internal/work \
965         cmd/internal/browser \
966         cmd/internal/buildid \
967         cmd/internal/edit \
968         cmd/internal/objabi \
969         cmd/internal/test2json \
970         cmd/vet/internal/cfg \
971         cmd/vet/internal/whitelist
973 libgotool_a_SOURCES =
974 libgotool_a_DEPENDENCIES = $(addsuffix .lo,$(GOTOOL_PACKAGES))
975 libgotool_a_LIBADD = $(addsuffix .o,$(GOTOOL_PACKAGES))
977 define STATIC_template
978 $(subst -,_,$(subst .,_,$(subst /,_,$(1))))_GOCFLAGS = -static
979 endef
981 $(foreach package,$(GOTOOL_PACKAGES),$(eval $(call STATIC_template,$(package).lo)))
983 # Make sure runtime.inc is built before compiling any .c file.
984 $(libgo_la_OBJECTS): runtime.inc
985 $(libgo_llgo_la_OBJECTS): runtime.inc
986 $(libgobegin_a_OBJECTS): runtime.inc
987 $(libgobegin_llgo_a_OBJECTS): runtime.inc
988 $(libgolibbegin_a_OBJECTS): runtime.inc
990 LTLDFLAGS = $(shell $(SHELL) $(top_srcdir)/../libtool-ldflags $(LDFLAGS))
992 GOCFLAGS = $(CFLAGS)
993 AM_GOCFLAGS = $(STRINGOPS_FLAG) $(GO_SPLIT_STACK)
994 GOCOMPILE = $(GOC) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_GOCFLAGS) $(GOCFLAGS)
996 LTGOCOMPILE = $(LIBTOOL) --tag GO --mode=compile $(GOC) $(INCLUDES) \
997         $(AM_GOCFLAGS) $(GOCFLAGS)
999 GOLINK = $(LIBTOOL) --tag GO --mode-link $(GOC) \
1000         $(OPT_LDFLAGS) $(SECTION_LDFLAGS) $(AM_GOCFLAGS) $(LTLDFLAGS) -o $@
1002 # Build the dependencies for a Go package.
1003 BUILDDEPS = \
1004         $(MKDIR_P) $(@D); \
1005         dir=`echo $@ | sed -e 's/.lo.dep$$//'`; \
1006         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,,$@)))`; \
1007         $(SHELL) $(srcdir)/godeps.sh `echo $@ | sed -e 's/.dep$$//'` $$files > $@.tmp; \
1008         if ! cmp $@.tmp $@ >/dev/null 2>/dev/null; then \
1009           rm -f `echo $@ | sed -e 's/\.dep$$//'`; \
1010         fi; \
1011         mv -f $@.tmp $@
1013 # Build the .go files for a package, generating a .lo file.
1014 BUILDPACKAGE = \
1015         $(MKDIR_P) $(@D); \
1016         files=`echo $^ | sed -e 's/[^ ]*\.gox//g' -e 's/[^ ]*\.dep//'`; \
1017         $(LTGOCOMPILE) -I . -c -fgo-pkgpath=`echo $@ | sed -e 's/.lo$$//' -e 's|golang_org|vendor/golang_org|'` $($(subst -,_,$(subst .,_,$(subst /,_,$@)))_GOCFLAGS) -o $@ $$files
1019 # How to build a .gox file from a .lo file.
1020 # Matching .o file can either be in the same directory as the .lo (non-PIC
1021 # object) or in the .libs directory (PIC object).
1022 BUILDGOX = \
1023         f="$(basename $<).o"; \
1024         if test ! -f $$f; then \
1025           f="$(basename $(<D)/.libs/$(<F)).o"; \
1026         fi; \
1027         $(OBJCOPY) -j .go_export $$f $@.tmp; \
1028         $(SHELL) $(srcdir)/mvifdiff.sh $@.tmp `echo $@ | sed -e 's/s-gox/gox/'`
1030 GOTESTFLAGS =
1031 GOBENCH = 
1033 # Check a package.
1034 CHECK = \
1035         GC="$(GOC) $(GOCFLAGS) $($(subst /,_,$@)_GOCFLAGS) -L `${PWD_COMMAND}` -L `${PWD_COMMAND}`/.libs"; \
1036         export GC; \
1037         GOLIBS="$(extra_check_libs_$(subst /,_,$(@D))) $(MATH_LIBS) $(NET_LIBS) $(LIBS)"; \
1038         export GOLIBS; \
1039         RUNTESTFLAGS="$(RUNTESTFLAGS)"; \
1040         export RUNTESTFLAGS; \
1041         MAKE="$(MAKE)"; \
1042         export MAKE; \
1043         NM="$(NM)"; \
1044         export NM; \
1045         libgccdir=`${GOC} ${GOCFLAGS} -print-libgcc-file-name | sed -e 's|/[^/]*$$||'`; \
1046         LD_LIBRARY_PATH="`${PWD_COMMAND}`/.libs:$${libgccdir}:${LD_LIBRARY_PATH}"; \
1047         LD_LIBRARY_PATH=`echo $${LD_LIBRARY_PATH} | sed 's,::*,:,g;s,^:*,,;s,:*$$,,'`; \
1048         export LD_LIBRARY_PATH; \
1049         $(MKDIR_P) $(@D); \
1050         rm -f $@-testsum $@-testlog; \
1051         files=`$(SHELL) $(srcdir)/match.sh --goarch=$(GOARCH) --goos=$(GOOS) --srcdir=$(srcdir)/go/$(@D) --extrafiles="$(extra_go_files_$(subst /,_,$(@D)))" $(matchargs_$(subst /,_,$(@D)))`; \
1052         if test "$(USE_DEJAGNU)" = "yes"; then \
1053           $(SHELL) $(srcdir)/testsuite/gotest --goarch=$(GOARCH) --goos=$(GOOS) --dejagnu=yes --basedir=$(srcdir) --srcdir=$(srcdir)/go/$(@D) --pkgpath="$(@D)" --pkgfiles="$$files" --testname="$(@D)" $(GOTESTFLAGS); \
1054         elif test "$(GOBENCH)" != ""; then \
1055           $(SHELL) $(srcdir)/testsuite/gotest --goarch=$(GOARCH) --goos=$(GOOS) --basedir=$(srcdir) --srcdir=$(srcdir)/go/$(@D) --pkgpath="$(@D)" --pkgfiles="$$files" --bench="$(GOBENCH)" $(GOTESTFLAGS); \
1056         else \
1057           if $(SHELL) $(srcdir)/testsuite/gotest --goarch=$(GOARCH) --goos=$(GOOS) --basedir=$(srcdir) --srcdir=$(srcdir)/go/$(@D) --pkgpath="$(@D)" --pkgfiles="$$files" $(GOTESTFLAGS) >>$@-testlog 2>&1; then \
1058             echo "PASS: $(@D)" >> $@-testlog; \
1059             echo "PASS: $(@D)"; \
1060             echo "PASS: $(@D)" > $@-testsum; \
1061           else \
1062             echo "FAIL: $(@D)" >> $@-testlog; \
1063             cat $@-testlog; \
1064             echo "FAIL: $(@D)" > $@-testsum; \
1065             exit 1; \
1066           fi; \
1067         fi
1069 # Build all packages before checking any.
1070 CHECK_DEPS = \
1071         $(toolexeclibgo_DATA) \
1072         $(toolexeclibgoarchive_DATA) \
1073         $(toolexeclibgocompress_DATA) \
1074         $(toolexeclibgocontainer_DATA) \
1075         $(toolexeclibgocrypto_DATA) \
1076         $(toolexeclibgodebug_DATA) \
1077         $(toolexeclibgoencoding_DATA) \
1078         $(toolexeclibgogo_DATA) \
1079         $(toolexeclibgohash_DATA) \
1080         $(toolexeclibgoimage_DATA) \
1081         $(toolexeclibgoindex_DATA) \
1082         $(toolexeclibgoio_DATA) \
1083         $(toolexeclibgolog_DATA) \
1084         $(toolexeclibgomath_DATA) \
1085         $(toolexeclibgomime_DATA) \
1086         $(toolexeclibgonet_DATA) \
1087         $(toolexeclibgonethttp_DATA) \
1088         $(toolexeclibgoos_DATA) \
1089         $(toolexeclibgopath_DATA) \
1090         $(toolexeclibgorpc_DATA) \
1091         $(toolexeclibgoruntime_DATA) \
1092         $(toolexeclibgosync_DATA) \
1093         $(toolexeclibgotesting_DATA) \
1094         $(toolexeclibgotext_DATA) \
1095         $(toolexeclibgotexttemplate_DATA) \
1096         $(toolexeclibgounicode_DATA) \
1097         $(noinst_LIBRARIES)
1099 if GOC_IS_LLGO
1100 CHECK_DEPS += libgo-llgo.la libgobegin-llgo.a
1101 else
1102 CHECK_DEPS += libgo.la libgobegin.a
1103 endif
1105 # PACKAGE_template defines the rules for each package.
1106 # For example, for the package bufio, it produces:
1108 # @go_include@ bufio.lo.dep
1109 # bufio.lo.dep: $(srcdir)/go/bufio/*.go
1110 #       $(BUILDDEPS)
1111 # bufio.lo:
1112 #       $(BUILDPACKAGE)
1113 # bufio/check: $(CHECK_DEPS)
1114 #       @$(CHECK)
1115 # .PHONY: bufio/check
1117 # This is invoked with $(1) set to a package, which is a directory name,
1118 # such as "bufio" or "archive/tar".
1119 define PACKAGE_template
1120 @go_include@ $(1).lo.dep
1121 $(1).lo.dep: $(srcdir)/go/$(1)/*.go
1122         $$(BUILDDEPS)
1123 $(1).lo:
1124         $$(BUILDPACKAGE)
1125 $(1)/check: $$(CHECK_DEPS)
1126         @$$(CHECK)
1127 .PHONY: $(1)/check
1128 $(1).gox: $(1).s-gox; @true
1129 $(1).s-gox: $(1).lo
1130         $$(BUILDGOX)
1131         $$(STAMP) $$@
1132 endef
1134 # This line expands PACKAGE_template once for each package name listed
1135 # in $(PACKAGES).
1136 $(foreach package,$(PACKAGES),$(eval $(call PACKAGE_template,$(package))))
1137 $(foreach package,$(GOTOOL_PACKAGES),$(eval $(call PACKAGE_template,$(package))))
1139 # Pass -ffp-contract=off, or 386-specific options, when building the
1140 # math package.  MATH_FLAG is defined in configure.ac.
1141 math_lo_GOCFLAGS = $(MATH_FLAG)
1142 math_check_GOCFLAGS = $(MATH_FLAG)
1144 # Add the generated file runtime_sysinfo.go to the runtime package.
1145 extra_go_files_runtime = runtime_sysinfo.go sigtab.go
1146 runtime.lo.dep: $(extra_go_files_runtime)
1148 # Add generated files to the syscall package.
1149 extra_go_files_syscall = \
1150         libcalls.go \
1151         sysinfo.go \
1152         syscall_arch.go \
1153         $(syscall_epoll_file)
1154 syscall.lo.dep: $(extra_go_files_syscall)
1156 # Pass -fgo-compiling-runtime when compiling the runtime package.
1157 runtime_lo_GOCFLAGS = -fgo-c-header=runtime.inc.tmp -fgo-compiling-runtime
1158 runtime_check_GOCFLAGS = -fgo-compiling-runtime
1159 runtime_internal_atomic_lo_GOCFLAGS = -fgo-compiling-runtime
1160 runtime_internal_atomic_lo_check_GOCFLAGS = -fgo-compiling-runtime
1161 runtime_internal_sys_lo_GOCFLAGS = -fgo-compiling-runtime
1162 runtime_internal_sys_lo_check_GOCFLAGS = -fgo-compiling-runtime
1164 # If libffi is supported (the normal case) use the ffi build tag for
1165 # the runtime package.
1166 if USE_LIBFFI
1167 matchargs_runtime = --tag=libffi
1168 else
1169 matchargs_runtime =
1170 endif
1172 # At least for now, we need -static-libgo for this test, because
1173 # otherwise we can't get the line numbers.
1174 # Also use -fno-inline to get better results from the memory profiler.
1175 runtime_pprof_check_GOCFLAGS = -static-libgo -fno-inline
1177 extra_go_files_runtime_internal_sys = version.go
1178 runtime/internal/sys.lo.dep: $(extra_go_files_runtime_internal_sys)
1180 extra_go_files_go_types = gccgosizes.go
1181 go/types.lo.dep: $(extra_go_files_go_types)
1183 extra_go_files_cmd_internal_objabi = objabi.go
1184 cmd/internal/objabi.lo.dep: $(extra_go_files_cmd_internal_objabi)
1186 extra_go_files_cmd_go_internal_cfg = zdefaultcc.go
1187 cmd/go/internal/cfg.lo.dep: $(extra_go_files_cmd_go_internal_cfg)
1189 extra_go_files_cmd_go_internal_load = zstdpkglist.go
1190 cmd/go/internal/load.lo.dep: $(extra_go_files_cmd_go_internal_load)
1192 extra_check_libs_cmd_go_internal_cache = $(abs_builddir)/libgotool.a
1193 extra_check_libs_cmd_go_internal_generate = $(abs_builddir)/libgotool.a
1194 extra_check_libs_cmd_go_internal_get = $(abs_builddir)/libgotool.a
1195 extra_check_libs_cmd_go_internal_load = $(abs_builddir)/libgotool.a
1196 extra_check_libs_cmd_go_internal_work = $(abs_builddir)/libgotool.a
1198 extra_check_libs_cmd_vet_internal_cfg = $(abs_builddir)/libgotool.a
1200 # FIXME: The following C files may as well move to the runtime
1201 # directory and be treated like other C files.
1203 # Use C code to speed up {bytes,strings}.IndexByte and friends.
1204 bytes/index.lo: go/bytes/indexbyte.c runtime.inc
1205         @$(MKDIR_P) bytes
1206         $(LTCOMPILE) -c -o $@ $(srcdir)/go/bytes/indexbyte.c
1207 strings/index.lo: go/strings/indexbyte.c runtime.inc
1208         @$(MKDIR_P) strings
1209         $(LTCOMPILE) -c -o $@ $(srcdir)/go/strings/indexbyte.c
1211 # Use a C function with a fixed number of arguments to call a C
1212 # varargs function.
1213 log/syslog/syslog_c.lo: go/log/syslog/syslog_c.c runtime.inc
1214         @$(MKDIR_P) log/syslog
1215         $(LTCOMPILE) -c -o $@ $(srcdir)/go/log/syslog/syslog_c.c
1217 # The interface to libffi from the reflect package is written in C.
1218 reflect/makefunc_ffi_c.lo: go/reflect/makefunc_ffi_c.c runtime.inc
1219         @$(MKDIR_P) reflect
1220         $(LTCOMPILE) -c -o $@ $(srcdir)/go/reflect/makefunc_ffi_c.c
1222 # The atomic functions are written in C.
1223 runtime/internal/atomic_c.lo: go/runtime/internal/atomic/atomic.c runtime.inc
1224         @$(MKDIR_P) runtime/internal
1225         $(LTCOMPILE) -c -o $@ $(srcdir)/go/runtime/internal/atomic/atomic.c
1226 sync/atomic_c.lo: go/sync/atomic/atomic.c runtime.inc
1227         @$(MKDIR_P) sync
1228         $(LTCOMPILE) -c -o $@ $(srcdir)/go/sync/atomic/atomic.c
1230 # A few syscall functions are written in C.
1231 syscall/clone_linux.lo: go/syscall/clone_linux.c runtime.inc
1232         @$(MKDIR_P) syscall
1233         $(LTCOMPILE) -c -o $@ $(srcdir)/go/syscall/clone_linux.c
1234 syscall/errno.lo: go/syscall/errno.c runtime.inc
1235         @$(MKDIR_P) syscall
1236         $(LTCOMPILE) -c -o $@ $(srcdir)/go/syscall/errno.c
1237 syscall/signame.lo: go/syscall/signame.c runtime.inc
1238         @$(MKDIR_P) syscall
1239         $(LTCOMPILE) -c -o $@ $(srcdir)/go/syscall/signame.c
1240 syscall/wait.lo: go/syscall/wait.c runtime.inc
1241         @$(MKDIR_P) syscall
1242         $(LTCOMPILE) -c -o $@ $(srcdir)/go/syscall/wait.c
1244 # Solaris 11.4 changed the type of fields in struct stat.
1245 # Use a build tag, based on a configure check, to cope.
1246 if LIBGO_IS_SOLARIS
1247 if HAVE_STAT_TIMESPEC
1248 matchargs_os = --tag=solaristag
1249 else
1250 matchargs_os =
1251 endif
1252 else
1253 matchargs_os =
1254 endif
1256 if LIBGO_IS_BSD
1258 # Build golang_org/x/net/route only on BSD systems.
1260 $(eval $(call PACKAGE_template,golang_org/x/net/route))
1262 golang_org_x_net_route_lo = \
1263         golang_org/x/net/route.lo
1264 golang_org_x_net_route_check = \
1265         golang_org/x/net/route/check
1267 endif
1269 if LIBGO_IS_SOLARIS
1271 # Build golang_org/x/net/lif only on Solaris systems.
1273 $(eval $(call PACKAGE_template,golang_org/x/net/lif))
1275 golang_org_x_net_lif_lo = \
1276         golang_org/x/net/lif.lo
1277 golang_org_x_net_lif_check = \
1278         golang_org/x/net/lif/check
1280 endif
1282 TEST_PACKAGES = \
1283         bufio/check \
1284         bytes/check \
1285         context/check \
1286         crypto/check \
1287         errors/check \
1288         expvar/check \
1289         flag/check \
1290         fmt/check \
1291         hash/check \
1292         html/check \
1293         image/check \
1294         io/check \
1295         log/check \
1296         math/check \
1297         mime/check \
1298         net/check \
1299         os/check \
1300         path/check \
1301         reflect/check \
1302         regexp/check \
1303         runtime/check \
1304         sort/check \
1305         strconv/check \
1306         strings/check \
1307         sync/check \
1308         syscall/check \
1309         time/check \
1310         unicode/check \
1311         archive/tar/check \
1312         archive/zip/check \
1313         cmd/go/internal/cache/check \
1314         cmd/go/internal/generate/check \
1315         cmd/go/internal/get/check \
1316         cmd/go/internal/load/check \
1317         cmd/go/internal/work/check \
1318         cmd/internal/buildid/check \
1319         cmd/internal/edit/check \
1320         cmd/internal/objabi/check \
1321         cmd/internal/test2json/check \
1322         cmd/vet/internal/cfg/check \
1323         compress/bzip2/check \
1324         compress/flate/check \
1325         compress/gzip/check \
1326         compress/lzw/check \
1327         compress/zlib/check \
1328         container/heap/check \
1329         container/list/check \
1330         container/ring/check \
1331         crypto/aes/check \
1332         crypto/cipher/check \
1333         crypto/des/check \
1334         crypto/dsa/check \
1335         crypto/ecdsa/check \
1336         crypto/elliptic/check \
1337         crypto/hmac/check \
1338         crypto/md5/check \
1339         crypto/rand/check \
1340         crypto/rc4/check \
1341         crypto/rsa/check \
1342         crypto/sha1/check \
1343         crypto/sha256/check \
1344         crypto/sha512/check \
1345         crypto/subtle/check \
1346         crypto/tls/check \
1347         crypto/x509/check \
1348         database/sql/check \
1349         database/sql/driver/check \
1350         debug/dwarf/check \
1351         debug/elf/check \
1352         debug/macho/check \
1353         debug/pe/check \
1354         debug/plan9obj/check \
1355         debug/xcoff/check \
1356         encoding/ascii85/check \
1357         encoding/asn1/check \
1358         encoding/base32/check \
1359         encoding/base64/check \
1360         encoding/binary/check \
1361         encoding/csv/check \
1362         encoding/gob/check \
1363         encoding/hex/check \
1364         encoding/json/check \
1365         encoding/pem/check \
1366         encoding/xml/check \
1367         html/template/check \
1368         go/ast/check \
1369         go/build/check \
1370         go/constant/check \
1371         go/doc/check \
1372         go/format/check \
1373         go/importer/check \
1374         go/internal/gcimporter/check \
1375         go/internal/gccgoimporter/check \
1376         go/internal/srcimporter/check \
1377         go/parser/check \
1378         go/printer/check \
1379         go/scanner/check \
1380         go/token/check \
1381         go/types/check \
1382         golang_org/x/crypto/chacha20poly1305/check \
1383         golang_org/x/crypto/chacha20poly1305/internal/chacha20/check \
1384         golang_org/x/crypto/cryptobyte/check \
1385         golang_org/x/crypto/curve25519/check \
1386         golang_org/x/crypto/poly1305/check \
1387         golang_org/x/net/http2/hpack/check \
1388         golang_org/x/net/idna/check \
1389         golang_org/x/net/lex/httplex/check \
1390         $(golang_org_x_net_lif_check) \
1391         golang_org/x/net/proxy/check \
1392         $(golang_org_x_net_route_check) \
1393         hash/adler32/check \
1394         hash/crc32/check \
1395         hash/crc64/check \
1396         hash/fnv/check \
1397         image/color/check \
1398         image/draw/check \
1399         image/jpeg/check \
1400         image/png/check \
1401         index/suffixarray/check \
1402         internal/poll/check \
1403         internal/singleflight/check \
1404         internal/trace/check \
1405         io/ioutil/check \
1406         log/syslog/check \
1407         math/big/check \
1408         math/bits/check \
1409         math/cmplx/check \
1410         math/rand/check \
1411         mime/multipart/check \
1412         mime/quotedprintable/check \
1413         net/http/check \
1414         net/http/cgi/check \
1415         net/http/cookiejar/check \
1416         net/http/fcgi/check \
1417         net/http/httptest/check \
1418         net/http/httptrace/check \
1419         net/http/httputil/check \
1420         net/http/internal/check \
1421         net/internal/socktest/check \
1422         net/mail/check \
1423         net/rpc/check \
1424         net/smtp/check \
1425         net/textproto/check \
1426         net/url/check \
1427         net/rpc/jsonrpc/check \
1428         os/exec/check \
1429         os/signal/check \
1430         os/user/check \
1431         path/filepath/check \
1432         regexp/syntax/check \
1433         runtime/debug/check \
1434         runtime/internal/atomic/check \
1435         runtime/internal/sys/check \
1436         runtime/pprof/check \
1437         runtime/pprof/internal/profile/check \
1438         runtime/trace/check \
1439         sync/atomic/check \
1440         text/scanner/check \
1441         text/tabwriter/check \
1442         text/template/check \
1443         text/template/parse/check \
1444         testing/quick/check \
1445         unicode/utf16/check \
1446         unicode/utf8/check
1448 check: check-tail
1449 check-recursive: check-head
1451 check-head:
1452         @echo "Test Run By $${USER} on `date`" > libgo.head
1453         @echo "Native configuration is $(host_triplet)" >> libgo.head
1454         @echo >> libgo.head
1455         @echo "         === libgo tests ===" >> libgo.head
1456         @echo >> libgo.head
1458 check-tail: check-recursive check-multi
1459         @if test "$(USE_DEJAGNU)" = "yes"; then \
1460           exit 0; \
1461         fi; \
1462         lib=`${PWD_COMMAND} | sed -e 's,^.*/\([^/][^/]*\)$$,\1,'`; \
1463         for dir in . $(MULTIDIRS); do \
1464           mv ../$${dir}/$${lib}/libgo.sum ../$${dir}/$${lib}/libgo.sum.sep; \
1465           mv ../$${dir}/$${lib}/libgo.log ../$${dir}/$${lib}/libgo.log.sep; \
1466         done; \
1467         mv libgo.head libgo.sum; \
1468         cp libgo.sum libgo.log; \
1469         echo "Schedule of variations:" >> libgo.sum; \
1470         for dir in . $(MULTIDIRS); do \
1471           multidir=../$${dir}/$${lib}; \
1472           multivar=`cat $${multidir}/libgo.var`; \
1473           echo "    $${multivar}" >> libgo.sum; \
1474         done; \
1475         echo >> libgo.sum; \
1476         pass=0; fail=0; untested=0; \
1477         for dir in . $(MULTIDIRS); do \
1478           multidir=../$${dir}/$${lib}; \
1479           multivar=`cat $${multidir}/libgo.var`; \
1480           echo "Running target $${multivar}" >> libgo.sum; \
1481           echo "Running $(srcdir)/libgo.exp ..." >> libgo.sum; \
1482           cat $${multidir}/libgo.sum.sep >> libgo.sum; \
1483           cat $${multidir}/libgo.log.sep >> libgo.log; \
1484           if test -n "${MULTIDIRS}"; then \
1485             echo "              === libgo Summary for $${multivar} ===" >> libgo.sum; \
1486             echo >> libgo.sum; \
1487           fi; \
1488           p=`grep -c PASS $${multidir}/libgo.sum.sep`; \
1489           pass=`expr $$pass + $$p`; \
1490           if test "$$p" -ne "0" && test -n "${MULTIDIRS}"; then \
1491             echo "# of expected passes          $$p" >> libgo.sum; \
1492           fi; \
1493           p=`grep -c FAIL $${multidir}/libgo.sum.sep`; \
1494           fail=`expr $$fail + $$p`; \
1495           if test "$$p" -ne "0" && test -n "${MULTIDIRS}"; then \
1496             echo "# of unexpected failures      $$p" >> libgo.sum; \
1497           fi; \
1498           p=`grep -c UNTESTED $${multidir}/libgo.sum.sep`; \
1499           untested=`expr $$untested + $$p`; \
1500           if test "$$p" -ne "0" && test -n "${MULTIDIRS}"; then \
1501             echo "# of untested testcases               $$p" >> libgo.sum; \
1502           fi; \
1503         done; \
1504         echo >> libgo.sum; \
1505         echo "          === libgo Summary ===" >> libgo.sum; \
1506         echo >> libgo.sum; \
1507         if test "$$pass" -ne "0"; then \
1508           echo "# of expected passes            $$pass" >> libgo.sum; \
1509         fi; \
1510         if test "$$fail" -ne "0"; then \
1511           echo "# of unexpected failures        $$fail" >> libgo.sum; \
1512         fi; \
1513         if test "$$untested" -ne "0"; then \
1514           echo "# of untested testcases         $$untested" >> libgo.sum; \
1515         fi; \
1516         echo `echo $(GOC) | sed -e 's/ .*//'`  `$(GOC) -v 2>&1 | grep " version" | sed -n -e 's/.* \(version.*$$\)/\1/p'` >> libgo.sum; \
1517         echo >> libgo.log; \
1518         echo "runtest completed at `date`" >> libgo.log; \
1519         if test "$$fail" -ne "0"; then \
1520           status=1; \
1521         else \
1522           status=0; \
1523         fi; \
1524         exit $$status
1526 check-am:
1527         @rm -f libgo.sum libgo.log libgo.tail
1528         @multivar="unix"; \
1529         [ -z "$(MULTIFLAGS)" ] || multivar="$${multivar}/$(MULTIFLAGS)"; \
1530         echo "$${multivar}" > libgo.var
1531         @for f in $(TEST_PACKAGES); do \
1532            rm -f $$f-testsum $$f-testlog; \
1533          done
1534         -@$(MAKE) $(AM_MAKEFLAGS) -k $(TEST_PACKAGES)
1535         @for f in $(TEST_PACKAGES); do \
1536           if test -f $$f-testsum; then \
1537             cat $$f-testsum >> libgo.sum; \
1538           fi; \
1539           if test -f $$f-testlog; then \
1540             cat $$f-testlog >> libgo.log; \
1541           fi; \
1542         done
1544 check-multi:
1545         $(MULTIDO) $(AM_MAKEFLAGS) DO=check-am multi-do # $(MAKE)
1547 bench:
1548         -@$(MAKE) $(AM_MAKEFLAGS) -k $(TEST_PACKAGES) GOBENCH=.
1550 MOSTLYCLEANFILES = \
1551         s-runtime_sysinfo s-sigtab s-runtime-inc s-zstdpkglist \
1552         s-libcalls s-libcalls-list s-syscall_arch s-gen-sysinfo s-sysinfo \
1553         s-errno s-epoll \
1554         libgo.head libgo.sum.sep libgo.log.sep libgo.var \
1555         libcalls-list runtime.inc runtime.inc.tmp2 runtime.inc.tmp3
1557 mostlyclean-local:
1558         find . -name '*.lo' -print | xargs $(LIBTOOL) --mode=clean rm -f
1559         find . -name '*.$(OBJEXT)' -print | xargs rm -f
1560         find . -name '*-testsum' -print | xargs rm -f
1561         find . -name '*-testlog' -print | xargs rm -f
1563 CLEANFILES = *.go *.c s-* libgo.sum libgo.log runtime.inc
1565 clean-local:
1566         find . -name '*.la' -print | xargs $(LIBTOOL) --mode=clean rm -f
1567         find . -name '*.a' -print | xargs rm -f
1568         find . -name '*.gox' -print | xargs rm -f
1569         find . -name '*.s-gox' -print | xargs rm -f
1571 distclean-local:
1572         find . -name '*.lo.dep' -print | xargs rm -f