[AArch64] Separate shrink wrapping hooks implementation
[official-gcc.git] / libgo / Makefile.am
blob7165dfd3acf1f5f4be9c3bd28d126647725a6871
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) $(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
351 toolexeclibgosyncdir = $(toolexeclibgodir)/sync
353 toolexeclibgosync_DATA = \
354         sync/atomic.gox
356 toolexeclibgotestingdir = $(toolexeclibgodir)/testing
358 toolexeclibgotesting_DATA = \
359         testing/iotest.gox \
360         testing/quick.gox
362 toolexeclibgotextdir = $(toolexeclibgodir)/text
364 toolexeclibgotext_DATA = \
365         text/scanner.gox \
366         text/tabwriter.gox \
367         text/template.gox
369 toolexeclibgotexttemplatedir = $(toolexeclibgotextdir)/template
371 toolexeclibgotexttemplate_DATA = \
372         text/template/parse.gox
374 toolexeclibgounicodedir = $(toolexeclibgodir)/unicode
376 toolexeclibgounicode_DATA = \
377         unicode/utf16.gox \
378         unicode/utf8.gox
380 if HAVE_SYS_MMAN_H
381 runtime_mem_file = runtime/mem.c
382 else
383 runtime_mem_file = runtime/mem_posix_memalign.c
384 endif
386 if LIBGO_IS_RTEMS
387 rtems_task_variable_add_file = runtime/rtems-task-variable-add.c
388 else
389 rtems_task_variable_add_file =
390 endif
392 if LIBGO_IS_LINUX
393 runtime_thread_files = runtime/thread-linux.c
394 else
395 runtime_thread_files = runtime/thread-sema.c
396 endif
398 if LIBGO_IS_LINUX
399 runtime_getncpu_file = runtime/getncpu-linux.c
400 else
401 if LIBGO_IS_DARWIN
402 runtime_getncpu_file = runtime/getncpu-bsd.c
403 else
404 if LIBGO_IS_IRIX
405 runtime_getncpu_file = runtime/getncpu-irix.c
406 else
407 if LIBGO_IS_SOLARIS
408 runtime_getncpu_file = runtime/getncpu-solaris.c
409 else
410 if LIBGO_IS_FREEBSD
411 runtime_getncpu_file = runtime/getncpu-bsd.c
412 else
413 if LIBGO_IS_NETBSD
414 runtime_getncpu_file = runtime/getncpu-bsd.c
415 else
416 runtime_getncpu_file = runtime/getncpu-none.c
417 endif
418 endif
419 endif
420 endif
421 endif
422 endif
424 runtime_files = \
425         runtime/go-assert.c \
426         runtime/go-breakpoint.c \
427         runtime/go-caller.c \
428         runtime/go-callers.c \
429         runtime/go-cdiv.c \
430         runtime/go-cgo.c \
431         runtime/go-construct-map.c \
432         runtime/go-ffi.c \
433         runtime/go-fieldtrack.c \
434         runtime/go-matherr.c \
435         runtime/go-memclr.c \
436         runtime/go-memcmp.c \
437         runtime/go-memequal.c \
438         runtime/go-memmove.c \
439         runtime/go-nanotime.c \
440         runtime/go-now.c \
441         runtime/go-new.c \
442         runtime/go-nosys.c \
443         runtime/go-reflect-call.c \
444         runtime/go-runtime-error.c \
445         runtime/go-setenv.c \
446         runtime/go-signal.c \
447         runtime/go-strslice.c \
448         runtime/go-type-complex.c \
449         runtime/go-type-float.c \
450         runtime/go-type-identity.c \
451         runtime/go-type-string.c \
452         runtime/go-typedesc-equal.c \
453         runtime/go-unsafe-new.c \
454         runtime/go-unsafe-newarray.c \
455         runtime/go-unsafe-pointer.c \
456         runtime/go-unsetenv.c \
457         runtime/go-unwind.c \
458         runtime/go-varargs.c \
459         runtime/env_posix.c \
460         runtime/heapdump.c \
461         runtime/mcache.c \
462         runtime/mcentral.c \
463         $(runtime_mem_file) \
464         runtime/mfixalloc.c \
465         runtime/mgc0.c \
466         runtime/mheap.c \
467         runtime/msize.c \
468         runtime/panic.c \
469         runtime/parfor.c \
470         runtime/print.c \
471         runtime/proc.c \
472         runtime/runtime_c.c \
473         runtime/thread.c \
474         $(runtime_thread_files) \
475         runtime/yield.c \
476         $(rtems_task_variable_add_file) \
477         malloc.c \
478         $(runtime_getncpu_file)
480 goc2c.$(OBJEXT): runtime/goc2c.c
481         $(CC_FOR_BUILD) -c $(CFLAGS_FOR_BUILD) $<
483 goc2c: goc2c.$(OBJEXT)
484         $(CC_FOR_BUILD) $(CFLAGS_FOR_BUILD) $(LDFLAGS_FOR_BUILD) -o $@ $<
486 malloc.c: $(srcdir)/runtime/malloc.goc goc2c
487         ./goc2c $< > $@.tmp
488         mv -f $@.tmp $@
490 %.c: $(srcdir)/runtime/%.goc goc2c
491         ./goc2c $< > $@.tmp
492         mv -f $@.tmp $@
494 version.go: s-version; @true
495 s-version: Makefile
496         rm -f version.go.tmp
497         echo "package sys" > version.go.tmp
498         echo 'const DefaultGoroot = "$(prefix)"' >> version.go.tmp
499         echo 'const TheVersion = "'`cat $(srcdir)/VERSION | sed 1q`' '`$(GOC) --version | sed 1q`'"' >> version.go.tmp
500         echo 'const GOARCH = "'$(GOARCH)'"' >> version.go.tmp
501         echo 'const GOOS = "'$(GOOS)'"' >> version.go.tmp
502         echo 'const GccgoToolDir = "$(libexecsubdir)"' >> version.go.tmp
503         echo >> version.go.tmp
504         echo "type ArchFamilyType int" >> version.go.tmp
505         echo >> version.go.tmp
506         echo "const (" >> version.go.tmp
507         echo "  UNKNOWN ArchFamilyType = iota" >> version.go.tmp
508         for a in $(ALLGOARCHFAMILY); do \
509           echo "        $${a}" >> version.go.tmp; \
510         done
511         echo ")" >> version.go.tmp
512         echo >> version.go.tmp
513         for a in $(ALLGOARCH); do \
514           f=`echo $${a} | sed -e 's/\(.\).*/\1/' -e 'y/abcdefghijklmnopqrstuvwxyz/ABCDEFGHIJKLMNOPQRSTUVWXYZ/'`; \
515           n="$${f}`echo $${a} | sed -e 's/.//'`"; \
516           if test "$${a}" = "$(GOARCH)"; then \
517             echo "const Goarch$${n} = 1" >> version.go.tmp; \
518           else \
519             echo "const Goarch$${n} = 0" >> version.go.tmp; \
520           fi; \
521         done
522         echo >> version.go.tmp
523         echo "const (" >> version.go.tmp
524         echo "  ArchFamily = $(GOARCH_FAMILY)" >> version.go.tmp
525         echo "  BigEndian = $(GOARCH_BIGENDIAN)" >> version.go.tmp
526         echo "  CacheLineSize = $(GOARCH_CACHELINESIZE)" >> version.go.tmp
527         echo "  PhysPageSize = $(GOARCH_PHYSPAGESIZE)" >> version.go.tmp
528         echo "  PCQuantum = $(GOARCH_PCQUANTUM)" >> version.go.tmp
529         echo "  Int64Align = $(GOARCH_INT64ALIGN)" >> version.go.tmp
530         echo "  HugePageSize = $(GOARCH_HUGEPAGESIZE)" >> version.go.tmp
531         echo "  MinFrameSize = $(GOARCH_MINFRAMESIZE)" >> version.go.tmp
532         echo ")" >> version.go.tmp
533         echo >> version.go.tmp
534         for a in $(ALLGOOS); do \
535           f=`echo $${a} | sed -e 's/\(.\).*/\1/' -e 'y/abcdefghijklmnopqrstuvwxyz/ABCDEFGHIJKLMNOPQRSTUVWXYZ/'`; \
536           n="$${f}`echo $${a} | sed -e 's/.//'`"; \
537           if test "$${a}" = "$(GOOS)"; then \
538             echo "const Goos$${n} = 1" >> version.go.tmp; \
539           else \
540             echo "const Goos$${n} = 0" >> version.go.tmp; \
541           fi; \
542         done
543         echo >> version.go.tmp
544         echo "type Uintreg uintptr" >> version.go.tmp
545         $(SHELL) $(srcdir)/mvifdiff.sh version.go.tmp version.go
546         $(STAMP) $@
548 runtime_sysinfo.go: s-runtime_sysinfo; @true
549 s-runtime_sysinfo: $(srcdir)/mkrsysinfo.sh gen-sysinfo.go
550         $(SHELL) $(srcdir)/mkrsysinfo.sh
551         $(SHELL) $(srcdir)/mvifdiff.sh tmp-runtime_sysinfo.go runtime_sysinfo.go
552         $(STAMP) $@
554 sigtab.go: s-sigtab; @true
555 s-sigtab: $(srcdir)/mksigtab.sh gen-sysinfo.go
556         GOOS=$(GOOS) $(SHELL) $(srcdir)/mksigtab.sh > tmp-sigtab.go
557         $(SHELL) $(srcdir)/mvifdiff.sh tmp-sigtab.go sigtab.go
558         $(STAMP) $@
560 runtime.inc: s-runtime-inc; @true
561 s-runtime-inc: runtime.lo Makefile
562         rm -f runtime.inc.tmp2
563         grep -v "#define _" runtime.inc.tmp | grep -v "#define c[01] " > runtime.inc.tmp2
564         for pattern in '_[GP][a-z]' _Max _Lock _Sig _Trace _MHeap _Num; do \
565           grep "#define $$pattern" runtime.inc.tmp >> runtime.inc.tmp2; \
566         done
567         $(SHELL) $(srcdir)/mvifdiff.sh runtime.inc.tmp2 runtime.inc
568         $(STAMP) $@
570 noinst_DATA = zstdpkglist.go
572 # Generate the list of go std packages that were included in libgo
573 zstdpkglist.go: s-zstdpkglist; @true
574 s-zstdpkglist: Makefile
575         rm -f zstdpkglist.go.tmp
576         echo 'package main' > zstdpkglist.go.tmp
577         echo "" >> zstdpkglist.go.tmp
578         echo 'var stdpkg = map[string]bool{' >> zstdpkglist.go.tmp
579         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
580         echo '}' >> zstdpkglist.go.tmp
581         $(SHELL) $(srcdir)/mvifdiff.sh zstdpkglist.go.tmp zstdpkglist.go
582         $(STAMP) $@
584 if LIBGO_IS_LINUX
585 syscall_epoll_file = epoll.go
586 else
587 syscall_epoll_file =
588 endif
590 libcalls.go: s-libcalls; @true
591 s-libcalls: libcalls-list go/syscall/mksyscall.awk $(srcdir)/go/syscall/*.go
592         rm -f libcalls.go.tmp
593         $(AWK) -f $(srcdir)/go/syscall/mksyscall.awk `cat libcalls-list` > libcalls.go.tmp
594         $(SHELL) $(srcdir)/mvifdiff.sh libcalls.go.tmp libcalls.go
595         $(STAMP) $@
597 libcalls-list: s-libcalls-list; @true
598 s-libcalls-list: Makefile $(srcdir)/go/syscall/*.go
599         rm -f libcalls-list.tmp
600         $(SHELL) $(srcdir)/match.sh --goarch=$(GOARCH) --goos=$(GOOS) --srcdir=$(srcdir)/go/syscall $(matchargs_syscall) > libcalls-list.tmp
601         $(SHELL) $(srcdir)/mvifdiff.sh libcalls-list.tmp libcalls-list
602         $(STAMP) $@
604 syscall_arch.go: s-syscall_arch; @true
605 s-syscall_arch: Makefile
606         rm -f syscall_arch.go.tmp
607         echo "package syscall" > syscall_arch.go.tmp
608         echo 'const ARCH = "'$(GOARCH)'"' >> syscall_arch.go.tmp
609         echo 'const OS = "'$(GOOS)'"' >> syscall_arch.go.tmp
610         $(SHELL) $(srcdir)/mvifdiff.sh syscall_arch.go.tmp syscall_arch.go
611         $(STAMP) $@
613 SYSINFO_FLAGS = \
614         $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \
615         $(CPPFLAGS) $(OSCFLAGS) -O
617 gen-sysinfo.go: s-gen-sysinfo; @true
618 s-gen-sysinfo: $(srcdir)/sysinfo.c config.h
619         $(CC) $(SYSINFO_FLAGS) -fdump-go-spec=tmp-gen-sysinfo.go -std=gnu99 -S -o sysinfo.s $(srcdir)/sysinfo.c
620         rm -f sysinfo.s
621         $(SHELL) $(srcdir)/mvifdiff.sh tmp-gen-sysinfo.go gen-sysinfo.go
622         $(STAMP) $@
624 errno.i: s-errno; @true
625 s-errno:
626         echo '#include <errno.h>' | $(CC) $(SYSINFO_FLAGS) -x c - -E -dM > tmp-errno.i
627         $(SHELL) $(srcdir)/mvifdiff.sh tmp-errno.i errno.i
628         $(STAMP) $@
630 sysinfo.go: s-sysinfo; @true
631 s-sysinfo: $(srcdir)/mksysinfo.sh gen-sysinfo.go errno.i
632         $(SHELL) $(srcdir)/mksysinfo.sh
633         $(SHELL) $(srcdir)/mvifdiff.sh tmp-sysinfo.go sysinfo.go
634         $(STAMP) $@
636 # The epoll struct has an embedded union and is packed on x86_64,
637 # which is too complicated for mksysinfo.sh.  We find the offset of
638 # the only field we care about in configure.ac, and generate the
639 # struct here.
640 epoll.go: s-epoll; @true
641 s-epoll: Makefile
642         rm -f epoll.go.tmp
643         echo 'package syscall' > epoll.go.tmp
644         echo 'type EpollEvent struct {' >> epoll.go.tmp
645         echo '  Events uint32' >> epoll.go.tmp
646         case "$(SIZEOF_STRUCT_EPOLL_EVENT),$(STRUCT_EPOLL_EVENT_FD_OFFSET)" in \
647         0,0) echo 1>&2 "*** struct epoll_event data.fd offset unknown"; \
648            exit 1; ;; \
649         8,4) echo '     Fd int32' >> epoll.go.tmp; ;; \
650         12,4) echo '    Fd int32' >> epoll.go.tmp; \
651            echo '       Pad [4]byte' >> epoll.go.tmp; ;; \
652         12,8) echo '    Pad [4]byte' >> epoll.go.tmp; \
653            echo '       Fd int32' >> epoll.go.tmp; ;; \
654         16,8) echo '    Pad [4]byte' >> epoll.go.tmp; \
655            echo '       Fd int32' >> epoll.go.tmp; \
656            echo '       Pad2 [4]byte' >> epoll.go.tmp; ;; \
657         *) echo 1>&2 "*** struct epoll_event unsupported"; \
658            exit 1; ;; \
659         esac
660         echo '}' >> epoll.go.tmp
661         $(SHELL) $(srcdir)/mvifdiff.sh epoll.go.tmp epoll.go
662         $(STAMP) $@
664 if LIBGO_IS_LINUX
665 syscall_lib_clone_lo = syscall/clone_linux.lo
666 else
667 syscall_lib_clone_lo =
668 endif
670 PACKAGES = \
671         archive/tar \
672         archive/zip \
673         bufio \
674         bytes \
675         compress/bzip2 \
676         compress/flate \
677         compress/gzip \
678         compress/lzw \
679         compress/zlib \
680         container/heap \
681         container/list \
682         container/ring \
683         context \
684         crypto \
685         crypto/aes \
686         crypto/cipher \
687         crypto/des \
688         crypto/dsa \
689         crypto/ecdsa \
690         crypto/elliptic \
691         crypto/hmac \
692         crypto/md5 \
693         crypto/rand \
694         crypto/rc4 \
695         crypto/rsa \
696         crypto/sha1 \
697         crypto/sha256 \
698         crypto/sha512 \
699         crypto/subtle \
700         crypto/tls \
701         crypto/x509 \
702         crypto/x509/pkix \
703         database/sql \
704         database/sql/driver \
705         debug/dwarf \
706         debug/elf \
707         debug/gosym \
708         debug/macho \
709         debug/pe \
710         debug/plan9obj \
711         encoding \
712         encoding/ascii85 \
713         encoding/asn1 \
714         encoding/base32 \
715         encoding/base64 \
716         encoding/binary \
717         encoding/csv \
718         encoding/gob \
719         encoding/hex \
720         encoding/json \
721         encoding/pem \
722         encoding/xml \
723         errors \
724         exp/proxy \
725         exp/terminal \
726         expvar \
727         flag \
728         fmt \
729         go/ast \
730         go/build \
731         go/constant \
732         go/doc \
733         go/format \
734         go/importer \
735         go/internal/gccgoimporter \
736         go/internal/gcimporter \
737         go/parser \
738         go/printer \
739         go/scanner \
740         go/token \
741         go/types \
742         golang_org/x/net/http2/hpack \
743         golang_org/x/net/lex/httplex \
744         hash \
745         hash/adler32 \
746         hash/crc32 \
747         hash/crc64 \
748         hash/fnv \
749         html \
750         html/template \
751         image \
752         image/color \
753         image/color/palette \
754         image/draw \
755         image/gif \
756         image/internal/imageutil \
757         image/jpeg \
758         image/png \
759         index/suffixarray \
760         internal/nettrace \
761         internal/race \
762         internal/singleflight \
763         internal/syscall/unix \
764         internal/testenv \
765         internal/trace \
766         io \
767         io/ioutil \
768         log \
769         log/syslog \
770         math \
771         math/big \
772         math/cmplx \
773         math/rand \
774         mime \
775         mime/multipart \
776         mime/quotedprintable \
777         net \
778         net/http \
779         net/http/cgi \
780         net/http/cookiejar \
781         net/http/fcgi \
782         net/http/httptest \
783         net/http/httptrace \
784         net/http/httputil \
785         net/http/internal \
786         net/http/pprof \
787         net/internal/socktest \
788         net/mail \
789         net/rpc \
790         net/rpc/jsonrpc \
791         net/smtp \
792         net/textproto \
793         net/url \
794         os \
795         os/exec \
796         os/signal \
797         os/user \
798         path \
799         path/filepath \
800         reflect \
801         regexp \
802         regexp/syntax \
803         runtime \
804         runtime/debug \
805         runtime/internal/atomic \
806         runtime/internal/sys \
807         runtime/pprof \
808         sort \
809         strconv \
810         strings \
811         sync \
812         sync/atomic \
813         syscall \
814         testing \
815         testing/iotest \
816         testing/quick \
817         text/scanner \
818         text/tabwriter \
819         text/template \
820         text/template/parse \
821         time \
822         unicode \
823         unicode/utf16 \
824         unicode/utf8
826 libgo_go_objs = \
827         $(addsuffix .lo,$(PACKAGES)) \
828         bytes/index.lo \
829         reflect/makefunc_ffi_c.lo \
830         strings/index.lo \
831         $(syscall_lib_clone_lo) \
832         syscall/errno.lo \
833         syscall/signame.lo \
834         syscall/wait.lo \
835         $(golang_org_x_net_route_lo) \
836         log/syslog/syslog_c.lo \
837         $(os_lib_inotify_lo) \
838         runtime/internal/atomic_c.lo \
839         sync/atomic_c.lo
841 libgo_ldflags = \
842         -version-info $(libtool_VERSION) $(PTHREAD_CFLAGS) $(AM_LDFLAGS)
844 libgo_libadd = \
845         $(libgo_go_objs) ../libbacktrace/libbacktrace.la \
846         $(LIBATOMIC) $(LIBFFI) $(PTHREAD_LIBS) $(MATH_LIBS) $(NET_LIBS)
848 libgo_la_SOURCES = $(runtime_files)
849 libgo_la_LDFLAGS = $(libgo_ldflags)
850 libgo_la_LIBADD = $(libgo_libadd)
852 libgo_llgo_la_SOURCES = $(runtime_files)
853 libgo_llgo_la_LDFLAGS = $(libgo_ldflags)
854 libgo_llgo_la_LIBADD = $(libgo_libadd)
856 libgobegin_a_SOURCES = \
857         runtime/go-main.c
859 libgobegin_llgo_a_SOURCES = \
860         runtime/go-main.c
862 # Use -fPIC for libgobegin so that it can be put in a PIE.
863 libgobegin_a_CFLAGS = $(AM_CFLAGS) -fPIC
864 libgobegin_llgo_a_CFLAGS = $(AM_CFLAGS) -fPIC
866 libgolibbegin_a_SOURCES = \
867         runtime/go-libmain.c
869 libgolibbegin_a_CFLAGS = $(AM_CFLAGS) -fPIC
871 # Make sure runtime.inc is built before compiling any .c file.
872 $(libgo_la_OBJECTS): runtime.inc
873 $(libgo_llgo_la_OBJECTS): runtime.inc
874 $(libgobegin_a_OBJECTS): runtime.inc
875 $(libgobegin_llgo_a_OBJECTS): runtime.inc
876 $(libgolibbegin_a_OBJECTS): runtime.inc
878 LTLDFLAGS = $(shell $(SHELL) $(top_srcdir)/../libtool-ldflags $(LDFLAGS))
880 GOCFLAGS = $(CFLAGS)
881 AM_GOCFLAGS = $(STRINGOPS_FLAG) $(GO_SPLIT_STACK)
882 GOCOMPILE = $(GOC) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_GOCFLAGS) $(GOCFLAGS)
884 LTGOCOMPILE = $(LIBTOOL) --tag GO --mode=compile $(GOC) $(INCLUDES) \
885         $(AM_GOCFLAGS) $(GOCFLAGS)
887 GOLINK = $(LIBTOOL) --tag GO --mode-link $(GOC) \
888         $(OPT_LDFLAGS) $(SECTION_LDFLAGS) $(AM_GOCFLAGS) $(LTLDFLAGS) -o $@
890 # Build the dependencies for a Go package.
891 BUILDDEPS = \
892         $(MKDIR_P) $(@D); \
893         dir=`echo $@ | sed -e 's/.lo.dep$$//'`; \
894         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,,$@)))`; \
895         $(SHELL) $(srcdir)/godeps.sh `echo $@ | sed -e 's/.dep$$//'` $$files > $@.tmp; \
896         if ! cmp $@.tmp $@ >/dev/null 2>/dev/null; then \
897           rm -f `echo $@ | sed -e 's/\.dep$$//'`; \
898         fi; \
899         mv -f $@.tmp $@
901 # Build the .go files for a package, generating a .lo file.
902 BUILDPACKAGE = \
903         $(MKDIR_P) $(@D); \
904         files=`echo $^ | sed -e 's/[^ ]*\.gox//g' -e 's/[^ ]*\.dep//'`; \
905         $(LTGOCOMPILE) -I . -c -fgo-pkgpath=`echo $@ | sed -e 's/.lo$$//'` $($(subst -,_,$(subst .,_,$(subst /,_,$@)))_GOCFLAGS) -o $@ $$files
907 # How to build a .gox file from a .lo file.
908 BUILDGOX = \
909         f=`echo $< | sed -e 's/.lo$$/.o/'`; \
910         $(OBJCOPY) -j .go_export $$f $@.tmp; \
911         $(SHELL) $(srcdir)/mvifdiff.sh $@.tmp `echo $@ | sed -e 's/s-gox/gox/'`
913 GOTESTFLAGS =
914 GOBENCH = 
916 # Check a package.
917 CHECK = \
918         GC="$(GOC) $(GOCFLAGS) $($(subst /,_,$@)_GOCFLAGS) -L `${PWD_COMMAND}` -L `${PWD_COMMAND}`/.libs"; \
919         export GC; \
920         GOLIBS="$(MATH_LIBS) $(NET_LIBS) $(LIBS)"; \
921         export GOLIBS; \
922         RUNTESTFLAGS="$(RUNTESTFLAGS)"; \
923         export RUNTESTFLAGS; \
924         MAKE="$(MAKE)"; \
925         export MAKE; \
926         libgccdir=`${GOC} -print-libgcc-file-name | sed -e 's|/[^/]*$$||'`; \
927         LD_LIBRARY_PATH="`${PWD_COMMAND}`/.libs:$${libgccdir}:${LD_LIBRARY_PATH}"; \
928         LD_LIBRARY_PATH=`echo $${LD_LIBRARY_PATH} | sed 's,::*,:,g;s,^:*,,;s,:*$$,,'`; \
929         export LD_LIBRARY_PATH; \
930         $(MKDIR_P) $(@D); \
931         rm -f $@-testsum $@-testlog; \
932         files=`$(SHELL) $(srcdir)/match.sh --goarch=$(GOARCH) --goos=$(GOOS) --srcdir=$(srcdir)/go/$(@D) --extrafiles="$(extra_go_files_$(subst /,_,$(@D)))" $(matchargs_$(subst /,_,$(@D)))`; \
933         if test "$(USE_DEJAGNU)" = "yes"; then \
934           $(SHELL) $(srcdir)/testsuite/gotest --goarch=$(GOARCH) --goos=$(GOOS) --dejagnu=yes --basedir=$(srcdir) --srcdir=$(srcdir)/go/$(@D) --pkgpath="$(@D)" --pkgfiles="$$files" --testname="$(@D)" $(GOTESTFLAGS); \
935         elif test "$(GOBENCH)" != ""; then \
936           $(SHELL) $(srcdir)/testsuite/gotest --goarch=$(GOARCH) --goos=$(GOOS) --basedir=$(srcdir) --srcdir=$(srcdir)/go/$(@D) --pkgpath="$(@D)" --pkgfiles="$$files" --bench="$(GOBENCH)" $(GOTESTFLAGS); \
937         else \
938           if $(SHELL) $(srcdir)/testsuite/gotest --goarch=$(GOARCH) --goos=$(GOOS) --basedir=$(srcdir) --srcdir=$(srcdir)/go/$(@D) --pkgpath="$(@D)" --pkgfiles="$$files" $(GOTESTFLAGS) >>$@-testlog 2>&1; then \
939             echo "PASS: $(@D)" >> $@-testlog; \
940             echo "PASS: $(@D)"; \
941             echo "PASS: $(@D)" > $@-testsum; \
942           else \
943             echo "FAIL: $(@D)" >> $@-testlog; \
944             cat $@-testlog; \
945             echo "FAIL: $(@D)" > $@-testsum; \
946             exit 1; \
947           fi; \
948         fi
950 # Build all packages before checking any.
951 CHECK_DEPS = \
952         $(toolexeclibgo_DATA) \
953         $(toolexeclibgoarchive_DATA) \
954         $(toolexeclibgocompress_DATA) \
955         $(toolexeclibgocontainer_DATA) \
956         $(toolexeclibgocrypto_DATA) \
957         $(toolexeclibgodebug_DATA) \
958         $(toolexeclibgoencoding_DATA) \
959         $(toolexeclibgoexp_DATA) \
960         $(toolexeclibgogo_DATA) \
961         $(toolexeclibgohash_DATA) \
962         $(toolexeclibgoimage_DATA) \
963         $(toolexeclibgoindex_DATA) \
964         $(toolexeclibgoio_DATA) \
965         $(toolexeclibgolog_DATA) \
966         $(toolexeclibgomath_DATA) \
967         $(toolexeclibgomime_DATA) \
968         $(toolexeclibgonet_DATA) \
969         $(toolexeclibgonethttp_DATA) \
970         $(toolexeclibgoos_DATA) \
971         $(toolexeclibgopath_DATA) \
972         $(toolexeclibgorpc_DATA) \
973         $(toolexeclibgoruntime_DATA) \
974         $(toolexeclibgosync_DATA) \
975         $(toolexeclibgotesting_DATA) \
976         $(toolexeclibgotext_DATA) \
977         $(toolexeclibgotexttemplate_DATA) \
978         $(toolexeclibgounicode_DATA)
980 if GOC_IS_LLGO
981 CHECK_DEPS += libgo-llgo.la libgobegin-llgo.a
982 else
983 CHECK_DEPS += libgo.la libgobegin.a
984 endif
986 # PACKAGE_template defines the rules for each package.
987 # For example, for the package bufio, it produces:
989 # @go_include@ bufio.lo.dep
990 # bufio.lo.dep: $(srcdir)/go/bufio/*.go
991 #       $(BUILDDEPS)
992 # bufio.lo:
993 #       $(BUILDPACKAGE)
994 # bufio/check: $(CHECK_DEPS)
995 #       @$(CHECK)
996 # .PHONY: bufio/check
998 # This is invoked with $(1) set to a package, which is a directory name,
999 # such as "bufio" or "archive/tar".
1000 define PACKAGE_template
1001 @go_include@ $(1).lo.dep
1002 $(1).lo.dep: $(srcdir)/go/$(1)/*.go
1003         $$(BUILDDEPS)
1004 $(1).lo:
1005         $$(BUILDPACKAGE)
1006 $(1)/check: $$(CHECK_DEPS)
1007         @$$(CHECK)
1008 .PHONY: $(1)/check
1009 $(1).gox: $(1).s-gox; @true
1010 $(1).s-gox: $(1).lo
1011         $$(BUILDGOX)
1012         $$(STAMP) $$@
1013 endef
1015 # This line expands PACKAGE_template once for each package name listed
1016 # in $(PACKAGES).
1017 $(foreach package,$(PACKAGES),$(eval $(call PACKAGE_template,$(package))))
1019 # Pass -ffp-contract=off, or 386-specific options, when building the
1020 # math package.  MATH_FLAG is defined in configure.ac.
1021 math_lo_GOCFLAGS = $(MATH_FLAG)
1023 # Add the generated file runtime_sysinfo.go to the runtime package.
1024 extra_go_files_runtime = runtime_sysinfo.go sigtab.go
1025 runtime.lo.dep: $(extra_go_files_runtime)
1027 # Add generated files to the syscall package.
1028 extra_go_files_syscall = \
1029         libcalls.go \
1030         sysinfo.go \
1031         syscall_arch.go \
1032         $(syscall_epoll_file)
1033 syscall.lo.dep: $(extra_go_files_syscall)
1035 # Pass -fgo-compiling-runtime when compiling the runtime package.
1036 runtime_lo_GOCFLAGS = -fgo-c-header=runtime.inc.tmp -fgo-compiling-runtime
1037 runtime_check_GOCFLAGS = -fgo-compiling-runtime
1038 runtime_internal_atomic_lo_GOCFLAGS = -fgo-compiling-runtime
1039 runtime_internal_atomic_lo_check_GOCFLAGS = -fgo-compiling-runtime
1040 runtime_internal_sys_lo_GOCFLAGS = -fgo-compiling-runtime
1041 runtime_internal_sys_lo_check_GOCFLAGS = -fgo-compiling-runtime
1043 # If libffi is supported (the normal case) use the ffi build tag for
1044 # the runtime package.
1045 if USE_LIBFFI
1046 matchargs_runtime = --tag=libffi
1047 else
1048 matchargs_runtime =
1049 endif
1051 # At least for now, we need -static-libgo for this test, because
1052 # otherwise we can't get the line numbers.
1053 # Also use -fno-inline to get better results from the memory profiler.
1054 runtime_pprof_check_GOCFLAGS = -static-libgo -fno-inline
1056 extra_go_files_runtime_internal_sys = version.go
1057 runtime/internal/sys.lo.dep: $(extra_go_files_runtime_internal_sys)
1059 # FIXME: The following C files may as well move to the runtime
1060 # directory and be treated like other C files.
1062 # Use C code to speed up {bytes,strings}.IndexByte and friends.
1063 bytes/index.lo: go/bytes/indexbyte.c runtime.inc
1064         @$(MKDIR_P) bytes
1065         $(LTCOMPILE) -c -o $@ $(srcdir)/go/bytes/indexbyte.c
1066 strings/index.lo: go/strings/indexbyte.c runtime.inc
1067         @$(MKDIR_P) strings
1068         $(LTCOMPILE) -c -o $@ $(srcdir)/go/strings/indexbyte.c
1070 # Use a C function with a fixed number of arguments to call a C
1071 # varargs function.
1072 log/syslog/syslog_c.lo: go/log/syslog/syslog_c.c runtime.inc
1073         @$(MKDIR_P) log/syslog
1074         $(LTCOMPILE) -c -o $@ $(srcdir)/go/log/syslog/syslog_c.c
1076 # The interface to libffi from the reflect package is written in C.
1077 reflect/makefunc_ffi_c.lo: go/reflect/makefunc_ffi_c.c runtime.inc
1078         @$(MKDIR_P) reflect
1079         $(LTCOMPILE) -c -o $@ $(srcdir)/go/reflect/makefunc_ffi_c.c
1081 # The atomic functions are written in C.
1082 runtime/internal/atomic_c.lo: go/runtime/internal/atomic/atomic.c runtime.inc
1083         @$(MKDIR_P) runtime/internal
1084         $(LTCOMPILE) -c -o $@ $(srcdir)/go/runtime/internal/atomic/atomic.c
1085 sync/atomic_c.lo: go/sync/atomic/atomic.c runtime.inc
1086         @$(MKDIR_P) sync
1087         $(LTCOMPILE) -c -o $@ $(srcdir)/go/sync/atomic/atomic.c
1089 # A few syscall functions are written in C.
1090 syscall/clone_linux.lo: go/syscall/clone_linux.c runtime.inc
1091         @$(MKDIR_P) syscall
1092         $(LTCOMPILE) -c -o $@ $(srcdir)/go/syscall/clone_linux.c
1093 syscall/errno.lo: go/syscall/errno.c runtime.inc
1094         @$(MKDIR_P) syscall
1095         $(LTCOMPILE) -c -o $@ $(srcdir)/go/syscall/errno.c
1096 syscall/signame.lo: go/syscall/signame.c runtime.inc
1097         @$(MKDIR_P) syscall
1098         $(LTCOMPILE) -c -o $@ $(srcdir)/go/syscall/signame.c
1099 syscall/wait.lo: go/syscall/wait.c runtime.inc
1100         @$(MKDIR_P) syscall
1101         $(LTCOMPILE) -c -o $@ $(srcdir)/go/syscall/wait.c
1103 # Solaris 12 changed the type of fields in struct stat.
1104 # Use a build tag, based on a configure check, to cope.
1105 if LIBGO_IS_SOLARIS
1106 if HAVE_STAT_TIMESPEC
1107 matchargs_os = --tag=solaristag
1108 else
1109 matchargs_os =
1110 endif
1111 else
1112 matchargs_os =
1113 endif
1115 if LIBGO_IS_BSD
1117 # Build golang_org/x/net/route only on BSD systems.
1119 $(eval $(call PACKAGE_template,golang_org/x/net/route)
1121 golang_org_x_net_route_lo = \
1122         golang_org/x/net/route/route.lo
1123 golang_org_x_net_route_check = \
1124         golang_org/x/net/route/check
1126 endif
1128 TEST_PACKAGES = \
1129         bufio/check \
1130         bytes/check \
1131         context/check \
1132         errors/check \
1133         expvar/check \
1134         flag/check \
1135         fmt/check \
1136         html/check \
1137         image/check \
1138         io/check \
1139         log/check \
1140         math/check \
1141         mime/check \
1142         net/check \
1143         os/check \
1144         path/check \
1145         reflect/check \
1146         regexp/check \
1147         runtime/check \
1148         sort/check \
1149         strconv/check \
1150         strings/check \
1151         sync/check \
1152         syscall/check \
1153         time/check \
1154         unicode/check \
1155         archive/tar/check \
1156         archive/zip/check \
1157         compress/bzip2/check \
1158         compress/flate/check \
1159         compress/gzip/check \
1160         compress/lzw/check \
1161         compress/zlib/check \
1162         container/heap/check \
1163         container/list/check \
1164         container/ring/check \
1165         crypto/aes/check \
1166         crypto/cipher/check \
1167         crypto/des/check \
1168         crypto/dsa/check \
1169         crypto/ecdsa/check \
1170         crypto/elliptic/check \
1171         crypto/hmac/check \
1172         crypto/md5/check \
1173         crypto/rand/check \
1174         crypto/rc4/check \
1175         crypto/rsa/check \
1176         crypto/sha1/check \
1177         crypto/sha256/check \
1178         crypto/sha512/check \
1179         crypto/subtle/check \
1180         crypto/tls/check \
1181         crypto/x509/check \
1182         database/sql/check \
1183         database/sql/driver/check \
1184         debug/dwarf/check \
1185         debug/elf/check \
1186         debug/macho/check \
1187         debug/pe/check \
1188         debug/plan9obj/check \
1189         encoding/ascii85/check \
1190         encoding/asn1/check \
1191         encoding/base32/check \
1192         encoding/base64/check \
1193         encoding/binary/check \
1194         encoding/csv/check \
1195         encoding/gob/check \
1196         encoding/hex/check \
1197         encoding/json/check \
1198         encoding/pem/check \
1199         encoding/xml/check \
1200         exp/proxy/check \
1201         exp/terminal/check \
1202         html/template/check \
1203         go/ast/check \
1204         go/build/check \
1205         go/constant/check \
1206         go/doc/check \
1207         go/format/check \
1208         go/internal/gcimporter/check \
1209         go/internal/gccgoimporter/check \
1210         go/parser/check \
1211         go/printer/check \
1212         go/scanner/check \
1213         go/token/check \
1214         go/types/check \
1215         golang_org/x/net/http2/hpack/check \
1216         golang_org/x/net/lex/httplex/check \
1217         $(golang_org_x_net_route_check) \
1218         hash/adler32/check \
1219         hash/crc32/check \
1220         hash/crc64/check \
1221         hash/fnv/check \
1222         image/color/check \
1223         image/draw/check \
1224         image/jpeg/check \
1225         image/png/check \
1226         index/suffixarray/check \
1227         internal/singleflight/check \
1228         internal/trace/check \
1229         io/ioutil/check \
1230         log/syslog/check \
1231         math/big/check \
1232         math/cmplx/check \
1233         math/rand/check \
1234         mime/multipart/check \
1235         mime/quotedprintable/check \
1236         net/http/check \
1237         net/http/cgi/check \
1238         net/http/cookiejar/check \
1239         net/http/fcgi/check \
1240         net/http/httptest/check \
1241         net/http/httptrace/check \
1242         net/http/httputil/check \
1243         net/http/internal/check \
1244         net/internal/socktest/check \
1245         net/mail/check \
1246         net/rpc/check \
1247         net/smtp/check \
1248         net/textproto/check \
1249         net/url/check \
1250         net/rpc/jsonrpc/check \
1251         os/exec/check \
1252         os/signal/check \
1253         os/user/check \
1254         path/filepath/check \
1255         regexp/syntax/check \
1256         runtime/debug/check \
1257         runtime/pprof/check \
1258         runtime/internal/atomic/check \
1259         runtime/internal/sys/check \
1260         sync/atomic/check \
1261         text/scanner/check \
1262         text/tabwriter/check \
1263         text/template/check \
1264         text/template/parse/check \
1265         testing/quick/check \
1266         unicode/utf16/check \
1267         unicode/utf8/check
1269 check: check-tail
1270 check-recursive: check-head
1272 check-head:
1273         @echo "Test Run By $${USER} on `date`" > libgo.head
1274         @echo "Native configuration is $(host_triplet)" >> libgo.head
1275         @echo >> libgo.head
1276         @echo "         === libgo tests ===" >> libgo.head
1277         @echo >> libgo.head
1279 check-tail: check-recursive check-multi
1280         @if test "$(USE_DEJAGNU)" = "yes"; then \
1281           exit 0; \
1282         fi; \
1283         lib=`${PWD_COMMAND} | sed -e 's,^.*/\([^/][^/]*\)$$,\1,'`; \
1284         for dir in . $(MULTIDIRS); do \
1285           mv ../$${dir}/$${lib}/libgo.sum ../$${dir}/$${lib}/libgo.sum.sep; \
1286           mv ../$${dir}/$${lib}/libgo.log ../$${dir}/$${lib}/libgo.log.sep; \
1287         done; \
1288         mv libgo.head libgo.sum; \
1289         cp libgo.sum libgo.log; \
1290         echo "Schedule of variations:" >> libgo.sum; \
1291         for dir in . $(MULTIDIRS); do \
1292           multidir=../$${dir}/$${lib}; \
1293           multivar=`cat $${multidir}/libgo.var`; \
1294           echo "    $${multivar}" >> libgo.sum; \
1295         done; \
1296         echo >> libgo.sum; \
1297         pass=0; fail=0; untested=0; \
1298         for dir in . $(MULTIDIRS); do \
1299           multidir=../$${dir}/$${lib}; \
1300           multivar=`cat $${multidir}/libgo.var`; \
1301           echo "Running target $${multivar}" >> libgo.sum; \
1302           echo "Running $(srcdir)/libgo.exp ..." >> libgo.sum; \
1303           cat $${multidir}/libgo.sum.sep >> libgo.sum; \
1304           cat $${multidir}/libgo.log.sep >> libgo.log; \
1305           if test -n "${MULTIDIRS}"; then \
1306             echo "              === libgo Summary for $${multivar} ===" >> libgo.sum; \
1307             echo >> libgo.sum; \
1308           fi; \
1309           p=`grep -c PASS $${multidir}/libgo.sum.sep`; \
1310           pass=`expr $$pass + $$p`; \
1311           if test "$$p" -ne "0" && test -n "${MULTIDIRS}"; then \
1312             echo "# of expected passes          $$p" >> libgo.sum; \
1313           fi; \
1314           p=`grep -c FAIL $${multidir}/libgo.sum.sep`; \
1315           fail=`expr $$fail + $$p`; \
1316           if test "$$p" -ne "0" && test -n "${MULTIDIRS}"; then \
1317             echo "# of unexpected failures      $$p" >> libgo.sum; \
1318           fi; \
1319           p=`grep -c UNTESTED $${multidir}/libgo.sum.sep`; \
1320           untested=`expr $$untested + $$p`; \
1321           if test "$$p" -ne "0" && test -n "${MULTIDIRS}"; then \
1322             echo "# of untested testcases               $$p" >> libgo.sum; \
1323           fi; \
1324         done; \
1325         echo >> libgo.sum; \
1326         echo "          === libgo Summary ===" >> libgo.sum; \
1327         echo >> libgo.sum; \
1328         if test "$$pass" -ne "0"; then \
1329           echo "# of expected passes            $$pass" >> libgo.sum; \
1330         fi; \
1331         if test "$$fail" -ne "0"; then \
1332           echo "# of unexpected failures        $$fail" >> libgo.sum; \
1333         fi; \
1334         if test "$$untested" -ne "0"; then \
1335           echo "# of untested testcases         $$untested" >> libgo.sum; \
1336         fi; \
1337         echo `echo $(GOC) | sed -e 's/ .*//'`  `$(GOC) -v 2>&1 | grep " version" | sed -n -e 's/.* \(version.*$$\)/\1/p'` >> libgo.sum; \
1338         echo >> libgo.log; \
1339         echo "runtest completed at `date`" >> libgo.log; \
1340         if test "$$fail" -ne "0"; then \
1341           status=1; \
1342         else \
1343           status=0; \
1344         fi; \
1345         exit $$status
1347 check-am:
1348         @rm -f libgo.sum libgo.log libgo.tail
1349         @multivar="unix"; \
1350         [ -z "$(MULTIFLAGS)" ] || multivar="$${multivar}/$(MULTIFLAGS)"; \
1351         echo "$${multivar}" > libgo.var
1352         @for f in $(TEST_PACKAGES); do \
1353            rm -f $$f-testsum $$f-testlog; \
1354          done
1355         -@$(MAKE) -k $(TEST_PACKAGES)
1356         @for f in $(TEST_PACKAGES); do \
1357           if test -f $$f-testsum; then \
1358             cat $$f-testsum >> libgo.sum; \
1359           fi; \
1360           if test -f $$f-testlog; then \
1361             cat $$f-testlog >> libgo.log; \
1362           fi; \
1363         done
1365 check-multi:
1366         $(MULTIDO) $(AM_MAKEFLAGS) DO=check-am multi-do # $(MAKE)
1368 bench:
1369         -@$(MAKE) -k $(TEST_PACKAGES) GOBENCH=.
1371 MOSTLYCLEAN_FILES = libgo.head libgo.sum.sep libgo.log.sep
1373 mostlyclean-local:
1374         find . -name '*.lo' -print | xargs $(LIBTOOL) --mode=clean rm -f
1375         find . -name '*.$(OBJEXT)' -print | xargs rm -f
1376         find . -name '*-testsum' -print | xargs rm -f
1377         find . -name '*-testlog' -print | xargs rm -f
1379 CLEANFILES = *.go *.gox goc2c *.c s-version libgo.sum libgo.log
1381 clean-local:
1382         find . -name '*.la' -print | xargs $(LIBTOOL) --mode=clean rm -f
1383         find . -name '*.a' -print | xargs rm -f