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