runtime, reflect: rewrite Go to FFI type conversion in Go
[platform/upstream/gcc.git] / libgo / Makefile.am
1 # Makefile.am -- Go library Makefile.
2
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.
6
7 # Process this file with autoreconf to produce Makefile.in.
8
9 # Go support.
10 SUFFIXES = .c .go .gox .o .obj .lo .a
11
12 if LIBGO_IS_RTEMS
13 subdirs = testsuite
14 endif
15
16 SUBDIRS = ${subdirs}
17
18 gcc_version := $(shell $(GOC) -dumpversion)
19
20 MAINT_CHARSET = latin1
21
22 mkinstalldirs = $(SHELL) $(toplevel_srcdir)/mkinstalldirs
23 PWD_COMMAND = $${PWDCMD-pwd}
24 STAMP = echo timestamp >
25
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)
30
31 LIBFFI = @LIBFFI@
32 LIBFFIINCS = @LIBFFIINCS@
33
34 LIBATOMIC = @LIBATOMIC@
35
36 WARN_CFLAGS = $(WARN_FLAGS) $(WERROR)
37
38 # -I/-D flags to pass when compiling.
39 AM_CPPFLAGS = -I $(srcdir)/runtime $(LIBFFIINCS) $(PTHREAD_CFLAGS)
40
41 ACLOCAL_AMFLAGS = -I ./config -I ../config
42
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
48
49 if USING_SPLIT_STACK
50 AM_LDFLAGS = -XCClinker $(SPLIT_STACK)
51 endif
52
53 # Multilib support.
54 MAKEOVERRIDES=
55
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)"
99
100 # Subdir rules rely on $(FLAGS_TO_PASS)
101 FLAGS_TO_PASS = $(AM_MAKEFLAGS)
102
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
110
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
142
143 toolexeclibgoarchivedir = $(toolexeclibgodir)/archive
144
145 toolexeclibgoarchive_DATA = \
146         archive/tar.gox \
147         archive/zip.gox
148
149 toolexeclibgocompressdir = $(toolexeclibgodir)/compress
150
151 toolexeclibgocompress_DATA = \
152         compress/bzip2.gox \
153         compress/flate.gox \
154         compress/gzip.gox \
155         compress/lzw.gox \
156         compress/zlib.gox
157
158 toolexeclibgocontainerdir = $(toolexeclibgodir)/container
159
160 toolexeclibgocontainer_DATA = \
161         container/heap.gox \
162         container/list.gox \
163         container/ring.gox
164
165 toolexeclibgocryptodir = $(toolexeclibgodir)/crypto
166
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
185
186 toolexeclibgocryptox509dir = $(toolexeclibgocryptodir)/x509
187
188 toolexeclibgocryptox509_DATA = \
189         crypto/x509/pkix.gox
190
191 toolexeclibgodatabasedir = $(toolexeclibgodir)/database
192
193 toolexeclibgodatabase_DATA = \
194         database/sql.gox
195
196 toolexeclibgodatabasesqldir = $(toolexeclibgodatabasedir)/sql
197
198 toolexeclibgodatabasesql_DATA = \
199         database/sql/driver.gox
200
201 toolexeclibgodebugdir = $(toolexeclibgodir)/debug
202
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
210
211 toolexeclibgoencodingdir = $(toolexeclibgodir)/encoding
212
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
225
226 toolexeclibgoexpdir = $(toolexeclibgodir)/exp
227
228 toolexeclibgoexp_DATA = \
229         exp/proxy.gox \
230         exp/terminal.gox
231
232 toolexeclibgogodir = $(toolexeclibgodir)/go
233
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
246
247 toolexeclibgohashdir = $(toolexeclibgodir)/hash
248
249 toolexeclibgohash_DATA = \
250         hash/adler32.gox \
251         hash/crc32.gox \
252         hash/crc64.gox \
253         hash/fnv.gox
254
255 toolexeclibgohtmldir = $(toolexeclibgodir)/html
256
257 toolexeclibgohtml_DATA = \
258         html/template.gox
259
260 toolexeclibgoimagedir = $(toolexeclibgodir)/image
261
262 toolexeclibgoimage_DATA = \
263         image/color.gox \
264         image/draw.gox \
265         image/gif.gox \
266         image/jpeg.gox \
267         image/png.gox
268
269 toolexeclibgoimagecolordir = $(toolexeclibgoimagedir)/color
270
271 toolexeclibgoimagecolor_DATA = \
272         image/color/palette.gox
273
274 toolexeclibgoindexdir = $(toolexeclibgodir)/index
275
276 toolexeclibgoindex_DATA = \
277         index/suffixarray.gox
278
279 toolexeclibgoiodir = $(toolexeclibgodir)/io
280
281 toolexeclibgoio_DATA = \
282         io/ioutil.gox
283
284 toolexeclibgologdir = $(toolexeclibgodir)/log
285
286 toolexeclibgolog_DATA = \
287         log/syslog.gox
288
289 toolexeclibgomathdir = $(toolexeclibgodir)/math
290
291 toolexeclibgomath_DATA = \
292         math/big.gox \
293         math/cmplx.gox \
294         math/rand.gox
295
296 toolexeclibgomimedir = $(toolexeclibgodir)/mime
297
298 toolexeclibgomime_DATA = \
299         mime/multipart.gox \
300         mime/quotedprintable.gox
301
302 toolexeclibgonetdir = $(toolexeclibgodir)/net
303
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
311
312 toolexeclibgonethttpdir = $(toolexeclibgonetdir)/http
313
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
322
323 toolexeclibgonetrpcdir = $(toolexeclibgonetdir)/rpc
324
325 toolexeclibgonetrpc_DATA = \
326         net/rpc/jsonrpc.gox
327
328 toolexeclibgoolddir = $(toolexeclibgodir)/old
329
330 toolexeclibgoold_DATA = \
331         old/regexp.gox \
332         old/template.gox
333
334 toolexeclibgoosdir = $(toolexeclibgodir)/os
335
336 toolexeclibgoos_DATA = \
337         os/exec.gox \
338         os/signal.gox \
339         os/user.gox
340
341 toolexeclibgopathdir = $(toolexeclibgodir)/path
342
343 toolexeclibgopath_DATA = \
344         path/filepath.gox
345
346 toolexeclibgoregexpdir = $(toolexeclibgodir)/regexp
347
348 toolexeclibgoregexp_DATA = \
349         regexp/syntax.gox
350
351 toolexeclibgoruntimedir = $(toolexeclibgodir)/runtime
352
353 toolexeclibgoruntime_DATA = \
354         runtime/debug.gox \
355         runtime/pprof.gox
356
357 toolexeclibgosyncdir = $(toolexeclibgodir)/sync
358
359 toolexeclibgosync_DATA = \
360         sync/atomic.gox
361
362 toolexeclibgotestingdir = $(toolexeclibgodir)/testing
363
364 toolexeclibgotesting_DATA = \
365         testing/iotest.gox \
366         testing/quick.gox
367
368 toolexeclibgotextdir = $(toolexeclibgodir)/text
369
370 toolexeclibgotext_DATA = \
371         text/scanner.gox \
372         text/tabwriter.gox \
373         text/template.gox
374
375 toolexeclibgotexttemplatedir = $(toolexeclibgotextdir)/template
376
377 toolexeclibgotexttemplate_DATA = \
378         text/template/parse.gox
379
380 toolexeclibgounicodedir = $(toolexeclibgodir)/unicode
381
382 toolexeclibgounicode_DATA = \
383         unicode/utf16.gox \
384         unicode/utf8.gox
385
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
391
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
397
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
403
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
429
430 runtime_files = \
431         runtime/go-assert.c \
432         runtime/go-breakpoint.c \
433         runtime/go-caller.c \
434         runtime/go-callers.c \
435         runtime/go-cdiv.c \
436         runtime/go-cgo.c \
437         runtime/go-construct-map.c \
438         runtime/go-defer.c \
439         runtime/go-deferred-recover.c \
440         runtime/go-ffi.c \
441         runtime/go-fieldtrack.c \
442         runtime/go-matherr.c \
443         runtime/go-memclr.c \
444         runtime/go-memcmp.c \
445         runtime/go-memequal.c \
446         runtime/go-memmove.c \
447         runtime/go-nanotime.c \
448         runtime/go-now.c \
449         runtime/go-new.c \
450         runtime/go-nosys.c \
451         runtime/go-panic.c \
452         runtime/go-recover.c \
453         runtime/go-reflect-call.c \
454         runtime/go-runtime-error.c \
455         runtime/go-setenv.c \
456         runtime/go-signal.c \
457         runtime/go-strslice.c \
458         runtime/go-type-complex.c \
459         runtime/go-type-float.c \
460         runtime/go-type-identity.c \
461         runtime/go-type-string.c \
462         runtime/go-typedesc-equal.c \
463         runtime/go-unsafe-new.c \
464         runtime/go-unsafe-newarray.c \
465         runtime/go-unsafe-pointer.c \
466         runtime/go-unsetenv.c \
467         runtime/go-unwind.c \
468         runtime/go-varargs.c \
469         runtime/env_posix.c \
470         runtime/heapdump.c \
471         runtime/mcache.c \
472         runtime/mcentral.c \
473         $(runtime_mem_file) \
474         runtime/mfixalloc.c \
475         runtime/mgc0.c \
476         runtime/mheap.c \
477         runtime/msize.c \
478         runtime/panic.c \
479         runtime/parfor.c \
480         runtime/print.c \
481         runtime/proc.c \
482         runtime/runtime_c.c \
483         runtime/thread.c \
484         $(runtime_thread_files) \
485         runtime/yield.c \
486         $(rtems_task_variable_add_file) \
487         malloc.c \
488         $(runtime_getncpu_file)
489
490 goc2c.$(OBJEXT): runtime/goc2c.c
491         $(CC_FOR_BUILD) -c $(CFLAGS_FOR_BUILD) $<
492
493 goc2c: goc2c.$(OBJEXT)
494         $(CC_FOR_BUILD) $(CFLAGS_FOR_BUILD) $(LDFLAGS_FOR_BUILD) -o $@ $<
495
496 malloc.c: $(srcdir)/runtime/malloc.goc goc2c
497         ./goc2c $< > $@.tmp
498         mv -f $@.tmp $@
499
500 %.c: $(srcdir)/runtime/%.goc goc2c
501         ./goc2c $< > $@.tmp
502         mv -f $@.tmp $@
503
504 version.go: s-version; @true
505 s-version: Makefile
506         rm -f version.go.tmp
507         echo "package sys" > version.go.tmp
508         echo 'const DefaultGoroot = "$(prefix)"' >> version.go.tmp
509         echo 'const TheVersion = "'`cat $(srcdir)/VERSION | sed 1q`' '`$(GOC) --version | sed 1q`'"' >> version.go.tmp
510         echo 'const GOARCH = "'$(GOARCH)'"' >> version.go.tmp
511         echo 'const GOOS = "'$(GOOS)'"' >> version.go.tmp
512         echo 'const GccgoToolDir = "$(libexecsubdir)"' >> version.go.tmp
513         echo >> version.go.tmp
514         echo "type ArchFamilyType int" >> version.go.tmp
515         echo >> version.go.tmp
516         echo "const (" >> version.go.tmp
517         echo "  UNKNOWN ArchFamilyType = iota" >> version.go.tmp
518         for a in $(ALLGOARCHFAMILY); do \
519           echo "        $${a}" >> version.go.tmp; \
520         done
521         echo ")" >> version.go.tmp
522         echo >> version.go.tmp
523         for a in $(ALLGOARCH); do \
524           f=`echo $${a} | sed -e 's/\(.\).*/\1/' -e 'y/abcdefghijklmnopqrstuvwxyz/ABCDEFGHIJKLMNOPQRSTUVWXYZ/'`; \
525           n="$${f}`echo $${a} | sed -e 's/.//'`"; \
526           if test "$${a}" = "$(GOARCH)"; then \
527             echo "const Goarch$${n} = 1" >> version.go.tmp; \
528           else \
529             echo "const Goarch$${n} = 0" >> version.go.tmp; \
530           fi; \
531         done
532         echo >> version.go.tmp
533         echo "const (" >> version.go.tmp
534         echo "  ArchFamily = $(GOARCH_FAMILY)" >> version.go.tmp
535         echo "  BigEndian = $(GOARCH_BIGENDIAN)" >> version.go.tmp
536         echo "  CacheLineSize = $(GOARCH_CACHELINESIZE)" >> version.go.tmp
537         echo "  PhysPageSize = $(GOARCH_PHYSPAGESIZE)" >> version.go.tmp
538         echo "  PCQuantum = $(GOARCH_PCQUANTUM)" >> version.go.tmp
539         echo "  Int64Align = $(GOARCH_INT64ALIGN)" >> version.go.tmp
540         echo "  HugePageSize = $(GOARCH_HUGEPAGESIZE)" >> version.go.tmp
541         echo "  MinFrameSize = $(GOARCH_MINFRAMESIZE)" >> version.go.tmp
542         echo ")" >> version.go.tmp
543         echo >> version.go.tmp
544         for a in $(ALLGOOS); do \
545           f=`echo $${a} | sed -e 's/\(.\).*/\1/' -e 'y/abcdefghijklmnopqrstuvwxyz/ABCDEFGHIJKLMNOPQRSTUVWXYZ/'`; \
546           n="$${f}`echo $${a} | sed -e 's/.//'`"; \
547           if test "$${a}" = "$(GOOS)"; then \
548             echo "const Goos$${n} = 1" >> version.go.tmp; \
549           else \
550             echo "const Goos$${n} = 0" >> version.go.tmp; \
551           fi; \
552         done
553         echo >> version.go.tmp
554         echo "type Uintreg uintptr" >> version.go.tmp
555         $(SHELL) $(srcdir)/mvifdiff.sh version.go.tmp version.go
556         $(STAMP) $@
557
558 runtime_sysinfo.go: s-runtime_sysinfo; @true
559 s-runtime_sysinfo: $(srcdir)/mkrsysinfo.sh gen-sysinfo.go
560         $(SHELL) $(srcdir)/mkrsysinfo.sh
561         $(SHELL) $(srcdir)/mvifdiff.sh tmp-runtime_sysinfo.go runtime_sysinfo.go
562         $(STAMP) $@
563
564 sigtab.go: s-sigtab; @true
565 s-sigtab: $(srcdir)/mksigtab.sh gen-sysinfo.go
566         GOOS=$(GOOS) $(SHELL) $(srcdir)/mksigtab.sh > tmp-sigtab.go
567         $(SHELL) $(srcdir)/mvifdiff.sh tmp-sigtab.go sigtab.go
568         $(STAMP) $@
569
570 runtime.inc: s-runtime-inc; @true
571 s-runtime-inc: runtime.lo Makefile
572         rm -f runtime.inc.tmp2
573         grep -v "#define _" runtime.inc.tmp | grep -v "#define c[01] " > runtime.inc.tmp2
574         for pattern in '_[GP][a-z]' _Max _Lock _Sig _Trace _MHeap _Num; do \
575           grep "#define $$pattern" runtime.inc.tmp >> runtime.inc.tmp2; \
576         done
577         $(SHELL) $(srcdir)/mvifdiff.sh runtime.inc.tmp2 runtime.inc
578         $(STAMP) $@
579
580 noinst_DATA = zstdpkglist.go
581
582 # Generate the list of go std packages that were included in libgo
583 zstdpkglist.go: s-zstdpkglist; @true
584 s-zstdpkglist: Makefile
585         rm -f zstdpkglist.go.tmp
586         echo 'package main' > zstdpkglist.go.tmp
587         echo "" >> zstdpkglist.go.tmp
588         echo 'var stdpkg = map[string]bool{' >> zstdpkglist.go.tmp
589         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
590         echo '}' >> zstdpkglist.go.tmp
591         $(SHELL) $(srcdir)/mvifdiff.sh zstdpkglist.go.tmp zstdpkglist.go
592         $(STAMP) $@
593
594 if LIBGO_IS_LINUX
595 syscall_epoll_file = epoll.go
596 else
597 syscall_epoll_file =
598 endif
599
600 libcalls.go: s-libcalls; @true
601 s-libcalls: libcalls-list go/syscall/mksyscall.awk $(srcdir)/go/syscall/*.go
602         rm -f libcalls.go.tmp
603         $(AWK) -f $(srcdir)/go/syscall/mksyscall.awk `cat libcalls-list` > libcalls.go.tmp
604         $(SHELL) $(srcdir)/mvifdiff.sh libcalls.go.tmp libcalls.go
605         $(STAMP) $@
606
607 libcalls-list: s-libcalls-list; @true
608 s-libcalls-list: Makefile $(srcdir)/go/syscall/*.go
609         rm -f libcalls-list.tmp
610         $(SHELL) $(srcdir)/match.sh --goarch=$(GOARCH) --goos=$(GOOS) --srcdir=$(srcdir)/go/syscall $(matchargs_syscall) > libcalls-list.tmp
611         $(SHELL) $(srcdir)/mvifdiff.sh libcalls-list.tmp libcalls-list
612         $(STAMP) $@
613
614 syscall_arch.go: s-syscall_arch; @true
615 s-syscall_arch: Makefile
616         rm -f syscall_arch.go.tmp
617         echo "package syscall" > syscall_arch.go.tmp
618         echo 'const ARCH = "'$(GOARCH)'"' >> syscall_arch.go.tmp
619         echo 'const OS = "'$(GOOS)'"' >> syscall_arch.go.tmp
620         $(SHELL) $(srcdir)/mvifdiff.sh syscall_arch.go.tmp syscall_arch.go
621         $(STAMP) $@
622
623 SYSINFO_FLAGS = \
624         $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \
625         $(CPPFLAGS) $(OSCFLAGS) -O
626
627 gen-sysinfo.go: s-gen-sysinfo; @true
628 s-gen-sysinfo: $(srcdir)/sysinfo.c config.h
629         $(CC) $(SYSINFO_FLAGS) -fdump-go-spec=tmp-gen-sysinfo.go -std=gnu99 -S -o sysinfo.s $(srcdir)/sysinfo.c
630         rm -f sysinfo.s
631         $(SHELL) $(srcdir)/mvifdiff.sh tmp-gen-sysinfo.go gen-sysinfo.go
632         $(STAMP) $@
633
634 errno.i: s-errno; @true
635 s-errno:
636         echo '#include <errno.h>' | $(CC) $(SYSINFO_FLAGS) -x c - -E -dM > tmp-errno.i
637         $(SHELL) $(srcdir)/mvifdiff.sh tmp-errno.i errno.i
638         $(STAMP) $@
639
640 sysinfo.go: s-sysinfo; @true
641 s-sysinfo: $(srcdir)/mksysinfo.sh gen-sysinfo.go errno.i
642         $(SHELL) $(srcdir)/mksysinfo.sh
643         $(SHELL) $(srcdir)/mvifdiff.sh tmp-sysinfo.go sysinfo.go
644         $(STAMP) $@
645
646 # The epoll struct has an embedded union and is packed on x86_64,
647 # which is too complicated for mksysinfo.sh.  We find the offset of
648 # the only field we care about in configure.ac, and generate the
649 # struct here.
650 epoll.go: s-epoll; @true
651 s-epoll: Makefile
652         rm -f epoll.go.tmp
653         echo 'package syscall' > epoll.go.tmp
654         echo 'type EpollEvent struct {' >> epoll.go.tmp
655         echo '  Events uint32' >> epoll.go.tmp
656         case "$(SIZEOF_STRUCT_EPOLL_EVENT),$(STRUCT_EPOLL_EVENT_FD_OFFSET)" in \
657         0,0) echo 1>&2 "*** struct epoll_event data.fd offset unknown"; \
658            exit 1; ;; \
659         8,4) echo '     Fd int32' >> epoll.go.tmp; ;; \
660         12,4) echo '    Fd int32' >> epoll.go.tmp; \
661            echo '       Pad [4]byte' >> epoll.go.tmp; ;; \
662         12,8) echo '    Pad [4]byte' >> epoll.go.tmp; \
663            echo '       Fd int32' >> epoll.go.tmp; ;; \
664         16,8) echo '    Pad [4]byte' >> epoll.go.tmp; \
665            echo '       Fd int32' >> epoll.go.tmp; \
666            echo '       Pad2 [4]byte' >> epoll.go.tmp; ;; \
667         *) echo 1>&2 "*** struct epoll_event unsupported"; \
668            exit 1; ;; \
669         esac
670         echo '}' >> epoll.go.tmp
671         $(SHELL) $(srcdir)/mvifdiff.sh epoll.go.tmp epoll.go
672         $(STAMP) $@
673
674 if LIBGO_IS_LINUX
675 syscall_lib_clone_lo = syscall/clone_linux.lo
676 else
677 syscall_lib_clone_lo =
678 endif
679
680 PACKAGES = \
681         archive/tar \
682         archive/zip \
683         bufio \
684         bytes \
685         compress/bzip2 \
686         compress/flate \
687         compress/gzip \
688         compress/lzw \
689         compress/zlib \
690         container/heap \
691         container/list \
692         container/ring \
693         context \
694         crypto \
695         crypto/aes \
696         crypto/cipher \
697         crypto/des \
698         crypto/dsa \
699         crypto/ecdsa \
700         crypto/elliptic \
701         crypto/hmac \
702         crypto/md5 \
703         crypto/rand \
704         crypto/rc4 \
705         crypto/rsa \
706         crypto/sha1 \
707         crypto/sha256 \
708         crypto/sha512 \
709         crypto/subtle \
710         crypto/tls \
711         crypto/x509 \
712         crypto/x509/pkix \
713         database/sql \
714         database/sql/driver \
715         debug/dwarf \
716         debug/elf \
717         debug/gosym \
718         debug/macho \
719         debug/pe \
720         debug/plan9obj \
721         encoding \
722         encoding/ascii85 \
723         encoding/asn1 \
724         encoding/base32 \
725         encoding/base64 \
726         encoding/binary \
727         encoding/csv \
728         encoding/gob \
729         encoding/hex \
730         encoding/json \
731         encoding/pem \
732         encoding/xml \
733         errors \
734         exp/proxy \
735         exp/terminal \
736         expvar \
737         flag \
738         fmt \
739         go/ast \
740         go/build \
741         go/constant \
742         go/doc \
743         go/format \
744         go/importer \
745         go/internal/gccgoimporter \
746         go/internal/gcimporter \
747         go/parser \
748         go/printer \
749         go/scanner \
750         go/token \
751         go/types \
752         golang_org/x/net/http2/hpack \
753         golang_org/x/net/lex/httplex \
754         hash \
755         hash/adler32 \
756         hash/crc32 \
757         hash/crc64 \
758         hash/fnv \
759         html \
760         html/template \
761         image \
762         image/color \
763         image/color/palette \
764         image/draw \
765         image/gif \
766         image/internal/imageutil \
767         image/jpeg \
768         image/png \
769         index/suffixarray \
770         internal/nettrace \
771         internal/race \
772         internal/singleflight \
773         internal/syscall/unix \
774         internal/testenv \
775         internal/trace \
776         io \
777         io/ioutil \
778         log \
779         log/syslog \
780         math \
781         math/big \
782         math/cmplx \
783         math/rand \
784         mime \
785         mime/multipart \
786         mime/quotedprintable \
787         net \
788         net/http \
789         net/http/cgi \
790         net/http/cookiejar \
791         net/http/fcgi \
792         net/http/httptest \
793         net/http/httptrace \
794         net/http/httputil \
795         net/http/internal \
796         net/http/pprof \
797         net/internal/socktest \
798         net/mail \
799         net/rpc \
800         net/rpc/jsonrpc \
801         net/smtp \
802         net/textproto \
803         net/url \
804         old/regexp \
805         old/template \
806         os \
807         os/exec \
808         os/signal \
809         os/user \
810         path \
811         path/filepath \
812         reflect \
813         regexp \
814         regexp/syntax \
815         runtime \
816         runtime/debug \
817         runtime/internal/atomic \
818         runtime/internal/sys \
819         runtime/pprof \
820         sort \
821         strconv \
822         strings \
823         sync \
824         sync/atomic \
825         syscall \
826         testing \
827         testing/iotest \
828         testing/quick \
829         text/scanner \
830         text/tabwriter \
831         text/template \
832         text/template/parse \
833         time \
834         unicode \
835         unicode/utf16 \
836         unicode/utf8
837
838 libgo_go_objs = \
839         $(addsuffix .lo,$(PACKAGES)) \
840         bytes/index.lo \
841         reflect/makefunc_ffi_c.lo \
842         strings/index.lo \
843         $(syscall_lib_clone_lo) \
844         syscall/errno.lo \
845         syscall/signame.lo \
846         syscall/wait.lo \
847         $(golang_org_x_net_route_lo) \
848         log/syslog/syslog_c.lo \
849         $(os_lib_inotify_lo) \
850         runtime/internal/atomic_c.lo \
851         sync/atomic_c.lo
852
853 libgo_ldflags = \
854         -version-info $(libtool_VERSION) $(PTHREAD_CFLAGS) $(AM_LDFLAGS)
855
856 libgo_libadd = \
857         $(libgo_go_objs) ../libbacktrace/libbacktrace.la \
858         $(LIBATOMIC) $(LIBFFI) $(PTHREAD_LIBS) $(MATH_LIBS) $(NET_LIBS)
859
860 libgo_la_SOURCES = $(runtime_files)
861 libgo_la_LDFLAGS = $(libgo_ldflags)
862 libgo_la_LIBADD = $(libgo_libadd)
863
864 libgo_llgo_la_SOURCES = $(runtime_files)
865 libgo_llgo_la_LDFLAGS = $(libgo_ldflags)
866 libgo_llgo_la_LIBADD = $(libgo_libadd)
867
868 libgobegin_a_SOURCES = \
869         runtime/go-main.c
870
871 libgobegin_llgo_a_SOURCES = \
872         runtime/go-main.c
873
874 # Use -fPIC for libgobegin so that it can be put in a PIE.
875 libgobegin_a_CFLAGS = $(AM_CFLAGS) -fPIC
876 libgobegin_llgo_a_CFLAGS = $(AM_CFLAGS) -fPIC
877
878 libgolibbegin_a_SOURCES = \
879         runtime/go-libmain.c
880
881 libgolibbegin_a_CFLAGS = $(AM_CFLAGS) -fPIC
882
883 # Make sure runtime.inc is built before compiling any .c file.
884 $(libgo_la_OBJECTS): runtime.inc
885 $(libgo_llgo_la_OBJECTS): runtime.inc
886 $(libgobegin_a_OBJECTS): runtime.inc
887 $(libgobegin_llgo_a_OBJECTS): runtime.inc
888 $(libgolibbegin_a_OBJECTS): runtime.inc
889
890 LTLDFLAGS = $(shell $(SHELL) $(top_srcdir)/../libtool-ldflags $(LDFLAGS))
891
892 GOCFLAGS = $(CFLAGS)
893 AM_GOCFLAGS = $(STRINGOPS_FLAG) $(GO_SPLIT_STACK)
894 GOCOMPILE = $(GOC) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_GOCFLAGS) $(GOCFLAGS)
895
896 LTGOCOMPILE = $(LIBTOOL) --tag GO --mode=compile $(GOC) $(INCLUDES) \
897         $(AM_GOCFLAGS) $(GOCFLAGS)
898
899 GOLINK = $(LIBTOOL) --tag GO --mode-link $(GOC) \
900         $(OPT_LDFLAGS) $(SECTION_LDFLAGS) $(AM_GOCFLAGS) $(LTLDFLAGS) -o $@
901
902 # Build the dependencies for a Go package.
903 BUILDDEPS = \
904         $(MKDIR_P) $(@D); \
905         dir=`echo $@ | sed -e 's/.lo.dep$$//'`; \
906         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,,$@)))`; \
907         $(SHELL) $(srcdir)/godeps.sh `echo $@ | sed -e 's/.dep$$//'` $$files > $@.tmp; \
908         if ! cmp $@.tmp $@ >/dev/null 2>/dev/null; then \
909           rm -f `echo $@ | sed -e 's/\.dep$$//'`; \
910         fi; \
911         mv -f $@.tmp $@
912
913 # Build the .go files for a package, generating a .lo file.
914 BUILDPACKAGE = \
915         $(MKDIR_P) $(@D); \
916         files=`echo $^ | sed -e 's/[^ ]*\.gox//g' -e 's/[^ ]*\.dep//'`; \
917         $(LTGOCOMPILE) -I . -c -fgo-pkgpath=`echo $@ | sed -e 's/.lo$$//'` $($(subst -,_,$(subst .,_,$(subst /,_,$@)))_GOCFLAGS) -o $@ $$files
918
919 # How to build a .gox file from a .lo file.
920 BUILDGOX = \
921         f=`echo $< | sed -e 's/.lo$$/.o/'`; \
922         $(OBJCOPY) -j .go_export $$f $@.tmp; \
923         $(SHELL) $(srcdir)/mvifdiff.sh $@.tmp `echo $@ | sed -e 's/s-gox/gox/'`
924
925 GOTESTFLAGS =
926 GOBENCH = 
927
928 # Check a package.
929 CHECK = \
930         GC="$(GOC) $(GOCFLAGS) $($(subst /,_,$@)_GOCFLAGS) -L `${PWD_COMMAND}` -L `${PWD_COMMAND}`/.libs"; \
931         export GC; \
932         GOLIBS="$(MATH_LIBS) $(NET_LIBS) $(LIBS)"; \
933         export GOLIBS; \
934         RUNTESTFLAGS="$(RUNTESTFLAGS)"; \
935         export RUNTESTFLAGS; \
936         MAKE="$(MAKE)"; \
937         export MAKE; \
938         libgccdir=`${GOC} -print-libgcc-file-name | sed -e 's|/[^/]*$$||'`; \
939         LD_LIBRARY_PATH="`${PWD_COMMAND}`/.libs:$${libgccdir}:${LD_LIBRARY_PATH}"; \
940         LD_LIBRARY_PATH=`echo $${LD_LIBRARY_PATH} | sed 's,::*,:,g;s,^:*,,;s,:*$$,,'`; \
941         export LD_LIBRARY_PATH; \
942         $(MKDIR_P) $(@D); \
943         rm -f $@-testsum $@-testlog; \
944         files=`$(SHELL) $(srcdir)/match.sh --goarch=$(GOARCH) --goos=$(GOOS) --srcdir=$(srcdir)/go/$(@D) --extrafiles="$(extra_go_files_$(subst /,_,$(@D)))" $(matchargs_$(subst /,_,$(@D)))`; \
945         if test "$(USE_DEJAGNU)" = "yes"; then \
946           $(SHELL) $(srcdir)/testsuite/gotest --goarch=$(GOARCH) --goos=$(GOOS) --dejagnu=yes --basedir=$(srcdir) --srcdir=$(srcdir)/go/$(@D) --pkgpath="$(@D)" --pkgfiles="$$files" --testname="$(@D)" $(GOTESTFLAGS); \
947         elif test "$(GOBENCH)" != ""; then \
948           $(SHELL) $(srcdir)/testsuite/gotest --goarch=$(GOARCH) --goos=$(GOOS) --basedir=$(srcdir) --srcdir=$(srcdir)/go/$(@D) --pkgpath="$(@D)" --pkgfiles="$$files" --bench="$(GOBENCH)" $(GOTESTFLAGS); \
949         else \
950           if $(SHELL) $(srcdir)/testsuite/gotest --goarch=$(GOARCH) --goos=$(GOOS) --basedir=$(srcdir) --srcdir=$(srcdir)/go/$(@D) --pkgpath="$(@D)" --pkgfiles="$$files" $(GOTESTFLAGS) >>$@-testlog 2>&1; then \
951             echo "PASS: $(@D)" >> $@-testlog; \
952             echo "PASS: $(@D)"; \
953             echo "PASS: $(@D)" > $@-testsum; \
954           else \
955             echo "FAIL: $(@D)" >> $@-testlog; \
956             cat $@-testlog; \
957             echo "FAIL: $(@D)" > $@-testsum; \
958             exit 1; \
959           fi; \
960         fi
961
962 # Build all packages before checking any.
963 CHECK_DEPS = \
964         $(toolexeclibgo_DATA) \
965         $(toolexeclibgoarchive_DATA) \
966         $(toolexeclibgocompress_DATA) \
967         $(toolexeclibgocontainer_DATA) \
968         $(toolexeclibgocrypto_DATA) \
969         $(toolexeclibgodebug_DATA) \
970         $(toolexeclibgoencoding_DATA) \
971         $(toolexeclibgoexp_DATA) \
972         $(toolexeclibgogo_DATA) \
973         $(toolexeclibgohash_DATA) \
974         $(toolexeclibgoimage_DATA) \
975         $(toolexeclibgoindex_DATA) \
976         $(toolexeclibgoio_DATA) \
977         $(toolexeclibgolog_DATA) \
978         $(toolexeclibgomath_DATA) \
979         $(toolexeclibgomime_DATA) \
980         $(toolexeclibgonet_DATA) \
981         $(toolexeclibgonethttp_DATA) \
982         $(toolexeclibgoos_DATA) \
983         $(toolexeclibgopath_DATA) \
984         $(toolexeclibgorpc_DATA) \
985         $(toolexeclibgoruntime_DATA) \
986         $(toolexeclibgosync_DATA) \
987         $(toolexeclibgotesting_DATA) \
988         $(toolexeclibgotext_DATA) \
989         $(toolexeclibgotexttemplate_DATA) \
990         $(toolexeclibgounicode_DATA)
991
992 if GOC_IS_LLGO
993 CHECK_DEPS += libgo-llgo.la libgobegin-llgo.a
994 else
995 CHECK_DEPS += libgo.la libgobegin.a
996 endif
997
998 # PACKAGE_template defines the rules for each package.
999 # For example, for the package bufio, it produces:
1000 #
1001 # @go_include@ bufio.lo.dep
1002 # bufio.lo.dep: $(srcdir)/go/bufio/*.go
1003 #       $(BUILDDEPS)
1004 # bufio.lo:
1005 #       $(BUILDPACKAGE)
1006 # bufio/check: $(CHECK_DEPS)
1007 #       @$(CHECK)
1008 # .PHONY: bufio/check
1009 #
1010 # This is invoked with $(1) set to a package, which is a directory name,
1011 # such as "bufio" or "archive/tar".
1012 define PACKAGE_template
1013 @go_include@ $(1).lo.dep
1014 $(1).lo.dep: $(srcdir)/go/$(1)/*.go
1015         $$(BUILDDEPS)
1016 $(1).lo:
1017         $$(BUILDPACKAGE)
1018 $(1)/check: $$(CHECK_DEPS)
1019         @$$(CHECK)
1020 .PHONY: $(1)/check
1021 $(1).gox: $(1).s-gox; @true
1022 $(1).s-gox: $(1).lo
1023         $$(BUILDGOX)
1024         $$(STAMP) $$@
1025 endef
1026
1027 # This line expands PACKAGE_template once for each package name listed
1028 # in $(PACKAGES).
1029 $(foreach package,$(PACKAGES),$(eval $(call PACKAGE_template,$(package))))
1030
1031 # Pass -ffp-contract=off, or 386-specific options, when building the
1032 # math package.  MATH_FLAG is defined in configure.ac.
1033 math_lo_GOCFLAGS = $(MATH_FLAG)
1034
1035 # Add the generated file runtime_sysinfo.go to the runtime package.
1036 extra_go_files_runtime = runtime_sysinfo.go sigtab.go
1037 runtime.lo.dep: $(extra_go_files_runtime)
1038
1039 # Add generated files to the syscall package.
1040 extra_go_files_syscall = \
1041         libcalls.go \
1042         sysinfo.go \
1043         syscall_arch.go \
1044         $(syscall_epoll_file)
1045 syscall.lo.dep: $(extra_go_files_syscall)
1046
1047 # Pass -fgo-compiling-runtime when compiling the runtime package.
1048 runtime_lo_GOCFLAGS = -fgo-c-header=runtime.inc.tmp -fgo-compiling-runtime
1049 runtime_check_GOCFLAGS = -fgo-compiling-runtime
1050 runtime_internal_atomic_lo_GOCFLAGS = -fgo-compiling-runtime
1051 runtime_internal_atomic_lo_check_GOCFLAGS = -fgo-compiling-runtime
1052 runtime_internal_sys_lo_GOCFLAGS = -fgo-compiling-runtime
1053 runtime_internal_sys_lo_check_GOCFLAGS = -fgo-compiling-runtime
1054
1055 # If libffi is supported (the normal case) use the ffi build tag for
1056 # the runtime package.
1057 if USE_LIBFFI
1058 matchargs_runtime = --tag=libffi
1059 else
1060 matchargs_runtime =
1061 endif
1062
1063 # At least for now, we need -static-libgo for this test, because
1064 # otherwise we can't get the line numbers.
1065 # Also use -fno-inline to get better results from the memory profiler.
1066 runtime_pprof_check_GOCFLAGS = -static-libgo -fno-inline
1067
1068 extra_go_files_runtime_internal_sys = version.go
1069 runtime/internal/sys.lo.dep: $(extra_go_files_runtime_internal_sys)
1070
1071 # FIXME: The following C files may as well move to the runtime
1072 # directory and be treated like other C files.
1073
1074 # Use C code to speed up {bytes,strings}.IndexByte and friends.
1075 bytes/index.lo: go/bytes/indexbyte.c runtime.inc
1076         @$(MKDIR_P) bytes
1077         $(LTCOMPILE) -c -o $@ $(srcdir)/go/bytes/indexbyte.c
1078 strings/index.lo: go/strings/indexbyte.c runtime.inc
1079         @$(MKDIR_P) strings
1080         $(LTCOMPILE) -c -o $@ $(srcdir)/go/strings/indexbyte.c
1081
1082 # Use a C function with a fixed number of arguments to call a C
1083 # varargs function.
1084 log/syslog/syslog_c.lo: go/log/syslog/syslog_c.c runtime.inc
1085         @$(MKDIR_P) log/syslog
1086         $(LTCOMPILE) -c -o $@ $(srcdir)/go/log/syslog/syslog_c.c
1087
1088 # The interface to libffi from the reflect package is written in C.
1089 reflect/makefunc_ffi_c.lo: go/reflect/makefunc_ffi_c.c runtime.inc
1090         @$(MKDIR_P) reflect
1091         $(LTCOMPILE) -c -o $@ $(srcdir)/go/reflect/makefunc_ffi_c.c
1092
1093 # The atomic functions are written in C.
1094 runtime/internal/atomic_c.lo: go/runtime/internal/atomic/atomic.c runtime.inc
1095         @$(MKDIR_P) runtime/internal
1096         $(LTCOMPILE) -c -o $@ $(srcdir)/go/runtime/internal/atomic/atomic.c
1097 sync/atomic_c.lo: go/sync/atomic/atomic.c runtime.inc
1098         @$(MKDIR_P) sync
1099         $(LTCOMPILE) -c -o $@ $(srcdir)/go/sync/atomic/atomic.c
1100
1101 # A few syscall functions are written in C.
1102 syscall/clone_linux.lo: go/syscall/clone_linux.c runtime.inc
1103         @$(MKDIR_P) syscall
1104         $(LTCOMPILE) -c -o $@ $(srcdir)/go/syscall/clone_linux.c
1105 syscall/errno.lo: go/syscall/errno.c runtime.inc
1106         @$(MKDIR_P) syscall
1107         $(LTCOMPILE) -c -o $@ $(srcdir)/go/syscall/errno.c
1108 syscall/signame.lo: go/syscall/signame.c runtime.inc
1109         @$(MKDIR_P) syscall
1110         $(LTCOMPILE) -c -o $@ $(srcdir)/go/syscall/signame.c
1111 syscall/wait.lo: go/syscall/wait.c runtime.inc
1112         @$(MKDIR_P) syscall
1113         $(LTCOMPILE) -c -o $@ $(srcdir)/go/syscall/wait.c
1114
1115 # Solaris 12 changed the type of fields in struct stat.
1116 # Use a build tag, based on a configure check, to cope.
1117 if LIBGO_IS_SOLARIS
1118 if HAVE_STAT_TIMESPEC
1119 matchargs_os = --tag=solaristag
1120 else
1121 matchargs_os =
1122 endif
1123 else
1124 matchargs_os =
1125 endif
1126
1127 if LIBGO_IS_BSD
1128
1129 # Build golang_org/x/net/route only on BSD systems.
1130
1131 $(eval $(call PACKAGE_template,golang_org/x/net/route)
1132
1133 golang_org_x_net_route_lo = \
1134         golang_org/x/net/route/route.lo
1135 golang_org_x_net_route_check = \
1136         golang_org/x/net/route/check
1137
1138 endif
1139
1140 TEST_PACKAGES = \
1141         bufio/check \
1142         bytes/check \
1143         context/check \
1144         errors/check \
1145         expvar/check \
1146         flag/check \
1147         fmt/check \
1148         html/check \
1149         image/check \
1150         io/check \
1151         log/check \
1152         math/check \
1153         mime/check \
1154         net/check \
1155         os/check \
1156         path/check \
1157         reflect/check \
1158         regexp/check \
1159         runtime/check \
1160         sort/check \
1161         strconv/check \
1162         strings/check \
1163         sync/check \
1164         syscall/check \
1165         time/check \
1166         unicode/check \
1167         archive/tar/check \
1168         archive/zip/check \
1169         compress/bzip2/check \
1170         compress/flate/check \
1171         compress/gzip/check \
1172         compress/lzw/check \
1173         compress/zlib/check \
1174         container/heap/check \
1175         container/list/check \
1176         container/ring/check \
1177         crypto/aes/check \
1178         crypto/cipher/check \
1179         crypto/des/check \
1180         crypto/dsa/check \
1181         crypto/ecdsa/check \
1182         crypto/elliptic/check \
1183         crypto/hmac/check \
1184         crypto/md5/check \
1185         crypto/rand/check \
1186         crypto/rc4/check \
1187         crypto/rsa/check \
1188         crypto/sha1/check \
1189         crypto/sha256/check \
1190         crypto/sha512/check \
1191         crypto/subtle/check \
1192         crypto/tls/check \
1193         crypto/x509/check \
1194         database/sql/check \
1195         database/sql/driver/check \
1196         debug/dwarf/check \
1197         debug/elf/check \
1198         debug/macho/check \
1199         debug/pe/check \
1200         debug/plan9obj/check \
1201         encoding/ascii85/check \
1202         encoding/asn1/check \
1203         encoding/base32/check \
1204         encoding/base64/check \
1205         encoding/binary/check \
1206         encoding/csv/check \
1207         encoding/gob/check \
1208         encoding/hex/check \
1209         encoding/json/check \
1210         encoding/pem/check \
1211         encoding/xml/check \
1212         exp/proxy/check \
1213         exp/terminal/check \
1214         html/template/check \
1215         go/ast/check \
1216         go/build/check \
1217         go/constant/check \
1218         go/doc/check \
1219         go/format/check \
1220         go/internal/gcimporter/check \
1221         go/internal/gccgoimporter/check \
1222         go/parser/check \
1223         go/printer/check \
1224         go/scanner/check \
1225         go/token/check \
1226         go/types/check \
1227         golang_org/x/net/http2/hpack/check \
1228         golang_org/x/net/lex/httplex/check \
1229         $(golang_org_x_net_route_check) \
1230         hash/adler32/check \
1231         hash/crc32/check \
1232         hash/crc64/check \
1233         hash/fnv/check \
1234         image/color/check \
1235         image/draw/check \
1236         image/jpeg/check \
1237         image/png/check \
1238         index/suffixarray/check \
1239         internal/singleflight/check \
1240         internal/trace/check \
1241         io/ioutil/check \
1242         log/syslog/check \
1243         math/big/check \
1244         math/cmplx/check \
1245         math/rand/check \
1246         mime/multipart/check \
1247         mime/quotedprintable/check \
1248         net/http/check \
1249         net/http/cgi/check \
1250         net/http/cookiejar/check \
1251         net/http/fcgi/check \
1252         net/http/httptest/check \
1253         net/http/httptrace/check \
1254         net/http/httputil/check \
1255         net/http/internal/check \
1256         net/internal/socktest/check \
1257         net/mail/check \
1258         net/rpc/check \
1259         net/smtp/check \
1260         net/textproto/check \
1261         net/url/check \
1262         net/rpc/jsonrpc/check \
1263         old/regexp/check \
1264         old/template/check \
1265         os/exec/check \
1266         os/signal/check \
1267         os/user/check \
1268         path/filepath/check \
1269         regexp/syntax/check \
1270         runtime/debug/check \
1271         runtime/pprof/check \
1272         runtime/internal/atomic/check \
1273         runtime/internal/sys/check \
1274         sync/atomic/check \
1275         text/scanner/check \
1276         text/tabwriter/check \
1277         text/template/check \
1278         text/template/parse/check \
1279         testing/quick/check \
1280         unicode/utf16/check \
1281         unicode/utf8/check
1282
1283 check: check-tail
1284 check-recursive: check-head
1285
1286 check-head:
1287         @echo "Test Run By $${USER} on `date`" > libgo.head
1288         @echo "Native configuration is $(host_triplet)" >> libgo.head
1289         @echo >> libgo.head
1290         @echo "         === libgo tests ===" >> libgo.head
1291         @echo >> libgo.head
1292
1293 check-tail: check-recursive check-multi
1294         @if test "$(USE_DEJAGNU)" = "yes"; then \
1295           exit 0; \
1296         fi; \
1297         lib=`${PWD_COMMAND} | sed -e 's,^.*/\([^/][^/]*\)$$,\1,'`; \
1298         for dir in . $(MULTIDIRS); do \
1299           mv ../$${dir}/$${lib}/libgo.sum ../$${dir}/$${lib}/libgo.sum.sep; \
1300           mv ../$${dir}/$${lib}/libgo.log ../$${dir}/$${lib}/libgo.log.sep; \
1301         done; \
1302         mv libgo.head libgo.sum; \
1303         cp libgo.sum libgo.log; \
1304         echo "Schedule of variations:" >> libgo.sum; \
1305         for dir in . $(MULTIDIRS); do \
1306           multidir=../$${dir}/$${lib}; \
1307           multivar=`cat $${multidir}/libgo.var`; \
1308           echo "    $${multivar}" >> libgo.sum; \
1309         done; \
1310         echo >> libgo.sum; \
1311         pass=0; fail=0; untested=0; \
1312         for dir in . $(MULTIDIRS); do \
1313           multidir=../$${dir}/$${lib}; \
1314           multivar=`cat $${multidir}/libgo.var`; \
1315           echo "Running target $${multivar}" >> libgo.sum; \
1316           echo "Running $(srcdir)/libgo.exp ..." >> libgo.sum; \
1317           cat $${multidir}/libgo.sum.sep >> libgo.sum; \
1318           cat $${multidir}/libgo.log.sep >> libgo.log; \
1319           if test -n "${MULTIDIRS}"; then \
1320             echo "              === libgo Summary for $${multivar} ===" >> libgo.sum; \
1321             echo >> libgo.sum; \
1322           fi; \
1323           p=`grep -c PASS $${multidir}/libgo.sum.sep`; \
1324           pass=`expr $$pass + $$p`; \
1325           if test "$$p" -ne "0" && test -n "${MULTIDIRS}"; then \
1326             echo "# of expected passes          $$p" >> libgo.sum; \
1327           fi; \
1328           p=`grep -c FAIL $${multidir}/libgo.sum.sep`; \
1329           fail=`expr $$fail + $$p`; \
1330           if test "$$p" -ne "0" && test -n "${MULTIDIRS}"; then \
1331             echo "# of unexpected failures      $$p" >> libgo.sum; \
1332           fi; \
1333           p=`grep -c UNTESTED $${multidir}/libgo.sum.sep`; \
1334           untested=`expr $$untested + $$p`; \
1335           if test "$$p" -ne "0" && test -n "${MULTIDIRS}"; then \
1336             echo "# of untested testcases               $$p" >> libgo.sum; \
1337           fi; \
1338         done; \
1339         echo >> libgo.sum; \
1340         echo "          === libgo Summary ===" >> libgo.sum; \
1341         echo >> libgo.sum; \
1342         if test "$$pass" -ne "0"; then \
1343           echo "# of expected passes            $$pass" >> libgo.sum; \
1344         fi; \
1345         if test "$$fail" -ne "0"; then \
1346           echo "# of unexpected failures        $$fail" >> libgo.sum; \
1347         fi; \
1348         if test "$$untested" -ne "0"; then \
1349           echo "# of untested testcases         $$untested" >> libgo.sum; \
1350         fi; \
1351         echo `echo $(GOC) | sed -e 's/ .*//'`  `$(GOC) -v 2>&1 | grep " version" | sed -n -e 's/.* \(version.*$$\)/\1/p'` >> libgo.sum; \
1352         echo >> libgo.log; \
1353         echo "runtest completed at `date`" >> libgo.log; \
1354         if test "$$fail" -ne "0"; then \
1355           status=1; \
1356         else \
1357           status=0; \
1358         fi; \
1359         exit $$status
1360
1361 check-am:
1362         @rm -f libgo.sum libgo.log libgo.tail
1363         @multivar="unix"; \
1364         [ -z "$(MULTIFLAGS)" ] || multivar="$${multivar}/$(MULTIFLAGS)"; \
1365         echo "$${multivar}" > libgo.var
1366         @for f in $(TEST_PACKAGES); do \
1367            rm -f $$f-testsum $$f-testlog; \
1368          done
1369         -@$(MAKE) -k $(TEST_PACKAGES)
1370         @for f in $(TEST_PACKAGES); do \
1371           if test -f $$f-testsum; then \
1372             cat $$f-testsum >> libgo.sum; \
1373           fi; \
1374           if test -f $$f-testlog; then \
1375             cat $$f-testlog >> libgo.log; \
1376           fi; \
1377         done
1378
1379 check-multi:
1380         $(MULTIDO) $(AM_MAKEFLAGS) DO=check-am multi-do # $(MAKE)
1381
1382 bench:
1383         -@$(MAKE) -k $(TEST_PACKAGES) GOBENCH=.
1384
1385 MOSTLYCLEAN_FILES = libgo.head libgo.sum.sep libgo.log.sep
1386
1387 mostlyclean-local:
1388         find . -name '*.lo' -print | xargs $(LIBTOOL) --mode=clean rm -f
1389         find . -name '*.$(OBJEXT)' -print | xargs rm -f
1390         find . -name '*-testsum' -print | xargs rm -f
1391         find . -name '*-testlog' -print | xargs rm -f
1392
1393 CLEANFILES = *.go *.gox goc2c *.c s-version libgo.sum libgo.log
1394
1395 clean-local:
1396         find . -name '*.la' -print | xargs $(LIBTOOL) --mode=clean rm -f
1397         find . -name '*.a' -print | xargs rm -f