2017-04-07 Vladimir Makarov <vmakarov@redhat.com>
[official-gcc.git] / libgo / Makefile.am
blob515b61b71e4d15f4a18f06d6614b8cfc418f527f
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 if USING_SPLIT_STACK
50 AM_LDFLAGS = -XCClinker $(SPLIT_STACK)
51 endif
53 # Multilib support.
54 MAKEOVERRIDES=
56 # Work around what appears to be a GNU make  handling MAKEFLAGS
57 # values defined in terms of make variables, as is the case for CC and
58 # friends when we are called from the top level Makefile.
59 AM_MAKEFLAGS = \
60         "AR_FLAGS=$(AR_FLAGS)" \
61         "CC_FOR_BUILD=$(CC_FOR_BUILD)" \
62         "CC_FOR_TARGET=$(CC_FOR_TARGET)" \
63         "CFLAGS=$(CFLAGS)" \
64         "CXXFLAGS=$(CXXFLAGS)" \
65         "CFLAGS_FOR_BUILD=$(CFLAGS_FOR_BUILD)" \
66         "CFLAGS_FOR_TARGET=$(CFLAGS_FOR_TARGET)" \
67         "GOC_FOR_TARGET=$(GOC_FOR_TARGET)" \
68         "GOC=$(GOC)" \
69         "GOCFLAGS=$(GOCFLAGS)" \
70         "INSTALL=$(INSTALL)" \
71         "INSTALL_DATA=$(INSTALL_DATA)" \
72         "INSTALL_PROGRAM=$(INSTALL_PROGRAM)" \
73         "INSTALL_SCRIPT=$(INSTALL_SCRIPT)" \
74         "LDFLAGS=$(LDFLAGS)" \
75         "LIBCFLAGS=$(LIBCFLAGS)" \
76         "LIBCFLAGS_FOR_TARGET=$(LIBCFLAGS_FOR_TARGET)" \
77         "MAKE=$(MAKE)" \
78         "MAKEINFO=$(MAKEINFO) $(MAKEINFOFLAGS)" \
79         "PICFLAG=$(PICFLAG)" \
80         "PICFLAG_FOR_TARGET=$(PICFLAG_FOR_TARGET)" \
81         "SHELL=$(SHELL)" \
82         "RUNTESTFLAGS=$(RUNTESTFLAGS)" \
83         "exec_prefix=$(exec_prefix)" \
84         "infodir=$(infodir)" \
85         "libdir=$(libdir)" \
86         "includedir=$(includedir)" \
87         "prefix=$(prefix)" \
88         "tooldir=$(tooldir)" \
89         "gxx_include_dir=$(gxx_include_dir)" \
90         "AR=$(AR)" \
91         "AS=$(AS)" \
92         "LD=$(LD)" \
93         "RANLIB=$(RANLIB)" \
94         "NM=$(NM)" \
95         "NM_FOR_BUILD=$(NM_FOR_BUILD)" \
96         "NM_FOR_TARGET=$(NM_FOR_TARGET)" \
97         "DESTDIR=$(DESTDIR)" \
98         "WERROR=$(WERROR)"
100 # Subdir rules rely on $(FLAGS_TO_PASS)
101 FLAGS_TO_PASS = $(AM_MAKEFLAGS)
103 if GOC_IS_LLGO
104 toolexeclib_LTLIBRARIES = libgo-llgo.la
105 toolexeclib_LIBRARIES = libgobegin-llgo.a
106 else
107 toolexeclib_LTLIBRARIES = libgo.la
108 toolexeclib_LIBRARIES = libgobegin.a libgolibbegin.a
109 endif
111 toolexeclibgo_DATA = \
112         bufio.gox \
113         bytes.gox \
114         context.gox \
115         crypto.gox \
116         encoding.gox \
117         errors.gox \
118         expvar.gox \
119         flag.gox \
120         fmt.gox \
121         hash.gox \
122         html.gox \
123         image.gox \
124         io.gox \
125         log.gox \
126         math.gox \
127         mime.gox \
128         net.gox \
129         os.gox \
130         path.gox \
131         reflect.gox \
132         regexp.gox \
133         runtime.gox \
134         sort.gox \
135         strconv.gox \
136         strings.gox \
137         sync.gox \
138         syscall.gox \
139         testing.gox \
140         time.gox \
141         unicode.gox
143 toolexeclibgoarchivedir = $(toolexeclibgodir)/archive
145 toolexeclibgoarchive_DATA = \
146         archive/tar.gox \
147         archive/zip.gox
149 toolexeclibgocompressdir = $(toolexeclibgodir)/compress
151 toolexeclibgocompress_DATA = \
152         compress/bzip2.gox \
153         compress/flate.gox \
154         compress/gzip.gox \
155         compress/lzw.gox \
156         compress/zlib.gox
158 toolexeclibgocontainerdir = $(toolexeclibgodir)/container
160 toolexeclibgocontainer_DATA = \
161         container/heap.gox \
162         container/list.gox \
163         container/ring.gox
165 toolexeclibgocryptodir = $(toolexeclibgodir)/crypto
167 toolexeclibgocrypto_DATA = \
168         crypto/aes.gox \
169         crypto/cipher.gox \
170         crypto/des.gox \
171         crypto/dsa.gox \
172         crypto/ecdsa.gox \
173         crypto/elliptic.gox \
174         crypto/hmac.gox \
175         crypto/md5.gox \
176         crypto/rand.gox \
177         crypto/rc4.gox \
178         crypto/rsa.gox \
179         crypto/sha1.gox \
180         crypto/sha256.gox \
181         crypto/sha512.gox \
182         crypto/subtle.gox \
183         crypto/tls.gox \
184         crypto/x509.gox
186 toolexeclibgocryptox509dir = $(toolexeclibgocryptodir)/x509
188 toolexeclibgocryptox509_DATA = \
189         crypto/x509/pkix.gox
191 toolexeclibgodatabasedir = $(toolexeclibgodir)/database
193 toolexeclibgodatabase_DATA = \
194         database/sql.gox
196 toolexeclibgodatabasesqldir = $(toolexeclibgodatabasedir)/sql
198 toolexeclibgodatabasesql_DATA = \
199         database/sql/driver.gox
201 toolexeclibgodebugdir = $(toolexeclibgodir)/debug
203 toolexeclibgodebug_DATA = \
204         debug/dwarf.gox \
205         debug/elf.gox \
206         debug/gosym.gox \
207         debug/macho.gox \
208         debug/pe.gox \
209         debug/plan9obj.gox
211 toolexeclibgoencodingdir = $(toolexeclibgodir)/encoding
213 toolexeclibgoencoding_DATA = \
214         encoding/ascii85.gox \
215         encoding/asn1.gox \
216         encoding/base32.gox \
217         encoding/base64.gox \
218         encoding/binary.gox \
219         encoding/csv.gox \
220         encoding/gob.gox \
221         encoding/hex.gox \
222         encoding/json.gox \
223         encoding/pem.gox \
224         encoding/xml.gox
226 toolexeclibgoexpdir = $(toolexeclibgodir)/exp
228 toolexeclibgoexp_DATA = \
229         exp/proxy.gox \
230         exp/terminal.gox
232 toolexeclibgogodir = $(toolexeclibgodir)/go
234 toolexeclibgogo_DATA = \
235         go/ast.gox \
236         go/build.gox \
237         go/constant.gox \
238         go/doc.gox \
239         go/format.gox \
240         go/importer.gox \
241         go/parser.gox \
242         go/printer.gox \
243         go/scanner.gox \
244         go/token.gox \
245         go/types.gox
247 toolexeclibgohashdir = $(toolexeclibgodir)/hash
249 toolexeclibgohash_DATA = \
250         hash/adler32.gox \
251         hash/crc32.gox \
252         hash/crc64.gox \
253         hash/fnv.gox
255 toolexeclibgohtmldir = $(toolexeclibgodir)/html
257 toolexeclibgohtml_DATA = \
258         html/template.gox
260 toolexeclibgoimagedir = $(toolexeclibgodir)/image
262 toolexeclibgoimage_DATA = \
263         image/color.gox \
264         image/draw.gox \
265         image/gif.gox \
266         image/jpeg.gox \
267         image/png.gox
269 toolexeclibgoimagecolordir = $(toolexeclibgoimagedir)/color
271 toolexeclibgoimagecolor_DATA = \
272         image/color/palette.gox
274 toolexeclibgoindexdir = $(toolexeclibgodir)/index
276 toolexeclibgoindex_DATA = \
277         index/suffixarray.gox
279 toolexeclibgoiodir = $(toolexeclibgodir)/io
281 toolexeclibgoio_DATA = \
282         io/ioutil.gox
284 toolexeclibgologdir = $(toolexeclibgodir)/log
286 toolexeclibgolog_DATA = \
287         log/syslog.gox
289 toolexeclibgomathdir = $(toolexeclibgodir)/math
291 toolexeclibgomath_DATA = \
292         math/big.gox \
293         math/cmplx.gox \
294         math/rand.gox
296 toolexeclibgomimedir = $(toolexeclibgodir)/mime
298 toolexeclibgomime_DATA = \
299         mime/multipart.gox \
300         mime/quotedprintable.gox
302 toolexeclibgonetdir = $(toolexeclibgodir)/net
304 toolexeclibgonet_DATA = \
305         net/http.gox \
306         net/mail.gox \
307         net/rpc.gox \
308         net/smtp.gox \
309         net/textproto.gox \
310         net/url.gox
312 toolexeclibgonethttpdir = $(toolexeclibgonetdir)/http
314 toolexeclibgonethttp_DATA = \
315         net/http/cgi.gox \
316         net/http/cookiejar.gox \
317         net/http/fcgi.gox \
318         net/http/httptest.gox \
319         net/http/httptrace.gox \
320         net/http/httputil.gox \
321         net/http/pprof.gox
323 toolexeclibgonetrpcdir = $(toolexeclibgonetdir)/rpc
325 toolexeclibgonetrpc_DATA = \
326         net/rpc/jsonrpc.gox
328 toolexeclibgoosdir = $(toolexeclibgodir)/os
330 toolexeclibgoos_DATA = \
331         os/exec.gox \
332         os/signal.gox \
333         os/user.gox
335 toolexeclibgopathdir = $(toolexeclibgodir)/path
337 toolexeclibgopath_DATA = \
338         path/filepath.gox
340 toolexeclibgoregexpdir = $(toolexeclibgodir)/regexp
342 toolexeclibgoregexp_DATA = \
343         regexp/syntax.gox
345 toolexeclibgoruntimedir = $(toolexeclibgodir)/runtime
347 toolexeclibgoruntime_DATA = \
348         runtime/debug.gox \
349         runtime/pprof.gox \
350         runtime/trace.gox
352 toolexeclibgosyncdir = $(toolexeclibgodir)/sync
354 toolexeclibgosync_DATA = \
355         sync/atomic.gox
357 toolexeclibgotestingdir = $(toolexeclibgodir)/testing
359 toolexeclibgotesting_DATA = \
360         testing/iotest.gox \
361         testing/quick.gox
363 toolexeclibgotestinginternaldir = $(toolexeclibgotestingdir)/internal
365 toolexeclibgotestinginternal_DATA = \
366         testing/internal/testdeps.gox
368 toolexeclibgotextdir = $(toolexeclibgodir)/text
370 toolexeclibgotext_DATA = \
371         text/scanner.gox \
372         text/tabwriter.gox \
373         text/template.gox
375 toolexeclibgotexttemplatedir = $(toolexeclibgotextdir)/template
377 toolexeclibgotexttemplate_DATA = \
378         text/template/parse.gox
380 toolexeclibgounicodedir = $(toolexeclibgodir)/unicode
382 toolexeclibgounicode_DATA = \
383         unicode/utf16.gox \
384         unicode/utf8.gox
386 if HAVE_SYS_MMAN_H
387 runtime_mem_file = runtime/mem.c
388 else
389 runtime_mem_file = runtime/mem_posix_memalign.c
390 endif
392 if LIBGO_IS_RTEMS
393 rtems_task_variable_add_file = runtime/rtems-task-variable-add.c
394 else
395 rtems_task_variable_add_file =
396 endif
398 if LIBGO_IS_LINUX
399 runtime_thread_files = runtime/thread-linux.c
400 else
401 runtime_thread_files = runtime/thread-sema.c
402 endif
404 if LIBGO_IS_LINUX
405 runtime_getncpu_file = runtime/getncpu-linux.c
406 else
407 if LIBGO_IS_DARWIN
408 runtime_getncpu_file = runtime/getncpu-bsd.c
409 else
410 if LIBGO_IS_IRIX
411 runtime_getncpu_file = runtime/getncpu-irix.c
412 else
413 if LIBGO_IS_SOLARIS
414 runtime_getncpu_file = runtime/getncpu-solaris.c
415 else
416 if LIBGO_IS_FREEBSD
417 runtime_getncpu_file = runtime/getncpu-bsd.c
418 else
419 if LIBGO_IS_NETBSD
420 runtime_getncpu_file = runtime/getncpu-bsd.c
421 else
422 runtime_getncpu_file = runtime/getncpu-none.c
423 endif
424 endif
425 endif
426 endif
427 endif
428 endif
430 runtime_files = \
431         runtime/aeshash.c \
432         runtime/go-assert.c \
433         runtime/go-breakpoint.c \
434         runtime/go-caller.c \
435         runtime/go-callers.c \
436         runtime/go-cdiv.c \
437         runtime/go-cgo.c \
438         runtime/go-construct-map.c \
439         runtime/go-ffi.c \
440         runtime/go-fieldtrack.c \
441         runtime/go-matherr.c \
442         runtime/go-memclr.c \
443         runtime/go-memcmp.c \
444         runtime/go-memequal.c \
445         runtime/go-memmove.c \
446         runtime/go-nanotime.c \
447         runtime/go-now.c \
448         runtime/go-new.c \
449         runtime/go-nosys.c \
450         runtime/go-reflect-call.c \
451         runtime/go-runtime-error.c \
452         runtime/go-setenv.c \
453         runtime/go-signal.c \
454         runtime/go-strslice.c \
455         runtime/go-typedesc-equal.c \
456         runtime/go-unsafe-new.c \
457         runtime/go-unsafe-newarray.c \
458         runtime/go-unsafe-pointer.c \
459         runtime/go-unsetenv.c \
460         runtime/go-unwind.c \
461         runtime/go-varargs.c \
462         runtime/env_posix.c \
463         runtime/heapdump.c \
464         runtime/mcache.c \
465         runtime/mcentral.c \
466         $(runtime_mem_file) \
467         runtime/mfixalloc.c \
468         runtime/mgc0.c \
469         runtime/mheap.c \
470         runtime/msize.c \
471         runtime/panic.c \
472         runtime/parfor.c \
473         runtime/print.c \
474         runtime/proc.c \
475         runtime/runtime_c.c \
476         runtime/thread.c \
477         $(runtime_thread_files) \
478         runtime/yield.c \
479         $(rtems_task_variable_add_file) \
480         malloc.c \
481         $(runtime_getncpu_file)
483 goc2c.$(OBJEXT): runtime/goc2c.c
484         $(CC_FOR_BUILD) -c $(CFLAGS_FOR_BUILD) $<
486 goc2c: goc2c.$(OBJEXT)
487         $(CC_FOR_BUILD) $(CFLAGS_FOR_BUILD) $(LDFLAGS_FOR_BUILD) -o $@ $<
489 malloc.c: $(srcdir)/runtime/malloc.goc goc2c
490         ./goc2c $< > $@.tmp
491         mv -f $@.tmp $@
493 %.c: $(srcdir)/runtime/%.goc goc2c
494         ./goc2c $< > $@.tmp
495         mv -f $@.tmp $@
497 version.go: s-version; @true
498 s-version: Makefile
499         rm -f version.go.tmp
500         echo "package sys" > version.go.tmp
501         echo 'const DefaultGoroot = "$(prefix)"' >> version.go.tmp
502         echo 'const TheVersion = "'`cat $(srcdir)/VERSION | sed 1q`' '`$(GOC) --version | sed 1q`'"' >> version.go.tmp
503         echo 'const GOARCH = "'$(GOARCH)'"' >> version.go.tmp
504         echo 'const GOOS = "'$(GOOS)'"' >> version.go.tmp
505         echo 'const GccgoToolDir = "$(libexecsubdir)"' >> version.go.tmp
506         echo >> version.go.tmp
507         echo "type ArchFamilyType int" >> version.go.tmp
508         echo >> version.go.tmp
509         echo "const (" >> version.go.tmp
510         echo "  UNKNOWN ArchFamilyType = iota" >> version.go.tmp
511         for a in $(ALLGOARCHFAMILY); do \
512           echo "        $${a}" >> version.go.tmp; \
513         done
514         echo ")" >> version.go.tmp
515         echo >> version.go.tmp
516         for a in $(ALLGOARCH); do \
517           f=`echo $${a} | sed -e 's/\(.\).*/\1/' -e 'y/abcdefghijklmnopqrstuvwxyz/ABCDEFGHIJKLMNOPQRSTUVWXYZ/'`; \
518           n="$${f}`echo $${a} | sed -e 's/.//'`"; \
519           if test "$${a}" = "$(GOARCH)"; then \
520             echo "const Goarch$${n} = 1" >> version.go.tmp; \
521           else \
522             echo "const Goarch$${n} = 0" >> version.go.tmp; \
523           fi; \
524         done
525         echo >> version.go.tmp
526         echo "const (" >> version.go.tmp
527         echo "  ArchFamily = $(GOARCH_FAMILY)" >> version.go.tmp
528         echo "  BigEndian = $(GOARCH_BIGENDIAN)" >> version.go.tmp
529         echo "  CacheLineSize = $(GOARCH_CACHELINESIZE)" >> version.go.tmp
530         echo "  PhysPageSize = $(GOARCH_PHYSPAGESIZE)" >> version.go.tmp
531         echo "  PCQuantum = $(GOARCH_PCQUANTUM)" >> version.go.tmp
532         echo "  Int64Align = $(GOARCH_INT64ALIGN)" >> version.go.tmp
533         echo "  HugePageSize = $(GOARCH_HUGEPAGESIZE)" >> version.go.tmp
534         echo "  MinFrameSize = $(GOARCH_MINFRAMESIZE)" >> version.go.tmp
535         echo ")" >> version.go.tmp
536         echo >> version.go.tmp
537         for a in $(ALLGOOS); do \
538           f=`echo $${a} | sed -e 's/\(.\).*/\1/' -e 'y/abcdefghijklmnopqrstuvwxyz/ABCDEFGHIJKLMNOPQRSTUVWXYZ/'`; \
539           n="$${f}`echo $${a} | sed -e 's/.//'`"; \
540           if test "$${a}" = "$(GOOS)"; then \
541             echo "const Goos$${n} = 1" >> version.go.tmp; \
542           else \
543             echo "const Goos$${n} = 0" >> version.go.tmp; \
544           fi; \
545         done
546         echo >> version.go.tmp
547         echo "type Uintreg uintptr" >> version.go.tmp
548         $(SHELL) $(srcdir)/mvifdiff.sh version.go.tmp version.go
549         $(STAMP) $@
551 runtime_sysinfo.go: s-runtime_sysinfo; @true
552 s-runtime_sysinfo: $(srcdir)/mkrsysinfo.sh gen-sysinfo.go
553         $(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 runtime.inc: s-runtime-inc; @true
564 s-runtime-inc: runtime.lo Makefile
565         rm -f runtime.inc.tmp2
566         grep -v "#define _" runtime.inc.tmp | grep -v "#define [cm][01234] " > runtime.inc.tmp2
567         for pattern in '_[GP][a-z]' _Max _Lock _Sig _Trace _MHeap _Num; do \
568           grep "#define $$pattern" runtime.inc.tmp >> runtime.inc.tmp2; \
569         done
570         $(SHELL) $(srcdir)/mvifdiff.sh runtime.inc.tmp2 runtime.inc
571         $(STAMP) $@
573 noinst_DATA = zstdpkglist.go
575 # Generate the list of go std packages that were included in libgo
576 zstdpkglist.go: s-zstdpkglist; @true
577 s-zstdpkglist: Makefile
578         rm -f zstdpkglist.go.tmp
579         echo 'package main' > zstdpkglist.go.tmp
580         echo "" >> zstdpkglist.go.tmp
581         echo 'var stdpkg = map[string]bool{' >> zstdpkglist.go.tmp
582         echo $(libgo_go_objs) 'unsafe.lo' 'runtime/cgo.lo' | sed 's/\.lo /\": true,\n/g' | grep -v _c | sed 's/\.lo/\": true,/' | sed 's/^/\t\"/' | sort -u >> zstdpkglist.go.tmp
583         echo '}' >> zstdpkglist.go.tmp
584         $(SHELL) $(srcdir)/mvifdiff.sh zstdpkglist.go.tmp zstdpkglist.go
585         $(STAMP) $@
587 if LIBGO_IS_LINUX
588 syscall_epoll_file = epoll.go
589 else
590 syscall_epoll_file =
591 endif
593 libcalls.go: s-libcalls; @true
594 s-libcalls: libcalls-list go/syscall/mksyscall.awk $(srcdir)/go/syscall/*.go
595         rm -f libcalls.go.tmp
596         $(AWK) -f $(srcdir)/go/syscall/mksyscall.awk `cat libcalls-list` > libcalls.go.tmp
597         $(SHELL) $(srcdir)/mvifdiff.sh libcalls.go.tmp libcalls.go
598         $(STAMP) $@
600 libcalls-list: s-libcalls-list; @true
601 s-libcalls-list: Makefile $(srcdir)/go/syscall/*.go
602         rm -f libcalls-list.tmp
603         $(SHELL) $(srcdir)/match.sh --goarch=$(GOARCH) --goos=$(GOOS) --srcdir=$(srcdir)/go/syscall $(matchargs_syscall) > libcalls-list.tmp
604         $(SHELL) $(srcdir)/mvifdiff.sh libcalls-list.tmp libcalls-list
605         $(STAMP) $@
607 syscall_arch.go: s-syscall_arch; @true
608 s-syscall_arch: Makefile
609         rm -f syscall_arch.go.tmp
610         echo "package syscall" > syscall_arch.go.tmp
611         echo 'const ARCH = "'$(GOARCH)'"' >> syscall_arch.go.tmp
612         echo 'const OS = "'$(GOOS)'"' >> syscall_arch.go.tmp
613         $(SHELL) $(srcdir)/mvifdiff.sh syscall_arch.go.tmp syscall_arch.go
614         $(STAMP) $@
616 SYSINFO_FLAGS = \
617         $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \
618         $(CPPFLAGS) $(OSCFLAGS) -O
620 gen-sysinfo.go: s-gen-sysinfo; @true
621 s-gen-sysinfo: $(srcdir)/sysinfo.c config.h
622         $(CC) $(SYSINFO_FLAGS) -fdump-go-spec=tmp-gen-sysinfo.go -std=gnu99 -S -o sysinfo.s $(srcdir)/sysinfo.c
623         rm -f sysinfo.s
624         $(SHELL) $(srcdir)/mvifdiff.sh tmp-gen-sysinfo.go gen-sysinfo.go
625         $(STAMP) $@
627 errno.i: s-errno; @true
628 s-errno:
629         echo '#include <errno.h>' | $(CC) $(SYSINFO_FLAGS) -x c - -E -dM > tmp-errno.i
630         $(SHELL) $(srcdir)/mvifdiff.sh tmp-errno.i errno.i
631         $(STAMP) $@
633 sysinfo.go: s-sysinfo; @true
634 s-sysinfo: $(srcdir)/mksysinfo.sh gen-sysinfo.go errno.i
635         $(SHELL) $(srcdir)/mksysinfo.sh
636         $(SHELL) $(srcdir)/mvifdiff.sh tmp-sysinfo.go sysinfo.go
637         $(STAMP) $@
639 # The epoll struct has an embedded union and is packed on x86_64,
640 # which is too complicated for mksysinfo.sh.  We find the offset of
641 # the only field we care about in configure.ac, and generate the
642 # struct here.
643 epoll.go: s-epoll; @true
644 s-epoll: Makefile
645         rm -f epoll.go.tmp
646         echo 'package syscall' > epoll.go.tmp
647         echo 'type EpollEvent struct {' >> epoll.go.tmp
648         echo '  Events uint32' >> epoll.go.tmp
649         case "$(SIZEOF_STRUCT_EPOLL_EVENT),$(STRUCT_EPOLL_EVENT_FD_OFFSET)" in \
650         0,0) echo 1>&2 "*** struct epoll_event data.fd offset unknown"; \
651            exit 1; ;; \
652         8,4) echo '     Fd int32' >> epoll.go.tmp; ;; \
653         12,4) echo '    Fd int32' >> epoll.go.tmp; \
654            echo '       Pad [4]byte' >> epoll.go.tmp; ;; \
655         12,8) echo '    Pad [4]byte' >> epoll.go.tmp; \
656            echo '       Fd int32' >> epoll.go.tmp; ;; \
657         16,8) echo '    Pad [4]byte' >> epoll.go.tmp; \
658            echo '       Fd int32' >> epoll.go.tmp; \
659            echo '       Pad2 [4]byte' >> epoll.go.tmp; ;; \
660         *) echo 1>&2 "*** struct epoll_event unsupported"; \
661            exit 1; ;; \
662         esac
663         echo '}' >> epoll.go.tmp
664         $(SHELL) $(srcdir)/mvifdiff.sh epoll.go.tmp epoll.go
665         $(STAMP) $@
667 if LIBGO_IS_LINUX
668 syscall_lib_clone_lo = syscall/clone_linux.lo
669 else
670 syscall_lib_clone_lo =
671 endif
673 PACKAGES = \
674         archive/tar \
675         archive/zip \
676         bufio \
677         bytes \
678         cmd/internal/browser \
679         compress/bzip2 \
680         compress/flate \
681         compress/gzip \
682         compress/lzw \
683         compress/zlib \
684         container/heap \
685         container/list \
686         container/ring \
687         context \
688         crypto \
689         crypto/aes \
690         crypto/cipher \
691         crypto/des \
692         crypto/dsa \
693         crypto/ecdsa \
694         crypto/elliptic \
695         crypto/hmac \
696         crypto/internal/cipherhw \
697         crypto/md5 \
698         crypto/rand \
699         crypto/rc4 \
700         crypto/rsa \
701         crypto/sha1 \
702         crypto/sha256 \
703         crypto/sha512 \
704         crypto/subtle \
705         crypto/tls \
706         crypto/x509 \
707         crypto/x509/pkix \
708         database/sql \
709         database/sql/driver \
710         debug/dwarf \
711         debug/elf \
712         debug/gosym \
713         debug/macho \
714         debug/pe \
715         debug/plan9obj \
716         encoding \
717         encoding/ascii85 \
718         encoding/asn1 \
719         encoding/base32 \
720         encoding/base64 \
721         encoding/binary \
722         encoding/csv \
723         encoding/gob \
724         encoding/hex \
725         encoding/json \
726         encoding/pem \
727         encoding/xml \
728         errors \
729         exp/proxy \
730         exp/terminal \
731         expvar \
732         flag \
733         fmt \
734         go/ast \
735         go/build \
736         go/constant \
737         go/doc \
738         go/format \
739         go/importer \
740         go/internal/gccgoimporter \
741         go/internal/gcimporter \
742         go/parser \
743         go/printer \
744         go/scanner \
745         go/token \
746         go/types \
747         golang_org/x/crypto/chacha20poly1305 \
748         golang_org/x/crypto/chacha20poly1305/internal/chacha20 \
749         golang_org/x/crypto/curve25519 \
750         golang_org/x/crypto/poly1305 \
751         golang_org/x/net/http2/hpack \
752         golang_org/x/net/idna \
753         golang_org/x/net/lex/httplex \
754         golang_org/x/text/transform \
755         golang_org/x/text/unicode/norm \
756         golang_org/x/text/width \
757         hash \
758         hash/adler32 \
759         hash/crc32 \
760         hash/crc64 \
761         hash/fnv \
762         html \
763         html/template \
764         image \
765         image/color \
766         image/color/palette \
767         image/draw \
768         image/gif \
769         image/internal/imageutil \
770         image/jpeg \
771         image/png \
772         index/suffixarray \
773         internal/nettrace \
774         internal/pprof/profile \
775         internal/race \
776         internal/singleflight \
777         internal/syscall/unix \
778         internal/testenv \
779         internal/trace \
780         io \
781         io/ioutil \
782         log \
783         log/syslog \
784         math \
785         math/big \
786         math/cmplx \
787         math/rand \
788         mime \
789         mime/multipart \
790         mime/quotedprintable \
791         net \
792         net/http \
793         net/http/cgi \
794         net/http/cookiejar \
795         net/http/fcgi \
796         net/http/httptest \
797         net/http/httptrace \
798         net/http/httputil \
799         net/http/internal \
800         net/http/pprof \
801         net/internal/socktest \
802         net/mail \
803         net/rpc \
804         net/rpc/jsonrpc \
805         net/smtp \
806         net/textproto \
807         net/url \
808         os \
809         os/exec \
810         os/signal \
811         os/user \
812         path \
813         path/filepath \
814         reflect \
815         regexp \
816         regexp/syntax \
817         runtime \
818         runtime/debug \
819         runtime/internal/atomic \
820         runtime/internal/sys \
821         runtime/pprof \
822         runtime/pprof/internal/protopprof \
823         runtime/trace \
824         sort \
825         strconv \
826         strings \
827         sync \
828         sync/atomic \
829         syscall \
830         testing \
831         testing/internal/testdeps \
832         testing/iotest \
833         testing/quick \
834         text/scanner \
835         text/tabwriter \
836         text/template \
837         text/template/parse \
838         time \
839         unicode \
840         unicode/utf16 \
841         unicode/utf8
843 libgo_go_objs = \
844         $(addsuffix .lo,$(PACKAGES)) \
845         bytes/index.lo \
846         reflect/makefunc_ffi_c.lo \
847         strings/index.lo \
848         $(syscall_lib_clone_lo) \
849         syscall/errno.lo \
850         syscall/signame.lo \
851         syscall/wait.lo \
852         $(golang_org_x_net_lif_lo) \
853         $(golang_org_x_net_route_lo) \
854         log/syslog/syslog_c.lo \
855         $(os_lib_inotify_lo) \
856         runtime/internal/atomic_c.lo \
857         sync/atomic_c.lo
859 libgo_ldflags = \
860         -version-info $(libtool_VERSION) $(PTHREAD_CFLAGS) $(AM_LDFLAGS)
862 libgo_libadd = \
863         $(libgo_go_objs) ../libbacktrace/libbacktrace.la \
864         $(LIBATOMIC) $(LIBFFI) $(PTHREAD_LIBS) $(MATH_LIBS) $(NET_LIBS)
866 libgo_la_SOURCES = $(runtime_files)
867 libgo_la_LDFLAGS = $(libgo_ldflags)
868 libgo_la_LIBADD = $(libgo_libadd)
870 libgo_llgo_la_SOURCES = $(runtime_files)
871 libgo_llgo_la_LDFLAGS = $(libgo_ldflags)
872 libgo_llgo_la_LIBADD = $(libgo_libadd)
874 libgobegin_a_SOURCES = \
875         runtime/go-main.c
877 libgobegin_llgo_a_SOURCES = \
878         runtime/go-main.c
880 # Use -fPIC for libgobegin so that it can be put in a PIE.
881 libgobegin_a_CFLAGS = $(AM_CFLAGS) -fPIC
882 libgobegin_llgo_a_CFLAGS = $(AM_CFLAGS) -fPIC
884 libgolibbegin_a_SOURCES = \
885         runtime/go-libmain.c
887 libgolibbegin_a_CFLAGS = $(AM_CFLAGS) -fPIC
889 # Make sure runtime.inc is built before compiling any .c file.
890 $(libgo_la_OBJECTS): runtime.inc
891 $(libgo_llgo_la_OBJECTS): runtime.inc
892 $(libgobegin_a_OBJECTS): runtime.inc
893 $(libgobegin_llgo_a_OBJECTS): runtime.inc
894 $(libgolibbegin_a_OBJECTS): runtime.inc
896 LTLDFLAGS = $(shell $(SHELL) $(top_srcdir)/../libtool-ldflags $(LDFLAGS))
898 GOCFLAGS = $(CFLAGS)
899 AM_GOCFLAGS = $(STRINGOPS_FLAG) $(GO_SPLIT_STACK)
900 GOCOMPILE = $(GOC) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_GOCFLAGS) $(GOCFLAGS)
902 LTGOCOMPILE = $(LIBTOOL) --tag GO --mode=compile $(GOC) $(INCLUDES) \
903         $(AM_GOCFLAGS) $(GOCFLAGS)
905 GOLINK = $(LIBTOOL) --tag GO --mode-link $(GOC) \
906         $(OPT_LDFLAGS) $(SECTION_LDFLAGS) $(AM_GOCFLAGS) $(LTLDFLAGS) -o $@
908 # Build the dependencies for a Go package.
909 BUILDDEPS = \
910         $(MKDIR_P) $(@D); \
911         dir=`echo $@ | sed -e 's/.lo.dep$$//'`; \
912         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,,$@)))`; \
913         $(SHELL) $(srcdir)/godeps.sh `echo $@ | sed -e 's/.dep$$//'` $$files > $@.tmp; \
914         if ! cmp $@.tmp $@ >/dev/null 2>/dev/null; then \
915           rm -f `echo $@ | sed -e 's/\.dep$$//'`; \
916         fi; \
917         mv -f $@.tmp $@
919 # Build the .go files for a package, generating a .lo file.
920 BUILDPACKAGE = \
921         $(MKDIR_P) $(@D); \
922         files=`echo $^ | sed -e 's/[^ ]*\.gox//g' -e 's/[^ ]*\.dep//'`; \
923         $(LTGOCOMPILE) -I . -c -fgo-pkgpath=`echo $@ | sed -e 's/.lo$$//'` $($(subst -,_,$(subst .,_,$(subst /,_,$@)))_GOCFLAGS) -o $@ $$files
925 # How to build a .gox file from a .lo file.
926 BUILDGOX = \
927         f=`echo $< | sed -e 's/.lo$$/.o/'`; \
928         $(OBJCOPY) -j .go_export $$f $@.tmp; \
929         $(SHELL) $(srcdir)/mvifdiff.sh $@.tmp `echo $@ | sed -e 's/s-gox/gox/'`
931 GOTESTFLAGS =
932 GOBENCH = 
934 # Check a package.
935 CHECK = \
936         GC="$(GOC) $(GOCFLAGS) $($(subst /,_,$@)_GOCFLAGS) -L `${PWD_COMMAND}` -L `${PWD_COMMAND}`/.libs"; \
937         export GC; \
938         GOLIBS="$(MATH_LIBS) $(NET_LIBS) $(LIBS)"; \
939         export GOLIBS; \
940         RUNTESTFLAGS="$(RUNTESTFLAGS)"; \
941         export RUNTESTFLAGS; \
942         MAKE="$(MAKE)"; \
943         export MAKE; \
944         libgccdir=`${GOC} -print-libgcc-file-name | sed -e 's|/[^/]*$$||'`; \
945         LD_LIBRARY_PATH="`${PWD_COMMAND}`/.libs:$${libgccdir}:${LD_LIBRARY_PATH}"; \
946         LD_LIBRARY_PATH=`echo $${LD_LIBRARY_PATH} | sed 's,::*,:,g;s,^:*,,;s,:*$$,,'`; \
947         export LD_LIBRARY_PATH; \
948         $(MKDIR_P) $(@D); \
949         rm -f $@-testsum $@-testlog; \
950         files=`$(SHELL) $(srcdir)/match.sh --goarch=$(GOARCH) --goos=$(GOOS) --srcdir=$(srcdir)/go/$(@D) --extrafiles="$(extra_go_files_$(subst /,_,$(@D)))" $(matchargs_$(subst /,_,$(@D)))`; \
951         if test "$(USE_DEJAGNU)" = "yes"; then \
952           $(SHELL) $(srcdir)/testsuite/gotest --goarch=$(GOARCH) --goos=$(GOOS) --dejagnu=yes --basedir=$(srcdir) --srcdir=$(srcdir)/go/$(@D) --pkgpath="$(@D)" --pkgfiles="$$files" --testname="$(@D)" $(GOTESTFLAGS); \
953         elif test "$(GOBENCH)" != ""; then \
954           $(SHELL) $(srcdir)/testsuite/gotest --goarch=$(GOARCH) --goos=$(GOOS) --basedir=$(srcdir) --srcdir=$(srcdir)/go/$(@D) --pkgpath="$(@D)" --pkgfiles="$$files" --bench="$(GOBENCH)" $(GOTESTFLAGS); \
955         else \
956           if $(SHELL) $(srcdir)/testsuite/gotest --goarch=$(GOARCH) --goos=$(GOOS) --basedir=$(srcdir) --srcdir=$(srcdir)/go/$(@D) --pkgpath="$(@D)" --pkgfiles="$$files" $(GOTESTFLAGS) >>$@-testlog 2>&1; then \
957             echo "PASS: $(@D)" >> $@-testlog; \
958             echo "PASS: $(@D)"; \
959             echo "PASS: $(@D)" > $@-testsum; \
960           else \
961             echo "FAIL: $(@D)" >> $@-testlog; \
962             cat $@-testlog; \
963             echo "FAIL: $(@D)" > $@-testsum; \
964             exit 1; \
965           fi; \
966         fi
968 # Build all packages before checking any.
969 CHECK_DEPS = \
970         $(toolexeclibgo_DATA) \
971         $(toolexeclibgoarchive_DATA) \
972         $(toolexeclibgocompress_DATA) \
973         $(toolexeclibgocontainer_DATA) \
974         $(toolexeclibgocrypto_DATA) \
975         $(toolexeclibgodebug_DATA) \
976         $(toolexeclibgoencoding_DATA) \
977         $(toolexeclibgoexp_DATA) \
978         $(toolexeclibgogo_DATA) \
979         $(toolexeclibgohash_DATA) \
980         $(toolexeclibgoimage_DATA) \
981         $(toolexeclibgoindex_DATA) \
982         $(toolexeclibgoio_DATA) \
983         $(toolexeclibgolog_DATA) \
984         $(toolexeclibgomath_DATA) \
985         $(toolexeclibgomime_DATA) \
986         $(toolexeclibgonet_DATA) \
987         $(toolexeclibgonethttp_DATA) \
988         $(toolexeclibgoos_DATA) \
989         $(toolexeclibgopath_DATA) \
990         $(toolexeclibgorpc_DATA) \
991         $(toolexeclibgoruntime_DATA) \
992         $(toolexeclibgosync_DATA) \
993         $(toolexeclibgotesting_DATA) \
994         $(toolexeclibgotext_DATA) \
995         $(toolexeclibgotexttemplate_DATA) \
996         $(toolexeclibgounicode_DATA)
998 if GOC_IS_LLGO
999 CHECK_DEPS += libgo-llgo.la libgobegin-llgo.a
1000 else
1001 CHECK_DEPS += libgo.la libgobegin.a
1002 endif
1004 # PACKAGE_template defines the rules for each package.
1005 # For example, for the package bufio, it produces:
1007 # @go_include@ bufio.lo.dep
1008 # bufio.lo.dep: $(srcdir)/go/bufio/*.go
1009 #       $(BUILDDEPS)
1010 # bufio.lo:
1011 #       $(BUILDPACKAGE)
1012 # bufio/check: $(CHECK_DEPS)
1013 #       @$(CHECK)
1014 # .PHONY: bufio/check
1016 # This is invoked with $(1) set to a package, which is a directory name,
1017 # such as "bufio" or "archive/tar".
1018 define PACKAGE_template
1019 @go_include@ $(1).lo.dep
1020 $(1).lo.dep: $(srcdir)/go/$(1)/*.go
1021         $$(BUILDDEPS)
1022 $(1).lo:
1023         $$(BUILDPACKAGE)
1024 $(1)/check: $$(CHECK_DEPS)
1025         @$$(CHECK)
1026 .PHONY: $(1)/check
1027 $(1).gox: $(1).s-gox; @true
1028 $(1).s-gox: $(1).lo
1029         $$(BUILDGOX)
1030         $$(STAMP) $$@
1031 endef
1033 # This line expands PACKAGE_template once for each package name listed
1034 # in $(PACKAGES).
1035 $(foreach package,$(PACKAGES),$(eval $(call PACKAGE_template,$(package))))
1037 # Pass -ffp-contract=off, or 386-specific options, when building the
1038 # math package.  MATH_FLAG is defined in configure.ac.
1039 math_lo_GOCFLAGS = $(MATH_FLAG)
1041 # Add the generated file runtime_sysinfo.go to the runtime package.
1042 extra_go_files_runtime = runtime_sysinfo.go sigtab.go
1043 runtime.lo.dep: $(extra_go_files_runtime)
1045 # Add generated files to the syscall package.
1046 extra_go_files_syscall = \
1047         libcalls.go \
1048         sysinfo.go \
1049         syscall_arch.go \
1050         $(syscall_epoll_file)
1051 syscall.lo.dep: $(extra_go_files_syscall)
1053 # Pass -fgo-compiling-runtime when compiling the runtime package.
1054 runtime_lo_GOCFLAGS = -fgo-c-header=runtime.inc.tmp -fgo-compiling-runtime
1055 runtime_check_GOCFLAGS = -fgo-compiling-runtime
1056 runtime_internal_atomic_lo_GOCFLAGS = -fgo-compiling-runtime
1057 runtime_internal_atomic_lo_check_GOCFLAGS = -fgo-compiling-runtime
1058 runtime_internal_sys_lo_GOCFLAGS = -fgo-compiling-runtime
1059 runtime_internal_sys_lo_check_GOCFLAGS = -fgo-compiling-runtime
1061 # If libffi is supported (the normal case) use the ffi build tag for
1062 # the runtime package.
1063 if USE_LIBFFI
1064 matchargs_runtime = --tag=libffi
1065 else
1066 matchargs_runtime =
1067 endif
1069 # At least for now, we need -static-libgo for this test, because
1070 # otherwise we can't get the line numbers.
1071 # Also use -fno-inline to get better results from the memory profiler.
1072 runtime_pprof_check_GOCFLAGS = -static-libgo -fno-inline
1074 extra_go_files_runtime_internal_sys = version.go
1075 runtime/internal/sys.lo.dep: $(extra_go_files_runtime_internal_sys)
1077 # FIXME: The following C files may as well move to the runtime
1078 # directory and be treated like other C files.
1080 # Use C code to speed up {bytes,strings}.IndexByte and friends.
1081 bytes/index.lo: go/bytes/indexbyte.c runtime.inc
1082         @$(MKDIR_P) bytes
1083         $(LTCOMPILE) -c -o $@ $(srcdir)/go/bytes/indexbyte.c
1084 strings/index.lo: go/strings/indexbyte.c runtime.inc
1085         @$(MKDIR_P) strings
1086         $(LTCOMPILE) -c -o $@ $(srcdir)/go/strings/indexbyte.c
1088 # Use a C function with a fixed number of arguments to call a C
1089 # varargs function.
1090 log/syslog/syslog_c.lo: go/log/syslog/syslog_c.c runtime.inc
1091         @$(MKDIR_P) log/syslog
1092         $(LTCOMPILE) -c -o $@ $(srcdir)/go/log/syslog/syslog_c.c
1094 # The interface to libffi from the reflect package is written in C.
1095 reflect/makefunc_ffi_c.lo: go/reflect/makefunc_ffi_c.c runtime.inc
1096         @$(MKDIR_P) reflect
1097         $(LTCOMPILE) -c -o $@ $(srcdir)/go/reflect/makefunc_ffi_c.c
1099 # The atomic functions are written in C.
1100 runtime/internal/atomic_c.lo: go/runtime/internal/atomic/atomic.c runtime.inc
1101         @$(MKDIR_P) runtime/internal
1102         $(LTCOMPILE) -c -o $@ $(srcdir)/go/runtime/internal/atomic/atomic.c
1103 sync/atomic_c.lo: go/sync/atomic/atomic.c runtime.inc
1104         @$(MKDIR_P) sync
1105         $(LTCOMPILE) -c -o $@ $(srcdir)/go/sync/atomic/atomic.c
1107 # A few syscall functions are written in C.
1108 syscall/clone_linux.lo: go/syscall/clone_linux.c runtime.inc
1109         @$(MKDIR_P) syscall
1110         $(LTCOMPILE) -c -o $@ $(srcdir)/go/syscall/clone_linux.c
1111 syscall/errno.lo: go/syscall/errno.c runtime.inc
1112         @$(MKDIR_P) syscall
1113         $(LTCOMPILE) -c -o $@ $(srcdir)/go/syscall/errno.c
1114 syscall/signame.lo: go/syscall/signame.c runtime.inc
1115         @$(MKDIR_P) syscall
1116         $(LTCOMPILE) -c -o $@ $(srcdir)/go/syscall/signame.c
1117 syscall/wait.lo: go/syscall/wait.c runtime.inc
1118         @$(MKDIR_P) syscall
1119         $(LTCOMPILE) -c -o $@ $(srcdir)/go/syscall/wait.c
1121 # Solaris 12 changed the type of fields in struct stat.
1122 # Use a build tag, based on a configure check, to cope.
1123 if LIBGO_IS_SOLARIS
1124 if HAVE_STAT_TIMESPEC
1125 matchargs_os = --tag=solaristag
1126 else
1127 matchargs_os =
1128 endif
1129 else
1130 matchargs_os =
1131 endif
1133 if LIBGO_IS_BSD
1135 # Build golang_org/x/net/route only on BSD systems.
1137 $(eval $(call PACKAGE_template,golang_org/x/net/route))
1139 golang_org_x_net_route_lo = \
1140         golang_org/x/net/route.lo
1141 golang_org_x_net_route_check = \
1142         golang_org/x/net/route/check
1144 endif
1146 if LIBGO_IS_SOLARIS
1148 # Build golang_org/x/net/lif only on Solaris systems.
1150 $(eval $(call PACKAGE_template,golang_org/x/net/lif))
1152 golang_org_x_net_lif_lo = \
1153         golang_org/x/net/lif.lo
1154 golang_org_x_net_lif_check = \
1155         golang_org/x/net/lif/check
1157 endif
1159 TEST_PACKAGES = \
1160         bufio/check \
1161         bytes/check \
1162         context/check \
1163         errors/check \
1164         expvar/check \
1165         flag/check \
1166         fmt/check \
1167         html/check \
1168         image/check \
1169         io/check \
1170         log/check \
1171         math/check \
1172         mime/check \
1173         net/check \
1174         os/check \
1175         path/check \
1176         reflect/check \
1177         regexp/check \
1178         runtime/check \
1179         sort/check \
1180         strconv/check \
1181         strings/check \
1182         sync/check \
1183         syscall/check \
1184         time/check \
1185         unicode/check \
1186         archive/tar/check \
1187         archive/zip/check \
1188         compress/bzip2/check \
1189         compress/flate/check \
1190         compress/gzip/check \
1191         compress/lzw/check \
1192         compress/zlib/check \
1193         container/heap/check \
1194         container/list/check \
1195         container/ring/check \
1196         crypto/aes/check \
1197         crypto/cipher/check \
1198         crypto/des/check \
1199         crypto/dsa/check \
1200         crypto/ecdsa/check \
1201         crypto/elliptic/check \
1202         crypto/hmac/check \
1203         crypto/md5/check \
1204         crypto/rand/check \
1205         crypto/rc4/check \
1206         crypto/rsa/check \
1207         crypto/sha1/check \
1208         crypto/sha256/check \
1209         crypto/sha512/check \
1210         crypto/subtle/check \
1211         crypto/tls/check \
1212         crypto/x509/check \
1213         database/sql/check \
1214         database/sql/driver/check \
1215         debug/dwarf/check \
1216         debug/elf/check \
1217         debug/macho/check \
1218         debug/pe/check \
1219         debug/plan9obj/check \
1220         encoding/ascii85/check \
1221         encoding/asn1/check \
1222         encoding/base32/check \
1223         encoding/base64/check \
1224         encoding/binary/check \
1225         encoding/csv/check \
1226         encoding/gob/check \
1227         encoding/hex/check \
1228         encoding/json/check \
1229         encoding/pem/check \
1230         encoding/xml/check \
1231         exp/proxy/check \
1232         exp/terminal/check \
1233         html/template/check \
1234         go/ast/check \
1235         go/build/check \
1236         go/constant/check \
1237         go/doc/check \
1238         go/format/check \
1239         go/internal/gcimporter/check \
1240         go/internal/gccgoimporter/check \
1241         go/parser/check \
1242         go/printer/check \
1243         go/scanner/check \
1244         go/token/check \
1245         go/types/check \
1246         golang_org/x/crypto/chacha20poly1305/check \
1247         golang_org/x/crypto/chacha20poly1305/internal/chacha20/check \
1248         golang_org/x/crypto/curve25519/check \
1249         golang_org/x/crypto/poly1305/check \
1250         golang_org/x/net/http2/hpack/check \
1251         golang_org/x/net/idna/check \
1252         golang_org/x/net/lex/httplex/check \
1253         $(golang_org_x_net_lif_check) \
1254         $(golang_org_x_net_route_check) \
1255         hash/adler32/check \
1256         hash/crc32/check \
1257         hash/crc64/check \
1258         hash/fnv/check \
1259         image/color/check \
1260         image/draw/check \
1261         image/jpeg/check \
1262         image/png/check \
1263         index/suffixarray/check \
1264         internal/pprof/profile/check \
1265         internal/singleflight/check \
1266         internal/trace/check \
1267         io/ioutil/check \
1268         log/syslog/check \
1269         math/big/check \
1270         math/cmplx/check \
1271         math/rand/check \
1272         mime/multipart/check \
1273         mime/quotedprintable/check \
1274         net/http/check \
1275         net/http/cgi/check \
1276         net/http/cookiejar/check \
1277         net/http/fcgi/check \
1278         net/http/httptest/check \
1279         net/http/httptrace/check \
1280         net/http/httputil/check \
1281         net/http/internal/check \
1282         net/internal/socktest/check \
1283         net/mail/check \
1284         net/rpc/check \
1285         net/smtp/check \
1286         net/textproto/check \
1287         net/url/check \
1288         net/rpc/jsonrpc/check \
1289         os/exec/check \
1290         os/signal/check \
1291         os/user/check \
1292         path/filepath/check \
1293         regexp/syntax/check \
1294         runtime/debug/check \
1295         runtime/internal/atomic/check \
1296         runtime/internal/sys/check \
1297         runtime/pprof/check \
1298         runtime/pprof/internal/protopprof/check \
1299         sync/atomic/check \
1300         text/scanner/check \
1301         text/tabwriter/check \
1302         text/template/check \
1303         text/template/parse/check \
1304         testing/quick/check \
1305         unicode/utf16/check \
1306         unicode/utf8/check
1308 check: check-tail
1309 check-recursive: check-head
1311 check-head:
1312         @echo "Test Run By $${USER} on `date`" > libgo.head
1313         @echo "Native configuration is $(host_triplet)" >> libgo.head
1314         @echo >> libgo.head
1315         @echo "         === libgo tests ===" >> libgo.head
1316         @echo >> libgo.head
1318 check-tail: check-recursive check-multi
1319         @if test "$(USE_DEJAGNU)" = "yes"; then \
1320           exit 0; \
1321         fi; \
1322         lib=`${PWD_COMMAND} | sed -e 's,^.*/\([^/][^/]*\)$$,\1,'`; \
1323         for dir in . $(MULTIDIRS); do \
1324           mv ../$${dir}/$${lib}/libgo.sum ../$${dir}/$${lib}/libgo.sum.sep; \
1325           mv ../$${dir}/$${lib}/libgo.log ../$${dir}/$${lib}/libgo.log.sep; \
1326         done; \
1327         mv libgo.head libgo.sum; \
1328         cp libgo.sum libgo.log; \
1329         echo "Schedule of variations:" >> libgo.sum; \
1330         for dir in . $(MULTIDIRS); do \
1331           multidir=../$${dir}/$${lib}; \
1332           multivar=`cat $${multidir}/libgo.var`; \
1333           echo "    $${multivar}" >> libgo.sum; \
1334         done; \
1335         echo >> libgo.sum; \
1336         pass=0; fail=0; untested=0; \
1337         for dir in . $(MULTIDIRS); do \
1338           multidir=../$${dir}/$${lib}; \
1339           multivar=`cat $${multidir}/libgo.var`; \
1340           echo "Running target $${multivar}" >> libgo.sum; \
1341           echo "Running $(srcdir)/libgo.exp ..." >> libgo.sum; \
1342           cat $${multidir}/libgo.sum.sep >> libgo.sum; \
1343           cat $${multidir}/libgo.log.sep >> libgo.log; \
1344           if test -n "${MULTIDIRS}"; then \
1345             echo "              === libgo Summary for $${multivar} ===" >> libgo.sum; \
1346             echo >> libgo.sum; \
1347           fi; \
1348           p=`grep -c PASS $${multidir}/libgo.sum.sep`; \
1349           pass=`expr $$pass + $$p`; \
1350           if test "$$p" -ne "0" && test -n "${MULTIDIRS}"; then \
1351             echo "# of expected passes          $$p" >> libgo.sum; \
1352           fi; \
1353           p=`grep -c FAIL $${multidir}/libgo.sum.sep`; \
1354           fail=`expr $$fail + $$p`; \
1355           if test "$$p" -ne "0" && test -n "${MULTIDIRS}"; then \
1356             echo "# of unexpected failures      $$p" >> libgo.sum; \
1357           fi; \
1358           p=`grep -c UNTESTED $${multidir}/libgo.sum.sep`; \
1359           untested=`expr $$untested + $$p`; \
1360           if test "$$p" -ne "0" && test -n "${MULTIDIRS}"; then \
1361             echo "# of untested testcases               $$p" >> libgo.sum; \
1362           fi; \
1363         done; \
1364         echo >> libgo.sum; \
1365         echo "          === libgo Summary ===" >> libgo.sum; \
1366         echo >> libgo.sum; \
1367         if test "$$pass" -ne "0"; then \
1368           echo "# of expected passes            $$pass" >> libgo.sum; \
1369         fi; \
1370         if test "$$fail" -ne "0"; then \
1371           echo "# of unexpected failures        $$fail" >> libgo.sum; \
1372         fi; \
1373         if test "$$untested" -ne "0"; then \
1374           echo "# of untested testcases         $$untested" >> libgo.sum; \
1375         fi; \
1376         echo `echo $(GOC) | sed -e 's/ .*//'`  `$(GOC) -v 2>&1 | grep " version" | sed -n -e 's/.* \(version.*$$\)/\1/p'` >> libgo.sum; \
1377         echo >> libgo.log; \
1378         echo "runtest completed at `date`" >> libgo.log; \
1379         if test "$$fail" -ne "0"; then \
1380           status=1; \
1381         else \
1382           status=0; \
1383         fi; \
1384         exit $$status
1386 check-am:
1387         @rm -f libgo.sum libgo.log libgo.tail
1388         @multivar="unix"; \
1389         [ -z "$(MULTIFLAGS)" ] || multivar="$${multivar}/$(MULTIFLAGS)"; \
1390         echo "$${multivar}" > libgo.var
1391         @for f in $(TEST_PACKAGES); do \
1392            rm -f $$f-testsum $$f-testlog; \
1393          done
1394         -@$(MAKE) -k $(TEST_PACKAGES)
1395         @for f in $(TEST_PACKAGES); do \
1396           if test -f $$f-testsum; then \
1397             cat $$f-testsum >> libgo.sum; \
1398           fi; \
1399           if test -f $$f-testlog; then \
1400             cat $$f-testlog >> libgo.log; \
1401           fi; \
1402         done
1404 check-multi:
1405         $(MULTIDO) $(AM_MAKEFLAGS) DO=check-am multi-do # $(MAKE)
1407 bench:
1408         -@$(MAKE) -k $(TEST_PACKAGES) GOBENCH=.
1410 MOSTLYCLEAN_FILES = libgo.head libgo.sum.sep libgo.log.sep
1412 mostlyclean-local:
1413         find . -name '*.lo' -print | xargs $(LIBTOOL) --mode=clean rm -f
1414         find . -name '*.$(OBJEXT)' -print | xargs rm -f
1415         find . -name '*-testsum' -print | xargs rm -f
1416         find . -name '*-testlog' -print | xargs rm -f
1418 CLEANFILES = *.go *.gox goc2c *.c s-version libgo.sum libgo.log
1420 clean-local:
1421         find . -name '*.la' -print | xargs $(LIBTOOL) --mode=clean rm -f
1422         find . -name '*.a' -print | xargs rm -f