Fix "PR c++/92804 ICE trying to use concept as a nested-name-specifier"
[official-gcc.git] / libgo / Makefile.am
blob56d38f57e7d1a69f0e8fd58334bd440a9a28c8ea
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 if LIBGO_IS_DARWIN
17 GO_EXPORT_SECTION_NAME = __GNU_GO.__go_export
18 else
19 GO_EXPORT_SECTION_NAME = .go_export
20 endif
22 SUBDIRS = ${subdirs}
24 gcc_version := $(shell $(GOC) -dumpversion)
26 MAINT_CHARSET = latin1
28 mkinstalldirs = $(SHELL) $(toplevel_srcdir)/mkinstalldirs
29 PWD_COMMAND = $${PWDCMD-pwd}
30 STAMP = echo timestamp >
32 toolexecdir = $(glibgo_toolexecdir)
33 toolexeclibdir = $(glibgo_toolexeclibdir)
34 toolexeclibgodir = $(nover_glibgo_toolexeclibdir)/go/$(gcc_version)/$(target_alias)
35 libexecsubdir = $(libexecdir)/gcc/$(target_alias)/$(gcc_version)
37 LIBFFI = @LIBFFI@
38 LIBFFIINCS = @LIBFFIINCS@
40 LIBATOMIC = @LIBATOMIC@
42 WARN_CFLAGS = $(WARN_FLAGS) $(WERROR)
44 # -I/-D flags to pass when compiling.
45 AM_CPPFLAGS = -I $(srcdir)/runtime $(LIBFFIINCS) $(PTHREAD_CFLAGS)
47 ACLOCAL_AMFLAGS = -I ./config -I ../config
49 AM_CFLAGS = -fexceptions -fnon-call-exceptions \
50         $(SPLIT_STACK) $(WARN_CFLAGS) \
51         $(STRINGOPS_FLAG) $(HWCAP_CFLAGS) $(OSCFLAGS) \
52         -I $(srcdir)/../libgcc -I $(srcdir)/../libbacktrace \
53         -I $(MULTIBUILDTOP)../../gcc/include
55 AM_LDFLAGS =
57 if USING_SPLIT_STACK
58 AM_LDFLAGS += -XCClinker $(SPLIT_STACK)
59 endif
61 if LIBGO_IS_AIX
62 # Using an import file for libgo avoid requiring to use the -brtl flag
63 # when builing a go program
64 AM_LDFLAGS += -Wl,-bbigtoc -Wl,-bI:$(srcdir)/libgo.imp
65 EXTRA_libgo_la_DEPENDENCIES = libgo.imp
66 endif
68 # Multilib support.
69 MAKEOVERRIDES=
71 # Work around what appears to be a GNU make  handling MAKEFLAGS
72 # values defined in terms of make variables, as is the case for CC and
73 # friends when we are called from the top level Makefile.
74 AM_MAKEFLAGS = \
75         "AR_FLAGS=$(AR_FLAGS)" \
76         "CC_FOR_BUILD=$(CC_FOR_BUILD)" \
77         "CC_FOR_TARGET=$(CC_FOR_TARGET)" \
78         "CFLAGS=$(CFLAGS)" \
79         "CXXFLAGS=$(CXXFLAGS)" \
80         "CFLAGS_FOR_BUILD=$(CFLAGS_FOR_BUILD)" \
81         "CFLAGS_FOR_TARGET=$(CFLAGS_FOR_TARGET)" \
82         "GOC_FOR_TARGET=$(GOC_FOR_TARGET)" \
83         "GOC=$(GOC)" \
84         "GOCFLAGS=$(GOCFLAGS)" \
85         "INSTALL=$(INSTALL)" \
86         "INSTALL_DATA=$(INSTALL_DATA)" \
87         "INSTALL_PROGRAM=$(INSTALL_PROGRAM)" \
88         "INSTALL_SCRIPT=$(INSTALL_SCRIPT)" \
89         "LDFLAGS=$(LDFLAGS)" \
90         "LIBCFLAGS=$(LIBCFLAGS)" \
91         "LIBCFLAGS_FOR_TARGET=$(LIBCFLAGS_FOR_TARGET)" \
92         "MAKE=$(MAKE)" \
93         "MAKEINFO=$(MAKEINFO) $(MAKEINFOFLAGS)" \
94         "PICFLAG=$(PICFLAG)" \
95         "PICFLAG_FOR_TARGET=$(PICFLAG_FOR_TARGET)" \
96         "SHELL=$(SHELL)" \
97         "RUNTESTFLAGS=$(RUNTESTFLAGS)" \
98         "exec_prefix=$(exec_prefix)" \
99         "infodir=$(infodir)" \
100         "libdir=$(libdir)" \
101         "includedir=$(includedir)" \
102         "prefix=$(prefix)" \
103         "tooldir=$(tooldir)" \
104         "gxx_include_dir=$(gxx_include_dir)" \
105         "AR=$(AR)" \
106         "AS=$(AS)" \
107         "LD=$(LD)" \
108         "RANLIB=$(RANLIB)" \
109         "NM=$(NM)" \
110         "NM_FOR_BUILD=$(NM_FOR_BUILD)" \
111         "NM_FOR_TARGET=$(NM_FOR_TARGET)" \
112         "DESTDIR=$(DESTDIR)" \
113         "WERROR=$(WERROR)"
115 # Subdir rules rely on $(FLAGS_TO_PASS)
116 FLAGS_TO_PASS = $(AM_MAKEFLAGS)
118 if GOC_IS_LLGO
119 toolexeclib_LTLIBRARIES = libgo-llgo.la
120 toolexeclib_LIBRARIES = libgobegin-llgo.a
121 else
122 toolexeclib_LTLIBRARIES = libgo.la
123 toolexeclib_LIBRARIES = libgobegin.a libgolibbegin.a
124 endif
126 noinst_LIBRARIES = libgotool.a
128 toolexeclibgo_DATA = \
129         bufio.gox \
130         bytes.gox \
131         context.gox \
132         crypto.gox \
133         encoding.gox \
134         errors.gox \
135         expvar.gox \
136         flag.gox \
137         fmt.gox \
138         hash.gox \
139         html.gox \
140         image.gox \
141         io.gox \
142         log.gox \
143         math.gox \
144         mime.gox \
145         net.gox \
146         os.gox \
147         path.gox \
148         reflect.gox \
149         regexp.gox \
150         runtime.gox \
151         sort.gox \
152         strconv.gox \
153         strings.gox \
154         sync.gox \
155         syscall.gox \
156         testing.gox \
157         time.gox \
158         unicode.gox
160 toolexeclibgoarchivedir = $(toolexeclibgodir)/archive
162 toolexeclibgoarchive_DATA = \
163         archive/tar.gox \
164         archive/zip.gox
166 toolexeclibgocompressdir = $(toolexeclibgodir)/compress
168 toolexeclibgocompress_DATA = \
169         compress/bzip2.gox \
170         compress/flate.gox \
171         compress/gzip.gox \
172         compress/lzw.gox \
173         compress/zlib.gox
175 toolexeclibgocontainerdir = $(toolexeclibgodir)/container
177 toolexeclibgocontainer_DATA = \
178         container/heap.gox \
179         container/list.gox \
180         container/ring.gox
182 toolexeclibgocryptodir = $(toolexeclibgodir)/crypto
184 toolexeclibgocrypto_DATA = \
185         crypto/aes.gox \
186         crypto/cipher.gox \
187         crypto/des.gox \
188         crypto/dsa.gox \
189         crypto/ecdsa.gox \
190         crypto/ed25519.gox \
191         crypto/elliptic.gox \
192         crypto/hmac.gox \
193         crypto/md5.gox \
194         crypto/rand.gox \
195         crypto/rc4.gox \
196         crypto/rsa.gox \
197         crypto/sha1.gox \
198         crypto/sha256.gox \
199         crypto/sha512.gox \
200         crypto/subtle.gox \
201         crypto/tls.gox \
202         crypto/x509.gox
204 toolexeclibgocryptox509dir = $(toolexeclibgocryptodir)/x509
206 toolexeclibgocryptox509_DATA = \
207         crypto/x509/pkix.gox
209 toolexeclibgodatabasedir = $(toolexeclibgodir)/database
211 toolexeclibgodatabase_DATA = \
212         database/sql.gox
214 toolexeclibgodatabasesqldir = $(toolexeclibgodatabasedir)/sql
216 toolexeclibgodatabasesql_DATA = \
217         database/sql/driver.gox
219 toolexeclibgodebugdir = $(toolexeclibgodir)/debug
221 toolexeclibgodebug_DATA = \
222         debug/dwarf.gox \
223         debug/elf.gox \
224         debug/gosym.gox \
225         debug/macho.gox \
226         debug/pe.gox \
227         debug/plan9obj.gox
229 toolexeclibgoencodingdir = $(toolexeclibgodir)/encoding
231 toolexeclibgoencoding_DATA = \
232         encoding/ascii85.gox \
233         encoding/asn1.gox \
234         encoding/base32.gox \
235         encoding/base64.gox \
236         encoding/binary.gox \
237         encoding/csv.gox \
238         encoding/gob.gox \
239         encoding/hex.gox \
240         encoding/json.gox \
241         encoding/pem.gox \
242         encoding/xml.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 \
266         hash/maphash.gox
268 toolexeclibgohtmldir = $(toolexeclibgodir)/html
270 toolexeclibgohtml_DATA = \
271         html/template.gox
273 toolexeclibgoimagedir = $(toolexeclibgodir)/image
275 toolexeclibgoimage_DATA = \
276         image/color.gox \
277         image/draw.gox \
278         image/gif.gox \
279         image/jpeg.gox \
280         image/png.gox
282 toolexeclibgoimagecolordir = $(toolexeclibgoimagedir)/color
284 toolexeclibgoimagecolor_DATA = \
285         image/color/palette.gox
287 toolexeclibgoindexdir = $(toolexeclibgodir)/index
289 toolexeclibgoindex_DATA = \
290         index/suffixarray.gox
292 toolexeclibgoiodir = $(toolexeclibgodir)/io
294 toolexeclibgoio_DATA = \
295         io/ioutil.gox
297 toolexeclibgologdir = $(toolexeclibgodir)/log
299 toolexeclibgolog_DATA = \
300         log/syslog.gox
302 toolexeclibgomathdir = $(toolexeclibgodir)/math
304 toolexeclibgomath_DATA = \
305         math/big.gox \
306         math/bits.gox \
307         math/cmplx.gox \
308         math/rand.gox
310 toolexeclibgomimedir = $(toolexeclibgodir)/mime
312 toolexeclibgomime_DATA = \
313         mime/multipart.gox \
314         mime/quotedprintable.gox
316 toolexeclibgonetdir = $(toolexeclibgodir)/net
318 toolexeclibgonet_DATA = \
319         net/http.gox \
320         net/mail.gox \
321         net/rpc.gox \
322         net/smtp.gox \
323         net/textproto.gox \
324         net/url.gox
326 toolexeclibgonethttpdir = $(toolexeclibgonetdir)/http
328 toolexeclibgonethttp_DATA = \
329         net/http/cgi.gox \
330         net/http/cookiejar.gox \
331         net/http/fcgi.gox \
332         net/http/httptest.gox \
333         net/http/httptrace.gox \
334         net/http/httputil.gox \
335         net/http/pprof.gox
337 toolexeclibgonetrpcdir = $(toolexeclibgonetdir)/rpc
339 toolexeclibgonetrpc_DATA = \
340         net/rpc/jsonrpc.gox
342 toolexeclibgoosdir = $(toolexeclibgodir)/os
344 toolexeclibgoos_DATA = \
345         os/exec.gox \
346         os/signal.gox \
347         os/user.gox
349 toolexeclibgopathdir = $(toolexeclibgodir)/path
351 toolexeclibgopath_DATA = \
352         path/filepath.gox
354 toolexeclibgoregexpdir = $(toolexeclibgodir)/regexp
356 toolexeclibgoregexp_DATA = \
357         regexp/syntax.gox
359 toolexeclibgoruntimedir = $(toolexeclibgodir)/runtime
361 toolexeclibgoruntime_DATA = \
362         runtime/debug.gox \
363         runtime/pprof.gox \
364         runtime/trace.gox
366 toolexeclibgosyncdir = $(toolexeclibgodir)/sync
368 toolexeclibgosync_DATA = \
369         sync/atomic.gox
371 toolexeclibgotestingdir = $(toolexeclibgodir)/testing
373 toolexeclibgotesting_DATA = \
374         testing/iotest.gox \
375         testing/quick.gox
377 toolexeclibgotestinginternaldir = $(toolexeclibgotestingdir)/internal
379 toolexeclibgotestinginternal_DATA = \
380         testing/internal/testdeps.gox
382 toolexeclibgotextdir = $(toolexeclibgodir)/text
384 toolexeclibgotext_DATA = \
385         text/scanner.gox \
386         text/tabwriter.gox \
387         text/template.gox
389 toolexeclibgotexttemplatedir = $(toolexeclibgotextdir)/template
391 toolexeclibgotexttemplate_DATA = \
392         text/template/parse.gox
394 toolexeclibgounicodedir = $(toolexeclibgodir)/unicode
396 toolexeclibgounicode_DATA = \
397         unicode/utf16.gox \
398         unicode/utf8.gox
400 # Some packages are only needed for tests, so unlike the other
401 # internal packages nothing will explicitly depend on them.
402 # Force them to be built.
403 noinst_DATA = \
404         golang.org/x/net/nettest.gox \
405         internal/cfg.gox \
406         internal/obscuretestdata.gox \
407         internal/testenv.gox \
408         internal/trace.gox \
409         net/internal/socktest.gox \
410         os/signal/internal/pty.gox \
411         runtime/pprof/internal/profile.gox
413 if LIBGO_IS_RTEMS
414 rtems_task_variable_add_file = runtime/rtems-task-variable-add.c
415 else
416 rtems_task_variable_add_file =
417 endif
419 runtime_context_asm_file =
420 if LIBGO_IS_X86
421 if LIBGO_IS_LINUX
422 runtime_context_asm_file += runtime/go-context.S
423 endif
424 endif
426 runtime_files = \
427         runtime/aeshash.c \
428         runtime/go-assert.c \
429         runtime/go-caller.c \
430         runtime/go-callers.c \
431         runtime/go-cdiv.c \
432         runtime/go-cgo.c \
433         runtime/go-construct-map.c \
434         runtime/go-ffi.c \
435         runtime/go-fieldtrack.c \
436         runtime/go-matherr.c \
437         runtime/go-memclr.c \
438         runtime/go-memequal.c \
439         runtime/go-nanotime.c \
440         runtime/go-now.c \
441         runtime/go-nosys.c \
442         runtime/go-reflect-call.c \
443         runtime/go-setenv.c \
444         runtime/go-signal.c \
445         runtime/go-unsafe-pointer.c \
446         runtime/go-unsetenv.c \
447         runtime/go-unwind.c \
448         runtime/go-varargs.c \
449         runtime/env_posix.c \
450         runtime/panic.c \
451         runtime/print.c \
452         runtime/proc.c \
453         runtime/runtime_c.c \
454         runtime/stack.c \
455         runtime/yield.c \
456         $(runtime_context_asm_file) \
457         $(rtems_task_variable_add_file)
459 version.go: s-version; @true
460 s-version: Makefile
461         rm -f version.go.tmp
462         echo "package sys" > version.go.tmp
463         echo 'func init() { DefaultGoroot = "$(prefix)" }' >> version.go.tmp
464         echo 'const TheVersion = "'`cat $(srcdir)/VERSION | sed 1q`' '`$(GOC) --version | sed 1q`'"' >> version.go.tmp
465         echo 'const Goexperiment = ``' >> version.go.tmp
466         echo 'const GOARCH = "'$(GOARCH)'"' >> version.go.tmp
467         echo 'const GOOS = "'$(GOOS)'"' >> version.go.tmp
468         echo 'const GccgoToolDir = "$(libexecsubdir)"' >> version.go.tmp
469         echo >> version.go.tmp
470         echo "type ArchFamilyType int" >> version.go.tmp
471         echo >> version.go.tmp
472         echo "const (" >> version.go.tmp
473         echo "  UNKNOWN ArchFamilyType = iota" >> version.go.tmp
474         for a in $(ALLGOARCHFAMILY); do \
475           echo "        $${a}" >> version.go.tmp; \
476         done
477         echo ")" >> version.go.tmp
478         echo >> version.go.tmp
479         for a in $(ALLGOARCH); do \
480           f=`echo $${a} | sed -e 's/\(.\).*/\1/' -e 'y/abcdefghijklmnopqrstuvwxyz/ABCDEFGHIJKLMNOPQRSTUVWXYZ/'`; \
481           n="$${f}`echo $${a} | sed -e 's/.//'`"; \
482           if test "$${a}" = "$(GOARCH)"; then \
483             echo "const Goarch$${n} = 1" >> version.go.tmp; \
484           else \
485             echo "const Goarch$${n} = 0" >> version.go.tmp; \
486           fi; \
487         done
488         echo >> version.go.tmp
489         echo "const (" >> version.go.tmp
490         echo "  ArchFamily = `$(SHELL) $(srcdir)/goarch.sh $(GOARCH) family`" >> version.go.tmp
491         echo "  BigEndian = `$(SHELL) $(srcdir)/goarch.sh $(GOARCH) bigendian`" >> version.go.tmp
492         echo "  CacheLineSize = `$(SHELL) $(srcdir)/goarch.sh $(GOARCH) cachelinesize`" >> version.go.tmp
493         echo "  DefaultPhysPageSize = `$(SHELL) $(srcdir)/goarch.sh $(GOARCH) defaultphyspagesize`" >> version.go.tmp
494         echo "  Int64Align = `$(SHELL) $(srcdir)/goarch.sh $(GOARCH) int64align`" >> version.go.tmp
495         echo "  MinFrameSize = `$(SHELL) $(srcdir)/goarch.sh $(GOARCH) minframesize`" >> version.go.tmp
496         echo "  PCQuantum = `$(SHELL) $(srcdir)/goarch.sh $(GOARCH) pcquantum`" >> version.go.tmp
497         echo ")" >> version.go.tmp
498         echo >> version.go.tmp
499         for a in $(ALLGOOS); 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}" = "$(GOOS)"; then \
503             echo "const Goos$${n} = 1" >> version.go.tmp; \
504           else \
505             echo "const Goos$${n} = 0" >> version.go.tmp; \
506           fi; \
507         done
508         echo >> version.go.tmp
509         echo "type Uintreg uintptr" >> version.go.tmp
510         $(SHELL) $(srcdir)/mvifdiff.sh version.go.tmp version.go
511         $(STAMP) $@
513 cpugen.go: s-cpu; @true
514 s-cpu: Makefile
515         rm -f cpugen.go.tmp
516         echo "package cpu" > cpugen.go.tmp
517         echo "const CacheLinePadSize = `$(SHELL) $(srcdir)/goarch.sh $(GOARCH) cachelinesize`" >> cpugen.go.tmp
518         echo "const FunctionDescriptors = $(FUNCTION_DESCRIPTORS)" >> cpugen.go.tmp
519         $(SHELL) $(srcdir)/mvifdiff.sh cpugen.go.tmp cpugen.go
520         $(STAMP) $@
522 gcpugen.go: s-gcpu; @true
523 s-gcpu: Makefile
524         rm -f gcpugen.go.tmp
525         echo "package cpu" > gcpugen.go.tmp
526         echo "const cacheLineSize = `$(SHELL) $(srcdir)/goarch.sh $(GOARCH) cachelinesize`" >> gcpugen.go.tmp
527         $(SHELL) $(srcdir)/mvifdiff.sh gcpugen.go.tmp gcpugen.go
528         $(STAMP) $@
530 objabi.go: s-objabi; @true
531 s-objabi: Makefile
532         rm -f objabi.go.tmp
533         echo "package objabi" > objabi.go.tmp
534         echo "import \"runtime\"" >> objabi.go.tmp
535         echo 'func defaultGOROOTValue() string { return `$(prefix)` }' >> objabi.go.tmp
536         echo 'const defaultGO386 = `sse2`' >> objabi.go.tmp
537         echo 'const defaultGOARM = `5`' >> objabi.go.tmp
538         echo 'const defaultGOMIPS = `hardfloat`' >> objabi.go.tmp
539         echo 'const defaultGOMIPS64 = `hardfloat`' >> objabi.go.tmp
540         echo 'const defaultGOPPC64 = `power8`' >> objabi.go.tmp
541         echo 'const defaultGOOS = runtime.GOOS' >> objabi.go.tmp
542         echo 'const defaultGOARCH = runtime.GOARCH' >> objabi.go.tmp
543         echo 'const defaultGO_EXTLINK_ENABLED = ``' >> objabi.go.tmp
544         echo 'const defaultGO_LDSO = ``' >> objabi.go.tmp
545         echo 'const version = `'`cat $(srcdir)/VERSION | sed 1q`' '`$(GOC) --version | sed 1q`'`' >> objabi.go.tmp
546         echo 'const stackGuardMultiplierDefault = 1' >> objabi.go.tmp
547         echo 'const goexperiment = ``' >> objabi.go.tmp
548         $(SHELL) $(srcdir)/mvifdiff.sh objabi.go.tmp objabi.go
549         $(STAMP) $@
551 gccgosizes.go: s-gccgosizes; @true
552 s-gccgosizes: Makefile goarch.sh
553         rm -f gccgosizes.go.tmp
554         echo "package types" > gccgosizes.go.tmp
555         echo >> gccgosizes.go.tmp
556         echo "var gccgoArchSizes = map[string]*StdSizes{" >> gccgosizes.go.tmp
557         for a in $(ALLGOARCH); do \
558           ptrsize=`$(SHELL) $(srcdir)/goarch.sh $$a ptrsize`; \
559           maxalign=`$(SHELL) $(srcdir)/goarch.sh $$a maxalign`; \
560           echo "        \"$$a\": {$${ptrsize}, $${maxalign}}," >> gccgosizes.go.tmp; \
561         done
562         echo "}" >> gccgosizes.go.tmp
563         $(SHELL) $(srcdir)/mvifdiff.sh gccgosizes.go.tmp gccgosizes.go
564         $(STAMP) $@
566 runtime_sysinfo.go: s-runtime_sysinfo; @true
567 s-runtime_sysinfo: $(srcdir)/mkrsysinfo.sh gen-sysinfo.go
568         GOARCH=$(GOARCH) GOOS=$(GOOS) $(SHELL) $(srcdir)/mkrsysinfo.sh
569         $(SHELL) $(srcdir)/mvifdiff.sh tmp-runtime_sysinfo.go runtime_sysinfo.go
570         $(STAMP) $@
572 sigtab.go: s-sigtab; @true
573 s-sigtab: $(srcdir)/mksigtab.sh gen-sysinfo.go
574         GOOS=$(GOOS) $(SHELL) $(srcdir)/mksigtab.sh > tmp-sigtab.go
575         $(SHELL) $(srcdir)/mvifdiff.sh tmp-sigtab.go sigtab.go
576         $(STAMP) $@
578 GCCGO_INSTALL_NAME := $(shell echo gccgo|sed '$(program_transform_name)')
579 GCC_INSTALL_NAME := $(shell echo gcc|sed '$(program_transform_name)')
580 GXX_INSTALL_NAME := $(shell echo g++|sed '$(program_transform_name)')
582 zdefaultcc.go: s-zdefaultcc; @true
583 s-zdefaultcc: Makefile
584         echo 'package cfg' > zdefaultcc.go.tmp
585         echo >> zdefaultcc.go.tmp
586         echo 'func DefaultGCCGO(goos, goarch string) string { return "$(bindir)/$(GCCGO_INSTALL_NAME)" }' >> zdefaultcc.go.tmp
587         echo 'func DefaultCC(goos, goarch string) string { return "$(GCC_INSTALL_NAME)" }' >> zdefaultcc.go.tmp
588         echo 'func DefaultCXX(goos, goarch string) string { return "$(GXX_INSTALL_NAME)" }' >> zdefaultcc.go.tmp
589         echo 'const DefaultPkgConfig = "pkg-config"' >> zdefaultcc.go.tmp
590         echo 'var OSArchSupportsCgo = map[string]bool{}' >> zdefaultcc.go.tmp
591         $(SHELL) $(srcdir)/../move-if-change zdefaultcc.go.tmp zdefaultcc.go
592         $(STAMP) $@ 
594 # Post-process runtime.inc.raw (raw output of -fgo-c-header option when
595 # compiling runtime) to prune out certain types that should not be
596 # exported back to C. See comments in mkruntimeinc.sh for more details.
597 runtime.inc: s-runtime-inc; @true
598 s-runtime-inc: runtime.lo mkruntimeinc.sh Makefile
599         $(SHELL) $(srcdir)/mkruntimeinc.sh
600         $(SHELL) $(srcdir)/mvifdiff.sh tmp-runtime.inc runtime.inc
601         $(STAMP) $@
603 noinst_DATA += zdefaultcc.go
605 # Generate the list of go std packages that were included in libgo
606 zstdpkglist.go: s-zstdpkglist; @true
607 s-zstdpkglist: Makefile
608         rm -f zstdpkglist.go.tmp
609         echo 'package goroot' > zstdpkglist.go.tmp
610         echo "" >> zstdpkglist.go.tmp
611         echo 'var stdpkg = map[string]bool{' >> zstdpkglist.go.tmp
612         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
613         echo '}' >> zstdpkglist.go.tmp
614         $(SHELL) $(srcdir)/mvifdiff.sh zstdpkglist.go.tmp zstdpkglist.go
615         $(STAMP) $@
617 if LIBGO_IS_LINUX
618 syscall_epoll_file = epoll.go
619 else
620 syscall_epoll_file =
621 endif
623 libcalls.go: s-libcalls; @true
624 s-libcalls: libcalls-list go/syscall/mksyscall.awk $(srcdir)/go/syscall/*.go
625         rm -f libcalls.go.tmp
626         $(AWK) -f $(srcdir)/go/syscall/mksyscall.awk `cat libcalls-list` > libcalls.go.tmp
627         $(SHELL) $(srcdir)/mvifdiff.sh libcalls.go.tmp libcalls.go
628         $(STAMP) $@
630 libcalls-list: s-libcalls-list; @true
631 s-libcalls-list: Makefile $(srcdir)/go/syscall/*.go
632         rm -f libcalls-list.tmp
633         $(SHELL) $(srcdir)/match.sh --goarch=$(GOARCH) --goos=$(GOOS) --srcdir=$(srcdir)/go/syscall $(matchargs_syscall) > libcalls-list.tmp
634         $(SHELL) $(srcdir)/mvifdiff.sh libcalls-list.tmp libcalls-list
635         $(STAMP) $@
637 syscall_arch.go: s-syscall_arch; @true
638 s-syscall_arch: Makefile
639         rm -f syscall_arch.go.tmp
640         echo "package syscall" > syscall_arch.go.tmp
641         echo 'const ARCH = "'$(GOARCH)'"' >> syscall_arch.go.tmp
642         echo 'const OS = "'$(GOOS)'"' >> syscall_arch.go.tmp
643         $(SHELL) $(srcdir)/mvifdiff.sh syscall_arch.go.tmp syscall_arch.go
644         $(STAMP) $@
646 SYSINFO_FLAGS = \
647         $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \
648         $(CPPFLAGS) $(OSCFLAGS) -O
650 gen-sysinfo.go: s-gen-sysinfo; @true
651 s-gen-sysinfo: $(srcdir)/sysinfo.c config.h
652         $(CC) $(SYSINFO_FLAGS) -fdump-go-spec=tmp-gen-sysinfo.go -std=gnu99 -S -o sysinfo.s $(srcdir)/sysinfo.c
653         rm -f sysinfo.s
654         $(SHELL) $(srcdir)/mvifdiff.sh tmp-gen-sysinfo.go gen-sysinfo.go
655         $(STAMP) $@
657 errno.i: s-errno; @true
658 s-errno:
659         echo '#include <errno.h>' | $(CC) $(SYSINFO_FLAGS) -x c - -E -dM > tmp-errno.i
660         $(SHELL) $(srcdir)/mvifdiff.sh tmp-errno.i errno.i
661         $(STAMP) $@
663 sysinfo.go: s-sysinfo; @true
664 s-sysinfo: $(srcdir)/mksysinfo.sh gen-sysinfo.go errno.i
665         GOARCH=$(GOARCH) GOOS=$(GOOS) $(SHELL) $(srcdir)/mksysinfo.sh
666         $(SHELL) $(srcdir)/mvifdiff.sh tmp-sysinfo.go sysinfo.go
667         $(STAMP) $@
669 # The epoll struct has an embedded union and is packed on x86_64,
670 # which is too complicated for mksysinfo.sh.  We find the offset of
671 # the only field we care about in configure.ac, and generate the
672 # struct here.
673 epoll.go: s-epoll; @true
674 s-epoll: Makefile
675         rm -f epoll.go.tmp
676         echo 'package syscall' > epoll.go.tmp
677         echo 'type EpollEvent struct {' >> epoll.go.tmp
678         echo '  Events uint32' >> epoll.go.tmp
679         case "$(SIZEOF_STRUCT_EPOLL_EVENT),$(STRUCT_EPOLL_EVENT_FD_OFFSET)" in \
680         0,0) echo 1>&2 "*** struct epoll_event data.fd offset unknown"; \
681            exit 1; ;; \
682         8,4) echo '     Fd int32' >> epoll.go.tmp; ;; \
683         12,4) echo '    Fd int32' >> epoll.go.tmp; \
684            echo '       Pad [4]byte' >> epoll.go.tmp; ;; \
685         12,8) echo '    Pad [4]byte' >> epoll.go.tmp; \
686            echo '       Fd int32' >> epoll.go.tmp; ;; \
687         16,8) echo '    Pad [4]byte' >> epoll.go.tmp; \
688            echo '       Fd int32' >> epoll.go.tmp; \
689            echo '       Pad2 [4]byte' >> epoll.go.tmp; ;; \
690         *) echo 1>&2 "*** struct epoll_event unsupported"; \
691            exit 1; ;; \
692         esac
693         echo '}' >> epoll.go.tmp
694         $(SHELL) $(srcdir)/mvifdiff.sh epoll.go.tmp epoll.go
695         $(STAMP) $@
697 if LIBGO_IS_LINUX
698 syscall_lib_clone_lo = syscall/clone_linux.lo
699 else
700 syscall_lib_clone_lo =
701 endif
703 if LIBGO_IS_X86
704 golangorg_x_sys_cpu_gccgo_lo = golang.org/x/sys/cpu_gccgo.lo
705 else
706 golangorg_x_sys_cpu_gccgo_lo =
707 endif
709 PACKAGES = $(shell cat $(srcdir)/libgo-packages.txt)
711 libgo_go_objs = \
712         $(addsuffix .lo,$(PACKAGES)) \
713         internal/bytealg/bytealg.lo \
714         reflect/makefunc_ffi_c.lo \
715         $(syscall_lib_clone_lo) \
716         syscall/errno.lo \
717         syscall/signame.lo \
718         syscall/wait.lo \
719         $(golangorg_x_net_lif_lo) \
720         $(golangorg_x_net_route_lo) \
721         log/syslog/syslog_c.lo \
722         $(os_lib_inotify_lo) \
723         runtime/internal/atomic_c.lo \
724         sync/atomic_c.lo \
725         internal/cpu/cpu_gccgo.lo \
726         $(golangorg_x_sys_cpu_gccgo_lo)
728 libgo_ldflags = \
729         -version-info $(libtool_VERSION) $(PTHREAD_CFLAGS) $(AM_LDFLAGS)
731 libgo_libadd = \
732         $(libgo_go_objs) ../libbacktrace/libbacktrace.la \
733         $(LIBATOMIC) $(LIBFFI) $(PTHREAD_LIBS) $(MATH_LIBS) $(NET_LIBS)
735 libgo_la_SOURCES = $(runtime_files)
736 libgo_la_LDFLAGS = $(libgo_ldflags)
737 libgo_la_LIBADD = $(libgo_libadd)
739 libgo_llgo_la_SOURCES = $(runtime_files)
740 libgo_llgo_la_LDFLAGS = $(libgo_ldflags)
741 libgo_llgo_la_LIBADD = $(libgo_libadd)
743 libgobegin_a_SOURCES = \
744         runtime/go-main.c
746 libgobegin_llgo_a_SOURCES = \
747         runtime/go-main.c
749 # Use -fPIC for libgobegin so that it can be put in a PIE.
750 libgobegin_a_CFLAGS = $(AM_CFLAGS) -fPIC
751 libgobegin_llgo_a_CFLAGS = $(AM_CFLAGS) -fPIC
753 libgolibbegin_a_SOURCES = \
754         runtime/go-libmain.c
756 libgolibbegin_a_CFLAGS = $(AM_CFLAGS) -fPIC
758 GOTOOL_PACKAGES = $(shell cat $(srcdir)/gotool-packages.txt)
760 libgotool_a_SOURCES =
761 libgotool_a_DEPENDENCIES = $(addsuffix .lo,$(GOTOOL_PACKAGES))
762 libgotool_a_LIBADD = $(addsuffix .o,$(GOTOOL_PACKAGES))
764 define STATIC_template
765 $(subst -,_,$(subst .,_,$(subst /,_,$(1))))_GOCFLAGS = -static
766 endef
768 $(foreach package,$(GOTOOL_PACKAGES),$(eval $(call STATIC_template,$(package).lo)))
770 # Make sure runtime.inc is built before compiling any .c file.
771 $(libgo_la_OBJECTS): runtime.inc
772 $(libgo_llgo_la_OBJECTS): runtime.inc
773 $(libgobegin_a_OBJECTS): runtime.inc
774 $(libgobegin_llgo_a_OBJECTS): runtime.inc
775 $(libgolibbegin_a_OBJECTS): runtime.inc
777 LTLDFLAGS = $(shell $(SHELL) $(top_srcdir)/../libtool-ldflags $(LDFLAGS))
779 GOCFLAGS = $(CFLAGS)
780 AM_GOCFLAGS = $(STRINGOPS_FLAG) $(GO_SPLIT_STACK)
781 GOCOMPILE = $(GOC) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_GOCFLAGS) $(GOCFLAGS)
783 LTGOCOMPILE = $(LIBTOOL) --tag GO --mode=compile $(GOC) $(INCLUDES) \
784         $(AM_GOCFLAGS) $(GOCFLAGS)
786 GOLINK = $(LIBTOOL) --tag GO --mode-link $(GOC) \
787         $(OPT_LDFLAGS) $(SECTION_LDFLAGS) $(AM_GOCFLAGS) $(LTLDFLAGS) -o $@
789 # Build the dependencies for a Go package.
790 BUILDDEPS = \
791         $(MKDIR_P) $(@D); \
792         dir=`echo $@ | sed -e 's/.lo.dep$$//'`; \
793         files=`$(SHELL) $(srcdir)/match.sh --goarch=$(GOARCH) --goos=$(GOOS) --srcdir=$(srcdir)/go/$$dir --extrafiles="$(extra_go_files_$(subst .,_,$(subst /,_,$(subst .lo.dep,,$@))))" $(matchargs_$(subst /,_,$(subst .lo.dep,,$@)))`; \
794         $(SHELL) $(srcdir)/godeps.sh `echo $@ | sed -e 's/.dep$$//'` $$files > $@.tmp; \
795         if ! cmp $@.tmp $@ >/dev/null 2>/dev/null; then \
796           rm -f `echo $@ | sed -e 's/\.dep$$//'`; \
797         fi; \
798         mv -f $@.tmp $@
800 # Build the .go files for a package, generating a .lo file.
801 BUILDPACKAGE = \
802         $(MKDIR_P) $(@D); \
803         files=`echo $^ | sed -e 's/[^ ]*\.gox//g' -e 's/[^ ]*\.dep//'`; \
804         $(LTGOCOMPILE) -I . -c -fgo-pkgpath=`echo $@ | sed -e 's/.lo$$//'` $($(subst -,_,$(subst .,_,$(subst /,_,$@)))_GOCFLAGS) -o $@ $$files
806 # How to build a .gox file from a .lo file.
807 # Matching .o file can either be in the same directory as the .lo (non-PIC
808 # object) or in the .libs directory (PIC object).
809 BUILDGOX = \
810         f="$(basename $<).o"; \
811         if test ! -f $$f; then \
812           f="$(basename $(<D)/.libs/$(<F)).o"; \
813         fi; \
814         $(OBJCOPY) -j $(GO_EXPORT_SECTION_NAME) $$f $@.tmp; \
815         $(SHELL) $(srcdir)/mvifdiff.sh $@.tmp `echo $@ | sed -e 's/s-gox/gox/'`
817 GOTESTFLAGS =
818 GOBENCH = 
820 # Check a package.
821 CHECK = \
822         GC="$(GOC) $(GOCFLAGS) $($(subst /,_,$@)_GOCFLAGS) -L `${PWD_COMMAND}` -L `${PWD_COMMAND}`/.libs"; \
823         export GC; \
824         GOLIBS="$(extra_check_libs_$(subst .,_,$(subst /,_,$(@D)))) $(MATH_LIBS) $(NET_LIBS) $(LIBS)"; \
825         export GOLIBS; \
826         RUNTESTFLAGS="$(RUNTESTFLAGS)"; \
827         export RUNTESTFLAGS; \
828         MAKE="$(MAKE)"; \
829         export MAKE; \
830         NM="$(NM)"; \
831         export NM; \
832         libgccdir=`${GOC} ${GOCFLAGS} -print-libgcc-file-name | sed -e 's|/[^/]*$$||'`; \
833         LD_LIBRARY_PATH="`${PWD_COMMAND}`/.libs:$${libgccdir}:${LD_LIBRARY_PATH}"; \
834         LD_LIBRARY_PATH=`echo $${LD_LIBRARY_PATH} | sed 's,::*,:,g;s,^:*,,;s,:*$$,,'`; \
835         export LD_LIBRARY_PATH; \
836         $(MKDIR_P) $(@D); \
837         rm -f $@-testsum $@-testlog; \
838         files=`$(SHELL) $(srcdir)/match.sh --goarch=$(GOARCH) --goos=$(GOOS) --srcdir=$(srcdir)/go/$(@D) --extrafiles="$(extra_go_files_$(subst .,_,$(subst /,_,$(@D))))" $(matchargs_$(subst /,_,$(@D)))`; \
839         if test "$(USE_DEJAGNU)" = "yes"; then \
840           $(SHELL) $(srcdir)/testsuite/gotest --goarch=$(GOARCH) --goos=$(GOOS) --dejagnu=yes --basedir=$(srcdir) --srcdir=$(srcdir)/go/$(@D) --pkgpath="$(@D)" --pkgfiles="$$files" --testname="$(@D)" $(GOTESTFLAGS); \
841         elif test "$(GOBENCH)" != ""; then \
842           $(SHELL) $(srcdir)/testsuite/gotest --goarch=$(GOARCH) --goos=$(GOOS) --basedir=$(srcdir) --srcdir=$(srcdir)/go/$(@D) --pkgpath="$(@D)" --pkgfiles="$$files" --bench="$(GOBENCH)" $(GOTESTFLAGS); \
843         else \
844           if $(SHELL) $(srcdir)/testsuite/gotest --goarch=$(GOARCH) --goos=$(GOOS) --basedir=$(srcdir) --srcdir=$(srcdir)/go/$(@D) --pkgpath="$(@D)" --pkgfiles="$$files" $(GOTESTFLAGS) >>$@-testlog 2>&1; then \
845             echo "PASS: $(@D)" >> $@-testlog; \
846             echo "PASS: $(@D)"; \
847             echo "PASS: $(@D)" > $@-testsum; \
848           else \
849             echo "FAIL: $(@D)" >> $@-testlog; \
850             cat $@-testlog; \
851             echo "FAIL: $(@D)" > $@-testsum; \
852             exit 1; \
853           fi; \
854         fi
856 # Build all packages before checking any.
857 CHECK_DEPS = \
858         $(toolexeclibgo_DATA) \
859         $(toolexeclibgoarchive_DATA) \
860         $(toolexeclibgocompress_DATA) \
861         $(toolexeclibgocontainer_DATA) \
862         $(toolexeclibgocrypto_DATA) \
863         $(toolexeclibgodebug_DATA) \
864         $(toolexeclibgoencoding_DATA) \
865         $(toolexeclibgogo_DATA) \
866         $(toolexeclibgohash_DATA) \
867         $(toolexeclibgoimage_DATA) \
868         $(toolexeclibgoindex_DATA) \
869         $(toolexeclibgoio_DATA) \
870         $(toolexeclibgolog_DATA) \
871         $(toolexeclibgomath_DATA) \
872         $(toolexeclibgomime_DATA) \
873         $(toolexeclibgonet_DATA) \
874         $(toolexeclibgonethttp_DATA) \
875         $(toolexeclibgoos_DATA) \
876         $(toolexeclibgopath_DATA) \
877         $(toolexeclibgorpc_DATA) \
878         $(toolexeclibgoruntime_DATA) \
879         $(toolexeclibgosync_DATA) \
880         $(toolexeclibgotesting_DATA) \
881         $(toolexeclibgotext_DATA) \
882         $(toolexeclibgotexttemplate_DATA) \
883         $(toolexeclibgounicode_DATA) \
884         $(noinst_DATA) \
885         $(noinst_LIBRARIES)
887 if GOC_IS_LLGO
888 CHECK_DEPS += libgo-llgo.la libgobegin-llgo.a
889 else
890 CHECK_DEPS += libgo.la libgobegin.a
891 endif
893 # PACKAGE_template defines the rules for each package.
894 # For example, for the package bufio, it produces:
896 # @go_include@ bufio.lo.dep
897 # bufio.lo.dep: $(srcdir)/go/bufio/*.go
898 #       $(BUILDDEPS)
899 # bufio.lo:
900 #       $(BUILDPACKAGE)
901 # bufio/check: $(CHECK_DEPS)
902 #       @$(CHECK)
903 # .PHONY: bufio/check
905 # This is invoked with $(1) set to a package, which is a directory name,
906 # such as "bufio" or "archive/tar".
907 define PACKAGE_template
908 @go_include@ $(1).lo.dep
909 $(1).lo.dep: $(srcdir)/go/$(1)/*.go
910         $$(BUILDDEPS)
911 $(1).lo:
912         $$(BUILDPACKAGE)
913 $(1)/check: $$(CHECK_DEPS)
914         @$$(CHECK)
915 .PHONY: $(1)/check
916 $(1).gox: $(1).s-gox; @true
917 $(1).s-gox: $(1).lo
918         $$(BUILDGOX)
919         $$(STAMP) $$@
920 endef
922 # This line expands PACKAGE_template once for each package name listed
923 # in $(PACKAGES).
924 $(foreach package,$(PACKAGES),$(eval $(call PACKAGE_template,$(package))))
925 $(foreach package,$(GOTOOL_PACKAGES),$(eval $(call PACKAGE_template,$(package))))
927 # Pass -ffp-contract=off, or 386-specific options, when building the
928 # math package.  MATH_FLAG is defined in configure.ac.
929 math_lo_GOCFLAGS = $(MATH_FLAG)
930 math_check_GOCFLAGS = $(MATH_FLAG)
932 # Add the generated file runtime_sysinfo.go to the runtime package.
933 extra_go_files_runtime = runtime_sysinfo.go sigtab.go
934 runtime.lo.dep: $(extra_go_files_runtime)
936 # Add generated files to the syscall package.
937 extra_go_files_syscall = \
938         libcalls.go \
939         sysinfo.go \
940         syscall_arch.go \
941         $(syscall_epoll_file)
942 syscall.lo.dep: $(extra_go_files_syscall)
944 # Pass -fgo-compiling-runtime when compiling the runtime package.
945 runtime_lo_GOCFLAGS = -fgo-c-header=runtime.inc.raw -fgo-compiling-runtime
946 runtime_check_GOCFLAGS = -fgo-compiling-runtime
947 runtime_internal_atomic_lo_GOCFLAGS = -fgo-compiling-runtime
948 runtime_internal_atomic_lo_check_GOCFLAGS = -fgo-compiling-runtime
949 runtime_internal_sys_lo_GOCFLAGS = -fgo-compiling-runtime
950 runtime_internal_sys_lo_check_GOCFLAGS = -fgo-compiling-runtime
952 # If libffi is supported (the normal case) use the ffi build tag for
953 # the runtime package.
954 if USE_LIBFFI
955 matchargs_runtime = --tag=libffi
956 else
957 matchargs_runtime =
958 endif
960 # At least for now, we need -static-libgo for this test, because
961 # otherwise we can't get the line numbers.
962 # Also use -fno-inline to get better results from the memory profiler.
963 runtime_pprof_check_GOCFLAGS = -static-libgo -fno-inline
965 extra_go_files_runtime_internal_sys = version.go
966 runtime/internal/sys.lo.dep: $(extra_go_files_runtime_internal_sys)
968 extra_go_files_internal_cpu = cpugen.go
969 internal/cpu.lo.dep: $(extra_go_files_internal_cpu)
971 extra_go_files_golang_org_x_sys_cpu = gcpugen.go
972 golang.org/x/sys/cpu.lo.dep: $(extra_go_files_golang_org_x_sys_cpu)
974 extra_go_files_internal_goroot = zstdpkglist.go
975 internal/goroot.lo.dep: $(extra_go_files_internal_goroot)
977 extra_go_files_go_types = gccgosizes.go
978 go/types.lo.dep: $(extra_go_files_go_types)
980 extra_go_files_cmd_internal_objabi = objabi.go
981 cmd/internal/objabi.lo.dep: $(extra_go_files_cmd_internal_objabi)
983 extra_go_files_cmd_go_internal_cfg = zdefaultcc.go
984 cmd/go/internal/cfg.lo.dep: $(extra_go_files_cmd_go_internal_cfg)
986 extra_check_libs_cmd_go_internal_cache = $(abs_builddir)/libgotool.a
987 extra_check_libs_cmd_go_internal_generate = $(abs_builddir)/libgotool.a
988 extra_check_libs_cmd_go_internal_get = $(abs_builddir)/libgotool.a
989 extra_check_libs_cmd_go_internal_load = $(abs_builddir)/libgotool.a
990 extra_check_libs_cmd_go_internal_lockedfile = $(abs_builddir)/libgotool.a
991 extra_check_libs_cmd_go_internal_imports = $(abs_builddir)/libgotool.a
992 extra_check_libs_cmd_go_internal_modconv = $(abs_builddir)/libgotool.a
993 extra_check_libs_cmd_go_internal_modfetch = $(abs_builddir)/libgotool.a
994 extra_check_libs_cmd_go_internal_modfetch_codehost = $(abs_builddir)/libgotool.a
995 extra_check_libs_cmd_go_internal_modfile = $(abs_builddir)/libgotool.a
996 extra_check_libs_cmd_go_internal_modload = $(abs_builddir)/libgotool.a
997 extra_check_libs_cmd_go_internal_module = $(abs_builddir)/libgotool.a
998 extra_check_libs_cmd_go_internal_mvs = $(abs_builddir)/libgotool.a
999 extra_check_libs_cmd_go_internal_search = $(abs_builddir)/libgotool.a
1000 extra_check_libs_cmd_go_internal_web2 = $(abs_builddir)/libgotool.a
1001 extra_check_libs_cmd_go_internal_work = $(abs_builddir)/libgotool.a
1003 extra_check_libs_cmd_vet_internal_cfg = $(abs_builddir)/libgotool.a
1005 # FIXME: The following C files may as well move to the runtime
1006 # directory and be treated like other C files.
1008 # Use C code to speed up internal/bytealg.IndexByte and friends.
1009 internal/bytealg/bytealg.lo: go/internal/bytealg/bytealg.c runtime.inc
1010         @$(MKDIR_P) internal/bytealg
1011         $(LTCOMPILE) -c -o $@ $(srcdir)/go/internal/bytealg/bytealg.c
1013 # Use a C function with a fixed number of arguments to call a C
1014 # varargs function.
1015 log/syslog/syslog_c.lo: go/log/syslog/syslog_c.c runtime.inc
1016         @$(MKDIR_P) log/syslog
1017         $(LTCOMPILE) -c -o $@ $(srcdir)/go/log/syslog/syslog_c.c
1019 # The interface to libffi from the reflect package is written in C.
1020 reflect/makefunc_ffi_c.lo: go/reflect/makefunc_ffi_c.c runtime.inc
1021         @$(MKDIR_P) reflect
1022         $(LTCOMPILE) -c -o $@ $(srcdir)/go/reflect/makefunc_ffi_c.c
1024 # The atomic functions are written in C.
1025 runtime/internal/atomic_c.lo: go/runtime/internal/atomic/atomic.c runtime.inc
1026         @$(MKDIR_P) runtime/internal
1027         $(LTCOMPILE) -c -o $@ $(srcdir)/go/runtime/internal/atomic/atomic.c
1028 sync/atomic_c.lo: go/sync/atomic/atomic.c runtime.inc
1029         @$(MKDIR_P) sync
1030         $(LTCOMPILE) -c -o $@ $(srcdir)/go/sync/atomic/atomic.c
1032 # A few syscall functions are written in C.
1033 syscall/clone_linux.lo: go/syscall/clone_linux.c runtime.inc
1034         @$(MKDIR_P) syscall
1035         $(LTCOMPILE) -c -o $@ $(srcdir)/go/syscall/clone_linux.c
1036 syscall/errno.lo: go/syscall/errno.c runtime.inc
1037         @$(MKDIR_P) syscall
1038         $(LTCOMPILE) -c -o $@ $(srcdir)/go/syscall/errno.c
1039 syscall/signame.lo: go/syscall/signame.c runtime.inc
1040         @$(MKDIR_P) syscall
1041         $(LTCOMPILE) -c -o $@ $(srcdir)/go/syscall/signame.c
1042 syscall/wait.lo: go/syscall/wait.c runtime.inc
1043         @$(MKDIR_P) syscall
1044         $(LTCOMPILE) -c -o $@ $(srcdir)/go/syscall/wait.c
1046 # internal/cpu needs some C code.
1047 internal/cpu/cpu_gccgo.lo: go/internal/cpu/cpu_gccgo.c runtime.inc
1048         @$(MKDIR_P) internal/cpu
1049         $(LTCOMPILE) -c -o $@ $(srcdir)/go/internal/cpu/cpu_gccgo.c
1051 # Similarly, golang.org/x/sys/cpu needs some C code.
1052 golang.org/x/sys/cpu_gccgo.lo: go/golang.org/x/sys/cpu/cpu_gccgo.c runtime.inc
1053         @$(MKDIR_P) golang.org/x/sys
1054         $(LTCOMPILE) -c -o $@ $(srcdir)/go/golang.org/x/sys/cpu/cpu_gccgo.c
1056 # Solaris 11.4 changed the type of fields in struct stat.
1057 # Use a build tag, based on a configure check, to cope.
1058 if LIBGO_IS_SOLARIS
1059 if HAVE_STAT_TIMESPEC
1060 matchargs_os = --tag=solaristag
1061 else
1062 matchargs_os =
1063 endif
1064 else
1065 matchargs_os =
1066 endif
1068 if LIBGO_IS_BSD
1070 # Build golang.org/x/net/route only on BSD systems.
1072 $(eval $(call PACKAGE_template,golang.org/x/net/route))
1074 golangorg_x_net_route_lo = \
1075         golang.org/net/route.lo
1077 endif
1079 if LIBGO_IS_SOLARIS
1081 # Build golang.org/x/net/lif only on Solaris systems.
1083 $(eval $(call PACKAGE_template,golang.org/x/net/lif))
1085 golangorg_x_net_lif_lo = \
1086         golang.org/x/net/lif.lo
1088 endif
1090 TEST_PACKAGES = $(addsuffix /check,$(shell cat $(srcdir)/check-packages.txt))
1092 check: check-tail
1093 check-recursive: check-head
1095 check-head:
1096         @echo "Test Run By $${USER} on `date`" > libgo.head
1097         @echo "Native configuration is $(host_triplet)" >> libgo.head
1098         @echo >> libgo.head
1099         @echo "         === libgo tests ===" >> libgo.head
1100         @echo >> libgo.head
1102 check-tail: check-recursive check-multi
1103         @if test "$(USE_DEJAGNU)" = "yes"; then \
1104           exit 0; \
1105         fi; \
1106         lib=`${PWD_COMMAND} | sed -e 's,^.*/\([^/][^/]*\)$$,\1,'`; \
1107         for dir in . $(MULTIDIRS); do \
1108           mv ../$${dir}/$${lib}/libgo.sum ../$${dir}/$${lib}/libgo.sum.sep; \
1109           mv ../$${dir}/$${lib}/libgo.log ../$${dir}/$${lib}/libgo.log.sep; \
1110         done; \
1111         mv libgo.head libgo.sum; \
1112         cp libgo.sum libgo.log; \
1113         echo "Schedule of variations:" >> libgo.sum; \
1114         for dir in . $(MULTIDIRS); do \
1115           multidir=../$${dir}/$${lib}; \
1116           multivar=`cat $${multidir}/libgo.var`; \
1117           echo "    $${multivar}" >> libgo.sum; \
1118         done; \
1119         echo >> libgo.sum; \
1120         pass=0; fail=0; untested=0; \
1121         for dir in . $(MULTIDIRS); do \
1122           multidir=../$${dir}/$${lib}; \
1123           multivar=`cat $${multidir}/libgo.var`; \
1124           echo "Running target $${multivar}" >> libgo.sum; \
1125           echo "Running $(srcdir)/libgo.exp ..." >> libgo.sum; \
1126           cat $${multidir}/libgo.sum.sep >> libgo.sum; \
1127           cat $${multidir}/libgo.log.sep >> libgo.log; \
1128           if test -n "${MULTIDIRS}"; then \
1129             echo "              === libgo Summary for $${multivar} ===" >> libgo.sum; \
1130             echo >> libgo.sum; \
1131           fi; \
1132           p=`grep -c PASS $${multidir}/libgo.sum.sep`; \
1133           pass=`expr $$pass + $$p`; \
1134           if test "$$p" -ne "0" && test -n "${MULTIDIRS}"; then \
1135             echo "# of expected passes          $$p" >> libgo.sum; \
1136           fi; \
1137           p=`grep -c FAIL $${multidir}/libgo.sum.sep`; \
1138           fail=`expr $$fail + $$p`; \
1139           if test "$$p" -ne "0" && test -n "${MULTIDIRS}"; then \
1140             echo "# of unexpected failures      $$p" >> libgo.sum; \
1141           fi; \
1142           p=`grep -c UNTESTED $${multidir}/libgo.sum.sep`; \
1143           untested=`expr $$untested + $$p`; \
1144           if test "$$p" -ne "0" && test -n "${MULTIDIRS}"; then \
1145             echo "# of untested testcases               $$p" >> libgo.sum; \
1146           fi; \
1147         done; \
1148         echo >> libgo.sum; \
1149         echo "          === libgo Summary ===" >> libgo.sum; \
1150         echo >> libgo.sum; \
1151         if test "$$pass" -ne "0"; then \
1152           echo "# of expected passes            $$pass" >> libgo.sum; \
1153         fi; \
1154         if test "$$fail" -ne "0"; then \
1155           echo "# of unexpected failures        $$fail" >> libgo.sum; \
1156         fi; \
1157         if test "$$untested" -ne "0"; then \
1158           echo "# of untested testcases         $$untested" >> libgo.sum; \
1159         fi; \
1160         echo `echo $(GOC) | sed -e 's/ .*//'`  `$(GOC) -v 2>&1 | grep " version" | sed -n -e 's/.* \(version.*$$\)/\1/p'` >> libgo.sum; \
1161         echo >> libgo.log; \
1162         echo "runtest completed at `date`" >> libgo.log; \
1163         if test "$$fail" -ne "0"; then \
1164           status=1; \
1165         else \
1166           status=0; \
1167         fi; \
1168         exit $$status
1170 check-am:
1171         @rm -f libgo.sum libgo.log libgo.tail
1172         @multivar="unix"; \
1173         [ -z "$(MULTIFLAGS)" ] || multivar="$${multivar}/$(MULTIFLAGS)"; \
1174         echo "$${multivar}" > libgo.var
1175         @for f in $(TEST_PACKAGES); do \
1176            rm -f $$f-testsum $$f-testlog; \
1177          done
1178         -@$(MAKE) $(AM_MAKEFLAGS) -k $(TEST_PACKAGES)
1179         @for f in $(TEST_PACKAGES); do \
1180           if test -f $$f-testsum; then \
1181             cat $$f-testsum >> libgo.sum; \
1182           fi; \
1183           if test -f $$f-testlog; then \
1184             cat $$f-testlog >> libgo.log; \
1185           fi; \
1186         done
1188 check-multi:
1189         $(MULTIDO) $(AM_MAKEFLAGS) DO=check-am multi-do # $(MAKE)
1191 bench:
1192         -@$(MAKE) $(AM_MAKEFLAGS) -k $(TEST_PACKAGES) GOBENCH=.
1194 MOSTLYCLEANFILES = \
1195         s-runtime_sysinfo s-sigtab s-runtime-inc s-zstdpkglist \
1196         s-libcalls s-libcalls-list s-syscall_arch s-gen-sysinfo s-sysinfo \
1197         s-errno s-epoll \
1198         libgo.head libgo.sum.sep libgo.log.sep libgo.var \
1199         libcalls-list \
1200         runtime.inc runtime.inc.tmp2 runtime.inc.tmp3 runtime.inc.raw
1202 mostlyclean-local:
1203         find . -name '*.lo' -print | xargs $(LIBTOOL) --mode=clean rm -f
1204         find . -name '*.$(OBJEXT)' -print | xargs rm -f
1205         find . -name '*-testsum' -print | xargs rm -f
1206         find . -name '*-testlog' -print | xargs rm -f
1208 CLEANFILES = *.go *.c s-* libgo.sum libgo.log runtime.inc
1210 clean-local:
1211         find . -name '*.la' -print | xargs $(LIBTOOL) --mode=clean rm -f
1212         find . -name '*.a' -print | xargs rm -f
1213         find . -name '*.gox' -print | xargs rm -f
1214         find . -name '*.s-gox' -print | xargs rm -f
1216 distclean-local:
1217         find . -name '*.lo.dep' -print | xargs rm -f
1219 include $(top_srcdir)/../multilib.am