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