[PATCH] Install cp/operators.def as part of plugin headers
[official-gcc.git] / libgo / Makefile.am
blob9bbda2de46e8e2d430381cc6f0a303ebebbf5c94
1 # Makefile.am -- Go library Makefile.
3 # Copyright 2009 The Go Authors. All rights reserved.
4 # Use of this source code is governed by a BSD-style
5 # license that can be found in the LICENSE file.
7 # Process this file with autoreconf to produce Makefile.in.
9 # Go support.
10 SUFFIXES = .c .go .gox .o .obj .lo .a
12 if LIBGO_IS_RTEMS
13 subdirs = testsuite
14 endif
16 SUBDIRS = ${subdirs}
18 gcc_version := $(shell $(GOC) -dumpversion)
20 MAINT_CHARSET = latin1
22 mkinstalldirs = $(SHELL) $(toplevel_srcdir)/mkinstalldirs
23 PWD_COMMAND = $${PWDCMD-pwd}
24 STAMP = echo timestamp >
26 toolexecdir = $(glibgo_toolexecdir)
27 toolexeclibdir = $(glibgo_toolexeclibdir)
28 toolexeclibgodir = $(nover_glibgo_toolexeclibdir)/go/$(gcc_version)/$(target_alias)
29 libexecsubdir = $(libexecdir)/gcc/$(target_alias)/$(gcc_version)
31 LIBFFI = @LIBFFI@
32 LIBFFIINCS = @LIBFFIINCS@
34 LIBATOMIC = @LIBATOMIC@
36 WARN_CFLAGS = $(WARN_FLAGS) $(WERROR)
38 # -I/-D flags to pass when compiling.
39 AM_CPPFLAGS = -I $(srcdir)/runtime $(LIBFFIINCS) $(PTHREAD_CFLAGS)
41 ACLOCAL_AMFLAGS = -I ./config -I ../config
43 AM_CFLAGS = -fexceptions -fnon-call-exceptions -fplan9-extensions \
44         $(SPLIT_STACK) $(WARN_CFLAGS) \
45         $(STRINGOPS_FLAG) $(HWCAP_CFLAGS) $(OSCFLAGS) \
46         -I $(srcdir)/../libgcc -I $(srcdir)/../libbacktrace \
47         -I $(MULTIBUILDTOP)../../gcc/include
49 AM_LDFLAGS =
51 if USING_SPLIT_STACK
52 AM_LDFLAGS += -XCClinker $(SPLIT_STACK)
53 endif
55 if LIBGO_IS_AIX
56 # Using an import file for libgo avoid requiring to use the -brtl flag
57 # when builing a go program
58 AM_LDFLAGS += -Wl,-bbigtoc -Wl,-bI:$(srcdir)/libgo.imp
59 EXTRA_libgo_la_DEPENDENCIES = libgo.imp
60 endif
62 # Multilib support.
63 MAKEOVERRIDES=
65 # Work around what appears to be a GNU make  handling MAKEFLAGS
66 # values defined in terms of make variables, as is the case for CC and
67 # friends when we are called from the top level Makefile.
68 AM_MAKEFLAGS = \
69         "AR_FLAGS=$(AR_FLAGS)" \
70         "CC_FOR_BUILD=$(CC_FOR_BUILD)" \
71         "CC_FOR_TARGET=$(CC_FOR_TARGET)" \
72         "CFLAGS=$(CFLAGS)" \
73         "CXXFLAGS=$(CXXFLAGS)" \
74         "CFLAGS_FOR_BUILD=$(CFLAGS_FOR_BUILD)" \
75         "CFLAGS_FOR_TARGET=$(CFLAGS_FOR_TARGET)" \
76         "GOC_FOR_TARGET=$(GOC_FOR_TARGET)" \
77         "GOC=$(GOC)" \
78         "GOCFLAGS=$(GOCFLAGS)" \
79         "INSTALL=$(INSTALL)" \
80         "INSTALL_DATA=$(INSTALL_DATA)" \
81         "INSTALL_PROGRAM=$(INSTALL_PROGRAM)" \
82         "INSTALL_SCRIPT=$(INSTALL_SCRIPT)" \
83         "LDFLAGS=$(LDFLAGS)" \
84         "LIBCFLAGS=$(LIBCFLAGS)" \
85         "LIBCFLAGS_FOR_TARGET=$(LIBCFLAGS_FOR_TARGET)" \
86         "MAKE=$(MAKE)" \
87         "MAKEINFO=$(MAKEINFO) $(MAKEINFOFLAGS)" \
88         "PICFLAG=$(PICFLAG)" \
89         "PICFLAG_FOR_TARGET=$(PICFLAG_FOR_TARGET)" \
90         "SHELL=$(SHELL)" \
91         "RUNTESTFLAGS=$(RUNTESTFLAGS)" \
92         "exec_prefix=$(exec_prefix)" \
93         "infodir=$(infodir)" \
94         "libdir=$(libdir)" \
95         "includedir=$(includedir)" \
96         "prefix=$(prefix)" \
97         "tooldir=$(tooldir)" \
98         "gxx_include_dir=$(gxx_include_dir)" \
99         "AR=$(AR)" \
100         "AS=$(AS)" \
101         "LD=$(LD)" \
102         "RANLIB=$(RANLIB)" \
103         "NM=$(NM)" \
104         "NM_FOR_BUILD=$(NM_FOR_BUILD)" \
105         "NM_FOR_TARGET=$(NM_FOR_TARGET)" \
106         "DESTDIR=$(DESTDIR)" \
107         "WERROR=$(WERROR)"
109 # Subdir rules rely on $(FLAGS_TO_PASS)
110 FLAGS_TO_PASS = $(AM_MAKEFLAGS)
112 if GOC_IS_LLGO
113 toolexeclib_LTLIBRARIES = libgo-llgo.la
114 toolexeclib_LIBRARIES = libgobegin-llgo.a
115 else
116 toolexeclib_LTLIBRARIES = libgo.la
117 toolexeclib_LIBRARIES = libgobegin.a libgolibbegin.a
118 endif
120 noinst_LIBRARIES = libgotool.a
122 toolexeclibgo_DATA = \
123         bufio.gox \
124         bytes.gox \
125         context.gox \
126         crypto.gox \
127         encoding.gox \
128         errors.gox \
129         expvar.gox \
130         flag.gox \
131         fmt.gox \
132         hash.gox \
133         html.gox \
134         image.gox \
135         io.gox \
136         log.gox \
137         math.gox \
138         mime.gox \
139         net.gox \
140         os.gox \
141         path.gox \
142         reflect.gox \
143         regexp.gox \
144         runtime.gox \
145         sort.gox \
146         strconv.gox \
147         strings.gox \
148         sync.gox \
149         syscall.gox \
150         testing.gox \
151         time.gox \
152         unicode.gox
154 toolexeclibgoarchivedir = $(toolexeclibgodir)/archive
156 toolexeclibgoarchive_DATA = \
157         archive/tar.gox \
158         archive/zip.gox
160 toolexeclibgocompressdir = $(toolexeclibgodir)/compress
162 toolexeclibgocompress_DATA = \
163         compress/bzip2.gox \
164         compress/flate.gox \
165         compress/gzip.gox \
166         compress/lzw.gox \
167         compress/zlib.gox
169 toolexeclibgocontainerdir = $(toolexeclibgodir)/container
171 toolexeclibgocontainer_DATA = \
172         container/heap.gox \
173         container/list.gox \
174         container/ring.gox
176 toolexeclibgocryptodir = $(toolexeclibgodir)/crypto
178 toolexeclibgocrypto_DATA = \
179         crypto/aes.gox \
180         crypto/cipher.gox \
181         crypto/des.gox \
182         crypto/dsa.gox \
183         crypto/ecdsa.gox \
184         crypto/elliptic.gox \
185         crypto/hmac.gox \
186         crypto/md5.gox \
187         crypto/rand.gox \
188         crypto/rc4.gox \
189         crypto/rsa.gox \
190         crypto/sha1.gox \
191         crypto/sha256.gox \
192         crypto/sha512.gox \
193         crypto/subtle.gox \
194         crypto/tls.gox \
195         crypto/x509.gox
197 toolexeclibgocryptox509dir = $(toolexeclibgocryptodir)/x509
199 toolexeclibgocryptox509_DATA = \
200         crypto/x509/pkix.gox
202 toolexeclibgodatabasedir = $(toolexeclibgodir)/database
204 toolexeclibgodatabase_DATA = \
205         database/sql.gox
207 toolexeclibgodatabasesqldir = $(toolexeclibgodatabasedir)/sql
209 toolexeclibgodatabasesql_DATA = \
210         database/sql/driver.gox
212 toolexeclibgodebugdir = $(toolexeclibgodir)/debug
214 toolexeclibgodebug_DATA = \
215         debug/dwarf.gox \
216         debug/elf.gox \
217         debug/gosym.gox \
218         debug/macho.gox \
219         debug/pe.gox \
220         debug/plan9obj.gox \
221         debug/xcoff.gox
223 toolexeclibgoencodingdir = $(toolexeclibgodir)/encoding
225 toolexeclibgoencoding_DATA = \
226         encoding/ascii85.gox \
227         encoding/asn1.gox \
228         encoding/base32.gox \
229         encoding/base64.gox \
230         encoding/binary.gox \
231         encoding/csv.gox \
232         encoding/gob.gox \
233         encoding/hex.gox \
234         encoding/json.gox \
235         encoding/pem.gox \
236         encoding/xml.gox
238 toolexeclibgoexpdir = $(toolexeclibgodir)/exp
240 toolexeclibgoexp_DATA = \
241         exp/proxy.gox \
242         exp/terminal.gox
244 toolexeclibgogodir = $(toolexeclibgodir)/go
246 toolexeclibgogo_DATA = \
247         go/ast.gox \
248         go/build.gox \
249         go/constant.gox \
250         go/doc.gox \
251         go/format.gox \
252         go/importer.gox \
253         go/parser.gox \
254         go/printer.gox \
255         go/scanner.gox \
256         go/token.gox \
257         go/types.gox
259 toolexeclibgohashdir = $(toolexeclibgodir)/hash
261 toolexeclibgohash_DATA = \
262         hash/adler32.gox \
263         hash/crc32.gox \
264         hash/crc64.gox \
265         hash/fnv.gox
267 toolexeclibgohtmldir = $(toolexeclibgodir)/html
269 toolexeclibgohtml_DATA = \
270         html/template.gox
272 toolexeclibgoimagedir = $(toolexeclibgodir)/image
274 toolexeclibgoimage_DATA = \
275         image/color.gox \
276         image/draw.gox \
277         image/gif.gox \
278         image/jpeg.gox \
279         image/png.gox
281 toolexeclibgoimagecolordir = $(toolexeclibgoimagedir)/color
283 toolexeclibgoimagecolor_DATA = \
284         image/color/palette.gox
286 toolexeclibgoindexdir = $(toolexeclibgodir)/index
288 toolexeclibgoindex_DATA = \
289         index/suffixarray.gox
291 toolexeclibgoiodir = $(toolexeclibgodir)/io
293 toolexeclibgoio_DATA = \
294         io/ioutil.gox
296 toolexeclibgologdir = $(toolexeclibgodir)/log
298 toolexeclibgolog_DATA = \
299         log/syslog.gox
301 toolexeclibgomathdir = $(toolexeclibgodir)/math
303 toolexeclibgomath_DATA = \
304         math/big.gox \
305         math/bits.gox \
306         math/cmplx.gox \
307         math/rand.gox
309 toolexeclibgomimedir = $(toolexeclibgodir)/mime
311 toolexeclibgomime_DATA = \
312         mime/multipart.gox \
313         mime/quotedprintable.gox
315 toolexeclibgonetdir = $(toolexeclibgodir)/net
317 toolexeclibgonet_DATA = \
318         net/http.gox \
319         net/mail.gox \
320         net/rpc.gox \
321         net/smtp.gox \
322         net/textproto.gox \
323         net/url.gox
325 toolexeclibgonethttpdir = $(toolexeclibgonetdir)/http
327 toolexeclibgonethttp_DATA = \
328         net/http/cgi.gox \
329         net/http/cookiejar.gox \
330         net/http/fcgi.gox \
331         net/http/httptest.gox \
332         net/http/httptrace.gox \
333         net/http/httputil.gox \
334         net/http/pprof.gox
336 toolexeclibgonetrpcdir = $(toolexeclibgonetdir)/rpc
338 toolexeclibgonetrpc_DATA = \
339         net/rpc/jsonrpc.gox
341 toolexeclibgoosdir = $(toolexeclibgodir)/os
343 toolexeclibgoos_DATA = \
344         os/exec.gox \
345         os/signal.gox \
346         os/user.gox
348 toolexeclibgopathdir = $(toolexeclibgodir)/path
350 toolexeclibgopath_DATA = \
351         path/filepath.gox
353 toolexeclibgoregexpdir = $(toolexeclibgodir)/regexp
355 toolexeclibgoregexp_DATA = \
356         regexp/syntax.gox
358 toolexeclibgoruntimedir = $(toolexeclibgodir)/runtime
360 toolexeclibgoruntime_DATA = \
361         runtime/debug.gox \
362         runtime/pprof.gox \
363         runtime/trace.gox
365 toolexeclibgosyncdir = $(toolexeclibgodir)/sync
367 toolexeclibgosync_DATA = \
368         sync/atomic.gox
370 toolexeclibgotestingdir = $(toolexeclibgodir)/testing
372 toolexeclibgotesting_DATA = \
373         testing/iotest.gox \
374         testing/quick.gox
376 toolexeclibgotestinginternaldir = $(toolexeclibgotestingdir)/internal
378 toolexeclibgotestinginternal_DATA = \
379         testing/internal/testdeps.gox
381 toolexeclibgotextdir = $(toolexeclibgodir)/text
383 toolexeclibgotext_DATA = \
384         text/scanner.gox \
385         text/tabwriter.gox \
386         text/template.gox
388 toolexeclibgotexttemplatedir = $(toolexeclibgotextdir)/template
390 toolexeclibgotexttemplate_DATA = \
391         text/template/parse.gox
393 toolexeclibgounicodedir = $(toolexeclibgodir)/unicode
395 toolexeclibgounicode_DATA = \
396         unicode/utf16.gox \
397         unicode/utf8.gox
399 # Some packages are only needed for tests, so unlike the other
400 # internal packages nothing will explicitly depend on them.
401 # Force them to be built.
402 noinst_DATA = \
403         internal/testenv.gox \
404         net/internal/socktest.gox
406 if LIBGO_IS_RTEMS
407 rtems_task_variable_add_file = runtime/rtems-task-variable-add.c
408 else
409 rtems_task_variable_add_file =
410 endif
412 if LIBGO_IS_LINUX
413 runtime_getncpu_file = runtime/getncpu-linux.c
414 else
415 if LIBGO_IS_DARWIN
416 runtime_getncpu_file = runtime/getncpu-bsd.c
417 else
418 if LIBGO_IS_IRIX
419 runtime_getncpu_file = runtime/getncpu-irix.c
420 else
421 if LIBGO_IS_SOLARIS
422 runtime_getncpu_file = runtime/getncpu-solaris.c
423 else
424 if LIBGO_IS_FREEBSD
425 runtime_getncpu_file = runtime/getncpu-bsd.c
426 else
427 if LIBGO_IS_NETBSD
428 runtime_getncpu_file = runtime/getncpu-bsd.c
429 else
430 if LIBGO_IS_AIX
431 runtime_getncpu_file = runtime/getncpu-aix.c
432 else
433 runtime_getncpu_file = runtime/getncpu-none.c
434 endif
435 endif
436 endif
437 endif
438 endif
439 endif
440 endif
442 runtime_files = \
443         runtime/aeshash.c \
444         runtime/go-assert.c \
445         runtime/go-caller.c \
446         runtime/go-callers.c \
447         runtime/go-cdiv.c \
448         runtime/go-cgo.c \
449         runtime/go-construct-map.c \
450         runtime/go-ffi.c \
451         runtime/go-fieldtrack.c \
452         runtime/go-matherr.c \
453         runtime/go-memclr.c \
454         runtime/go-memcmp.c \
455         runtime/go-memequal.c \
456         runtime/go-memmove.c \
457         runtime/go-nanotime.c \
458         runtime/go-now.c \
459         runtime/go-nosys.c \
460         runtime/go-reflect-call.c \
461         runtime/go-runtime-error.c \
462         runtime/go-setenv.c \
463         runtime/go-signal.c \
464         runtime/go-strslice.c \
465         runtime/go-typedesc-equal.c \
466         runtime/go-unsafe-pointer.c \
467         runtime/go-unsetenv.c \
468         runtime/go-unwind.c \
469         runtime/go-varargs.c \
470         runtime/env_posix.c \
471         runtime/panic.c \
472         runtime/print.c \
473         runtime/proc.c \
474         runtime/runtime_c.c \
475         runtime/stack.c \
476         runtime/thread.c \
477         runtime/yield.c \
478         $(rtems_task_variable_add_file) \
479         $(runtime_getncpu_file)
481 version.go: s-version; @true
482 s-version: Makefile
483         rm -f version.go.tmp
484         echo "package sys" > version.go.tmp
485         echo 'const DefaultGoroot = "$(prefix)"' >> version.go.tmp
486         echo 'const TheVersion = "'`cat $(srcdir)/VERSION | sed 1q`' '`$(GOC) --version | sed 1q`'"' >> version.go.tmp
487         echo 'const Goexperiment = ``' >> version.go.tmp
488         echo 'const GOARCH = "'$(GOARCH)'"' >> version.go.tmp
489         echo 'const GOOS = "'$(GOOS)'"' >> version.go.tmp
490         echo 'const GccgoToolDir = "$(libexecsubdir)"' >> version.go.tmp
491         echo >> version.go.tmp
492         echo "type ArchFamilyType int" >> version.go.tmp
493         echo >> version.go.tmp
494         echo "const (" >> version.go.tmp
495         echo "  UNKNOWN ArchFamilyType = iota" >> version.go.tmp
496         for a in $(ALLGOARCHFAMILY); do \
497           echo "        $${a}" >> version.go.tmp; \
498         done
499         echo ")" >> version.go.tmp
500         echo >> version.go.tmp
501         for a in $(ALLGOARCH); do \
502           f=`echo $${a} | sed -e 's/\(.\).*/\1/' -e 'y/abcdefghijklmnopqrstuvwxyz/ABCDEFGHIJKLMNOPQRSTUVWXYZ/'`; \
503           n="$${f}`echo $${a} | sed -e 's/.//'`"; \
504           if test "$${a}" = "$(GOARCH)"; then \
505             echo "const Goarch$${n} = 1" >> version.go.tmp; \
506           else \
507             echo "const Goarch$${n} = 0" >> version.go.tmp; \
508           fi; \
509         done
510         echo >> version.go.tmp
511         echo "const (" >> version.go.tmp
512         echo "  ArchFamily = $(GOARCH_FAMILY)" >> version.go.tmp
513         echo "  BigEndian = $(GOARCH_BIGENDIAN)" >> version.go.tmp
514         echo "  CacheLineSize = $(GOARCH_CACHELINESIZE)" >> version.go.tmp
515         echo "  PhysPageSize = $(GOARCH_PHYSPAGESIZE)" >> version.go.tmp
516         echo "  PCQuantum = $(GOARCH_PCQUANTUM)" >> version.go.tmp
517         echo "  Int64Align = $(GOARCH_INT64ALIGN)" >> version.go.tmp
518         echo "  HugePageSize = $(GOARCH_HUGEPAGESIZE)" >> version.go.tmp
519         echo "  MinFrameSize = $(GOARCH_MINFRAMESIZE)" >> version.go.tmp
520         echo ")" >> version.go.tmp
521         echo >> version.go.tmp
522         for a in $(ALLGOOS); do \
523           f=`echo $${a} | sed -e 's/\(.\).*/\1/' -e 'y/abcdefghijklmnopqrstuvwxyz/ABCDEFGHIJKLMNOPQRSTUVWXYZ/'`; \
524           n="$${f}`echo $${a} | sed -e 's/.//'`"; \
525           if test "$${a}" = "$(GOOS)"; then \
526             echo "const Goos$${n} = 1" >> version.go.tmp; \
527           else \
528             echo "const Goos$${n} = 0" >> version.go.tmp; \
529           fi; \
530         done
531         echo >> version.go.tmp
532         echo "type Uintreg uintptr" >> version.go.tmp
533         $(SHELL) $(srcdir)/mvifdiff.sh version.go.tmp version.go
534         $(STAMP) $@
536 runtime_sysinfo.go: s-runtime_sysinfo; @true
537 s-runtime_sysinfo: $(srcdir)/mkrsysinfo.sh gen-sysinfo.go
538         GOARCH=$(GOARCH) GOOS=$(GOOS) $(SHELL) $(srcdir)/mkrsysinfo.sh
539         $(SHELL) $(srcdir)/mvifdiff.sh tmp-runtime_sysinfo.go runtime_sysinfo.go
540         $(STAMP) $@
542 sigtab.go: s-sigtab; @true
543 s-sigtab: $(srcdir)/mksigtab.sh gen-sysinfo.go
544         GOOS=$(GOOS) $(SHELL) $(srcdir)/mksigtab.sh > tmp-sigtab.go
545         $(SHELL) $(srcdir)/mvifdiff.sh tmp-sigtab.go sigtab.go
546         $(STAMP) $@
548 GCCGO_INSTALL_NAME := $(shell echo gccgo|sed '$(program_transform_name)')
549 GCC_INSTALL_NAME := $(shell echo gcc|sed '$(program_transform_name)')
550 GXX_INSTALL_NAME := $(shell echo g++|sed '$(program_transform_name)')
552 zdefaultcc.go: s-zdefaultcc; @true
553 s-zdefaultcc: Makefile
554         echo 'package cfg' > zdefaultcc.go.tmp
555         echo >> zdefaultcc.go.tmp
556         echo 'const DefaultGCCGO = "$(bindir)/$(GCCGO_INSTALL_NAME)"' >> zdefaultcc.go.tmp
557         echo 'const DefaultCC = "$(GCC_INSTALL_NAME)"' >> zdefaultcc.go.tmp
558         echo 'const DefaultCXX = "$(GXX_INSTALL_NAME)"' >> zdefaultcc.go.tmp
559         echo 'const DefaultPkgConfig = "pkg-config"' >> zdefaultcc.go.tmp
560         $(SHELL) $(srcdir)/../move-if-change zdefaultcc.go.tmp zdefaultcc.go
561         $(STAMP) $@ 
563 # _Complex_lock and _Reader_lock are Go translations of some AIX system
564 # types and should not be exported back to C
565 # semt is a Go translation of the C type sem_t; it fails to convert on
566 # some systems and need not be exported back to C.
567 # sigset conflicts with system type sigset on AIX, so we need to rename it
568 runtime.inc: s-runtime-inc; @true
569 s-runtime-inc: runtime.lo Makefile
570         rm -f runtime.inc.tmp2 runtime.inc.tmp3
571         grep -v "#define _" runtime.inc.tmp | grep -v "#define [cm][01234] " | grep -v "#define empty " > runtime.inc.tmp2
572         for pattern in '_[GP][a-z]' _Max _Lock _Sig _Trace _MHeap _Num; do \
573           grep "#define $$pattern" runtime.inc.tmp >> runtime.inc.tmp2; \
574         done
575         for TYPE in _Complex_lock _Reader_lock semt; do \
576           sed -e '/struct '$${TYPE}' {/,/^}/s/^.*$$//' runtime.inc.tmp2 > runtime.inc.tmp3; \
577           mv runtime.inc.tmp3 runtime.inc.tmp2; \
578         done
579         sed -e 's/sigset/sigset_go/' runtime.inc.tmp2 > runtime.inc.tmp3
580         $(SHELL) $(srcdir)/mvifdiff.sh runtime.inc.tmp3 runtime.inc
581         rm -f runtime.inc.tmp2 runtime.inc.tmp3
582         $(STAMP) $@
584 noinst_DATA += zstdpkglist.go zdefaultcc.go
586 # Generate the list of go std packages that were included in libgo
587 zstdpkglist.go: s-zstdpkglist; @true
588 s-zstdpkglist: Makefile
589         rm -f zstdpkglist.go.tmp
590         echo 'package load' > zstdpkglist.go.tmp
591         echo "" >> zstdpkglist.go.tmp
592         echo 'var stdpkg = map[string]bool{' >> zstdpkglist.go.tmp
593         echo $(libgo_go_objs) 'unsafe.lo' 'runtime/cgo.lo' | sed 's|[a-z0-9_/]*_c\.lo||g' | sed 's|\([a-z0-9_/]*\)\.lo|"\1": true,|g' >> zstdpkglist.go.tmp
594         echo '}' >> zstdpkglist.go.tmp
595         $(SHELL) $(srcdir)/mvifdiff.sh zstdpkglist.go.tmp zstdpkglist.go
596         $(STAMP) $@
598 if LIBGO_IS_LINUX
599 syscall_epoll_file = epoll.go
600 else
601 syscall_epoll_file =
602 endif
604 libcalls.go: s-libcalls; @true
605 s-libcalls: libcalls-list go/syscall/mksyscall.awk $(srcdir)/go/syscall/*.go
606         rm -f libcalls.go.tmp
607         $(AWK) -f $(srcdir)/go/syscall/mksyscall.awk `cat libcalls-list` > libcalls.go.tmp
608         $(SHELL) $(srcdir)/mvifdiff.sh libcalls.go.tmp libcalls.go
609         $(STAMP) $@
611 libcalls-list: s-libcalls-list; @true
612 s-libcalls-list: Makefile $(srcdir)/go/syscall/*.go
613         rm -f libcalls-list.tmp
614         $(SHELL) $(srcdir)/match.sh --goarch=$(GOARCH) --goos=$(GOOS) --srcdir=$(srcdir)/go/syscall $(matchargs_syscall) > libcalls-list.tmp
615         $(SHELL) $(srcdir)/mvifdiff.sh libcalls-list.tmp libcalls-list
616         $(STAMP) $@
618 syscall_arch.go: s-syscall_arch; @true
619 s-syscall_arch: Makefile
620         rm -f syscall_arch.go.tmp
621         echo "package syscall" > syscall_arch.go.tmp
622         echo 'const ARCH = "'$(GOARCH)'"' >> syscall_arch.go.tmp
623         echo 'const OS = "'$(GOOS)'"' >> syscall_arch.go.tmp
624         $(SHELL) $(srcdir)/mvifdiff.sh syscall_arch.go.tmp syscall_arch.go
625         $(STAMP) $@
627 SYSINFO_FLAGS = \
628         $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \
629         $(CPPFLAGS) $(OSCFLAGS) -O
631 gen-sysinfo.go: s-gen-sysinfo; @true
632 s-gen-sysinfo: $(srcdir)/sysinfo.c config.h
633         $(CC) $(SYSINFO_FLAGS) -fdump-go-spec=tmp-gen-sysinfo.go -std=gnu99 -S -o sysinfo.s $(srcdir)/sysinfo.c
634         rm -f sysinfo.s
635         $(SHELL) $(srcdir)/mvifdiff.sh tmp-gen-sysinfo.go gen-sysinfo.go
636         $(STAMP) $@
638 errno.i: s-errno; @true
639 s-errno:
640         echo '#include <errno.h>' | $(CC) $(SYSINFO_FLAGS) -x c - -E -dM > tmp-errno.i
641         $(SHELL) $(srcdir)/mvifdiff.sh tmp-errno.i errno.i
642         $(STAMP) $@
644 sysinfo.go: s-sysinfo; @true
645 s-sysinfo: $(srcdir)/mksysinfo.sh gen-sysinfo.go errno.i
646         GOOS=$(GOOS) $(SHELL) $(srcdir)/mksysinfo.sh
647         $(SHELL) $(srcdir)/mvifdiff.sh tmp-sysinfo.go sysinfo.go
648         $(STAMP) $@
650 # The epoll struct has an embedded union and is packed on x86_64,
651 # which is too complicated for mksysinfo.sh.  We find the offset of
652 # the only field we care about in configure.ac, and generate the
653 # struct here.
654 epoll.go: s-epoll; @true
655 s-epoll: Makefile
656         rm -f epoll.go.tmp
657         echo 'package syscall' > epoll.go.tmp
658         echo 'type EpollEvent struct {' >> epoll.go.tmp
659         echo '  Events uint32' >> epoll.go.tmp
660         case "$(SIZEOF_STRUCT_EPOLL_EVENT),$(STRUCT_EPOLL_EVENT_FD_OFFSET)" in \
661         0,0) echo 1>&2 "*** struct epoll_event data.fd offset unknown"; \
662            exit 1; ;; \
663         8,4) echo '     Fd int32' >> epoll.go.tmp; ;; \
664         12,4) echo '    Fd int32' >> epoll.go.tmp; \
665            echo '       Pad [4]byte' >> epoll.go.tmp; ;; \
666         12,8) echo '    Pad [4]byte' >> epoll.go.tmp; \
667            echo '       Fd int32' >> epoll.go.tmp; ;; \
668         16,8) echo '    Pad [4]byte' >> epoll.go.tmp; \
669            echo '       Fd int32' >> epoll.go.tmp; \
670            echo '       Pad2 [4]byte' >> epoll.go.tmp; ;; \
671         *) echo 1>&2 "*** struct epoll_event unsupported"; \
672            exit 1; ;; \
673         esac
674         echo '}' >> epoll.go.tmp
675         $(SHELL) $(srcdir)/mvifdiff.sh epoll.go.tmp epoll.go
676         $(STAMP) $@
678 if LIBGO_IS_LINUX
679 syscall_lib_clone_lo = syscall/clone_linux.lo
680 else
681 syscall_lib_clone_lo =
682 endif
684 PACKAGES = \
685         archive/tar \
686         archive/zip \
687         bufio \
688         bytes \
689         compress/bzip2 \
690         compress/flate \
691         compress/gzip \
692         compress/lzw \
693         compress/zlib \
694         container/heap \
695         container/list \
696         container/ring \
697         context \
698         crypto \
699         crypto/aes \
700         crypto/cipher \
701         crypto/des \
702         crypto/dsa \
703         crypto/ecdsa \
704         crypto/elliptic \
705         crypto/hmac \
706         crypto/internal/cipherhw \
707         crypto/md5 \
708         crypto/rand \
709         crypto/rc4 \
710         crypto/rsa \
711         crypto/sha1 \
712         crypto/sha256 \
713         crypto/sha512 \
714         crypto/subtle \
715         crypto/tls \
716         crypto/x509 \
717         crypto/x509/pkix \
718         database/sql \
719         database/sql/driver \
720         debug/dwarf \
721         debug/elf \
722         debug/gosym \
723         debug/macho \
724         debug/pe \
725         debug/plan9obj \
726         debug/xcoff \
727         encoding \
728         encoding/ascii85 \
729         encoding/asn1 \
730         encoding/base32 \
731         encoding/base64 \
732         encoding/binary \
733         encoding/csv \
734         encoding/gob \
735         encoding/hex \
736         encoding/json \
737         encoding/pem \
738         encoding/xml \
739         errors \
740         exp/proxy \
741         exp/terminal \
742         expvar \
743         flag \
744         fmt \
745         go/ast \
746         go/build \
747         go/constant \
748         go/doc \
749         go/format \
750         go/importer \
751         go/internal/gccgoimporter \
752         go/internal/gcimporter \
753         go/internal/srcimporter \
754         go/parser \
755         go/printer \
756         go/scanner \
757         go/token \
758         go/types \
759         golang_org/x/crypto/chacha20poly1305 \
760         golang_org/x/crypto/chacha20poly1305/internal/chacha20 \
761         golang_org/x/crypto/curve25519 \
762         golang_org/x/crypto/poly1305 \
763         golang_org/x/net/http2/hpack \
764         golang_org/x/net/idna \
765         golang_org/x/net/lex/httplex \
766         golang_org/x/net/proxy \
767         golang_org/x/text/secure/bidirule \
768         golang_org/x/text/transform \
769         golang_org/x/text/unicode/bidi \
770         golang_org/x/text/unicode/norm \
771         golang_org/x/text/width \
772         hash \
773         hash/adler32 \
774         hash/crc32 \
775         hash/crc64 \
776         hash/fnv \
777         html \
778         html/template \
779         image \
780         image/color \
781         image/color/palette \
782         image/draw \
783         image/gif \
784         image/internal/imageutil \
785         image/jpeg \
786         image/png \
787         index/suffixarray \
788         internal/nettrace \
789         internal/poll \
790         internal/race \
791         internal/singleflight \
792         internal/syscall/unix \
793         internal/testenv \
794         internal/trace \
795         io \
796         io/ioutil \
797         log \
798         log/syslog \
799         math \
800         math/big \
801         math/bits \
802         math/cmplx \
803         math/rand \
804         mime \
805         mime/multipart \
806         mime/quotedprintable \
807         net \
808         net/http \
809         net/http/cgi \
810         net/http/cookiejar \
811         net/http/fcgi \
812         net/http/httptest \
813         net/http/httptrace \
814         net/http/httputil \
815         net/http/internal \
816         net/http/pprof \
817         net/internal/socktest \
818         net/mail \
819         net/rpc \
820         net/rpc/jsonrpc \
821         net/smtp \
822         net/textproto \
823         net/url \
824         os \
825         os/exec \
826         os/signal \
827         os/user \
828         path \
829         path/filepath \
830         reflect \
831         regexp \
832         regexp/syntax \
833         runtime \
834         runtime/debug \
835         runtime/internal/atomic \
836         runtime/internal/sys \
837         runtime/pprof \
838         runtime/pprof/internal/profile \
839         runtime/trace \
840         sort \
841         strconv \
842         strings \
843         sync \
844         sync/atomic \
845         syscall \
846         testing \
847         testing/internal/testdeps \
848         testing/iotest \
849         testing/quick \
850         text/scanner \
851         text/tabwriter \
852         text/template \
853         text/template/parse \
854         time \
855         unicode \
856         unicode/utf16 \
857         unicode/utf8
859 libgo_go_objs = \
860         $(addsuffix .lo,$(PACKAGES)) \
861         bytes/index.lo \
862         reflect/makefunc_ffi_c.lo \
863         strings/index.lo \
864         $(syscall_lib_clone_lo) \
865         syscall/errno.lo \
866         syscall/signame.lo \
867         syscall/wait.lo \
868         $(golang_org_x_net_lif_lo) \
869         $(golang_org_x_net_route_lo) \
870         log/syslog/syslog_c.lo \
871         $(os_lib_inotify_lo) \
872         runtime/internal/atomic_c.lo \
873         sync/atomic_c.lo
875 libgo_ldflags = \
876         -version-info $(libtool_VERSION) $(PTHREAD_CFLAGS) $(AM_LDFLAGS)
878 libgo_libadd = \
879         $(libgo_go_objs) ../libbacktrace/libbacktrace.la \
880         $(LIBATOMIC) $(LIBFFI) $(PTHREAD_LIBS) $(MATH_LIBS) $(NET_LIBS)
882 libgo_la_SOURCES = $(runtime_files)
883 libgo_la_LDFLAGS = $(libgo_ldflags)
884 libgo_la_LIBADD = $(libgo_libadd)
886 libgo_llgo_la_SOURCES = $(runtime_files)
887 libgo_llgo_la_LDFLAGS = $(libgo_ldflags)
888 libgo_llgo_la_LIBADD = $(libgo_libadd)
890 libgobegin_a_SOURCES = \
891         runtime/go-main.c
893 libgobegin_llgo_a_SOURCES = \
894         runtime/go-main.c
896 # Use -fPIC for libgobegin so that it can be put in a PIE.
897 libgobegin_a_CFLAGS = $(AM_CFLAGS) -fPIC
898 libgobegin_llgo_a_CFLAGS = $(AM_CFLAGS) -fPIC
900 libgolibbegin_a_SOURCES = \
901         runtime/go-libmain.c
903 libgolibbegin_a_CFLAGS = $(AM_CFLAGS) -fPIC
905 GOTOOL_PACKAGES = \
906         cmd/go/internal/base \
907         cmd/go/internal/bug \
908         cmd/go/internal/buildid \
909         cmd/go/internal/cfg \
910         cmd/go/internal/clean \
911         cmd/go/internal/cmdflag \
912         cmd/go/internal/doc \
913         cmd/go/internal/envcmd \
914         cmd/go/internal/fix \
915         cmd/go/internal/fmtcmd \
916         cmd/go/internal/generate \
917         cmd/go/internal/get \
918         cmd/go/internal/help \
919         cmd/go/internal/list \
920         cmd/go/internal/load \
921         cmd/go/internal/run \
922         cmd/go/internal/str \
923         cmd/go/internal/test \
924         cmd/go/internal/tool \
925         cmd/go/internal/version \
926         cmd/go/internal/vet \
927         cmd/go/internal/web \
928         cmd/go/internal/work \
929         cmd/internal/browser \
930         cmd/internal/objabi
932 libgotool_a_SOURCES =
933 libgotool_a_DEPENDENCIES = $(addsuffix .lo,$(GOTOOL_PACKAGES))
934 libgotool_a_LIBADD = $(addsuffix .o,$(GOTOOL_PACKAGES))
936 define STATIC_template
937 $(subst -,_,$(subst .,_,$(subst /,_,$(1))))_GOCFLAGS = -static
938 endef
940 $(foreach package,$(GOTOOL_PACKAGES),$(eval $(call STATIC_template,$(package).lo)))
942 # Make sure runtime.inc is built before compiling any .c file.
943 $(libgo_la_OBJECTS): runtime.inc
944 $(libgo_llgo_la_OBJECTS): runtime.inc
945 $(libgobegin_a_OBJECTS): runtime.inc
946 $(libgobegin_llgo_a_OBJECTS): runtime.inc
947 $(libgolibbegin_a_OBJECTS): runtime.inc
949 LTLDFLAGS = $(shell $(SHELL) $(top_srcdir)/../libtool-ldflags $(LDFLAGS))
951 GOCFLAGS = $(CFLAGS)
952 AM_GOCFLAGS = $(STRINGOPS_FLAG) $(GO_SPLIT_STACK)
953 GOCOMPILE = $(GOC) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_GOCFLAGS) $(GOCFLAGS)
955 LTGOCOMPILE = $(LIBTOOL) --tag GO --mode=compile $(GOC) $(INCLUDES) \
956         $(AM_GOCFLAGS) $(GOCFLAGS)
958 GOLINK = $(LIBTOOL) --tag GO --mode-link $(GOC) \
959         $(OPT_LDFLAGS) $(SECTION_LDFLAGS) $(AM_GOCFLAGS) $(LTLDFLAGS) -o $@
961 # Build the dependencies for a Go package.
962 BUILDDEPS = \
963         $(MKDIR_P) $(@D); \
964         dir=`echo $@ | sed -e 's/.lo.dep$$//'`; \
965         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,,$@)))`; \
966         $(SHELL) $(srcdir)/godeps.sh `echo $@ | sed -e 's/.dep$$//'` $$files > $@.tmp; \
967         if ! cmp $@.tmp $@ >/dev/null 2>/dev/null; then \
968           rm -f `echo $@ | sed -e 's/\.dep$$//'`; \
969         fi; \
970         mv -f $@.tmp $@
972 # Build the .go files for a package, generating a .lo file.
973 BUILDPACKAGE = \
974         $(MKDIR_P) $(@D); \
975         files=`echo $^ | sed -e 's/[^ ]*\.gox//g' -e 's/[^ ]*\.dep//'`; \
976         $(LTGOCOMPILE) -I . -c -fgo-pkgpath=`echo $@ | sed -e 's/.lo$$//' -e 's|golang_org|vendor/golang_org|'` $($(subst -,_,$(subst .,_,$(subst /,_,$@)))_GOCFLAGS) -o $@ $$files
978 # How to build a .gox file from a .lo file.
979 # Matching .o file can either be in the same directory as the .lo (non-PIC
980 # object) or in the .libs directory (PIC object).
981 BUILDGOX = \
982         f="$(basename $<).o"; \
983         if test ! -f $$f; then \
984           f="$(basename $(<D)/.libs/$(<F)).o"; \
985         fi; \
986         $(OBJCOPY) -j .go_export $$f $@.tmp; \
987         $(SHELL) $(srcdir)/mvifdiff.sh $@.tmp `echo $@ | sed -e 's/s-gox/gox/'`
989 GOTESTFLAGS =
990 GOBENCH = 
992 # Check a package.
993 CHECK = \
994         GC="$(GOC) $(GOCFLAGS) $($(subst /,_,$@)_GOCFLAGS) -L `${PWD_COMMAND}` -L `${PWD_COMMAND}`/.libs"; \
995         export GC; \
996         GOLIBS="$(extra_check_libs_$(subst /,_,$(@D))) $(MATH_LIBS) $(NET_LIBS) $(LIBS)"; \
997         export GOLIBS; \
998         RUNTESTFLAGS="$(RUNTESTFLAGS)"; \
999         export RUNTESTFLAGS; \
1000         MAKE="$(MAKE)"; \
1001         export MAKE; \
1002         NM="$(NM)"; \
1003         export NM; \
1004         libgccdir=`${GOC} -print-libgcc-file-name | sed -e 's|/[^/]*$$||'`; \
1005         LD_LIBRARY_PATH="`${PWD_COMMAND}`/.libs:$${libgccdir}:${LD_LIBRARY_PATH}"; \
1006         LD_LIBRARY_PATH=`echo $${LD_LIBRARY_PATH} | sed 's,::*,:,g;s,^:*,,;s,:*$$,,'`; \
1007         export LD_LIBRARY_PATH; \
1008         $(MKDIR_P) $(@D); \
1009         rm -f $@-testsum $@-testlog; \
1010         files=`$(SHELL) $(srcdir)/match.sh --goarch=$(GOARCH) --goos=$(GOOS) --srcdir=$(srcdir)/go/$(@D) --extrafiles="$(extra_go_files_$(subst /,_,$(@D)))" $(matchargs_$(subst /,_,$(@D)))`; \
1011         if test "$(USE_DEJAGNU)" = "yes"; then \
1012           $(SHELL) $(srcdir)/testsuite/gotest --goarch=$(GOARCH) --goos=$(GOOS) --dejagnu=yes --basedir=$(srcdir) --srcdir=$(srcdir)/go/$(@D) --pkgpath="$(@D)" --pkgfiles="$$files" --testname="$(@D)" $(GOTESTFLAGS); \
1013         elif test "$(GOBENCH)" != ""; then \
1014           $(SHELL) $(srcdir)/testsuite/gotest --goarch=$(GOARCH) --goos=$(GOOS) --basedir=$(srcdir) --srcdir=$(srcdir)/go/$(@D) --pkgpath="$(@D)" --pkgfiles="$$files" --bench="$(GOBENCH)" $(GOTESTFLAGS); \
1015         else \
1016           if $(SHELL) $(srcdir)/testsuite/gotest --goarch=$(GOARCH) --goos=$(GOOS) --basedir=$(srcdir) --srcdir=$(srcdir)/go/$(@D) --pkgpath="$(@D)" --pkgfiles="$$files" $(GOTESTFLAGS) >>$@-testlog 2>&1; then \
1017             echo "PASS: $(@D)" >> $@-testlog; \
1018             echo "PASS: $(@D)"; \
1019             echo "PASS: $(@D)" > $@-testsum; \
1020           else \
1021             echo "FAIL: $(@D)" >> $@-testlog; \
1022             cat $@-testlog; \
1023             echo "FAIL: $(@D)" > $@-testsum; \
1024             exit 1; \
1025           fi; \
1026         fi
1028 # Build all packages before checking any.
1029 CHECK_DEPS = \
1030         $(toolexeclibgo_DATA) \
1031         $(toolexeclibgoarchive_DATA) \
1032         $(toolexeclibgocompress_DATA) \
1033         $(toolexeclibgocontainer_DATA) \
1034         $(toolexeclibgocrypto_DATA) \
1035         $(toolexeclibgodebug_DATA) \
1036         $(toolexeclibgoencoding_DATA) \
1037         $(toolexeclibgoexp_DATA) \
1038         $(toolexeclibgogo_DATA) \
1039         $(toolexeclibgohash_DATA) \
1040         $(toolexeclibgoimage_DATA) \
1041         $(toolexeclibgoindex_DATA) \
1042         $(toolexeclibgoio_DATA) \
1043         $(toolexeclibgolog_DATA) \
1044         $(toolexeclibgomath_DATA) \
1045         $(toolexeclibgomime_DATA) \
1046         $(toolexeclibgonet_DATA) \
1047         $(toolexeclibgonethttp_DATA) \
1048         $(toolexeclibgoos_DATA) \
1049         $(toolexeclibgopath_DATA) \
1050         $(toolexeclibgorpc_DATA) \
1051         $(toolexeclibgoruntime_DATA) \
1052         $(toolexeclibgosync_DATA) \
1053         $(toolexeclibgotesting_DATA) \
1054         $(toolexeclibgotext_DATA) \
1055         $(toolexeclibgotexttemplate_DATA) \
1056         $(toolexeclibgounicode_DATA) \
1057         $(noinst_LIBRARIES)
1059 if GOC_IS_LLGO
1060 CHECK_DEPS += libgo-llgo.la libgobegin-llgo.a
1061 else
1062 CHECK_DEPS += libgo.la libgobegin.a
1063 endif
1065 # PACKAGE_template defines the rules for each package.
1066 # For example, for the package bufio, it produces:
1068 # @go_include@ bufio.lo.dep
1069 # bufio.lo.dep: $(srcdir)/go/bufio/*.go
1070 #       $(BUILDDEPS)
1071 # bufio.lo:
1072 #       $(BUILDPACKAGE)
1073 # bufio/check: $(CHECK_DEPS)
1074 #       @$(CHECK)
1075 # .PHONY: bufio/check
1077 # This is invoked with $(1) set to a package, which is a directory name,
1078 # such as "bufio" or "archive/tar".
1079 define PACKAGE_template
1080 @go_include@ $(1).lo.dep
1081 $(1).lo.dep: $(srcdir)/go/$(1)/*.go
1082         $$(BUILDDEPS)
1083 $(1).lo:
1084         $$(BUILDPACKAGE)
1085 $(1)/check: $$(CHECK_DEPS)
1086         @$$(CHECK)
1087 .PHONY: $(1)/check
1088 $(1).gox: $(1).s-gox; @true
1089 $(1).s-gox: $(1).lo
1090         $$(BUILDGOX)
1091         $$(STAMP) $$@
1092 endef
1094 # This line expands PACKAGE_template once for each package name listed
1095 # in $(PACKAGES).
1096 $(foreach package,$(PACKAGES),$(eval $(call PACKAGE_template,$(package))))
1097 $(foreach package,$(GOTOOL_PACKAGES),$(eval $(call PACKAGE_template,$(package))))
1099 # Pass -ffp-contract=off, or 386-specific options, when building the
1100 # math package.  MATH_FLAG is defined in configure.ac.
1101 math_lo_GOCFLAGS = $(MATH_FLAG)
1103 # Add the generated file runtime_sysinfo.go to the runtime package.
1104 extra_go_files_runtime = runtime_sysinfo.go sigtab.go
1105 runtime.lo.dep: $(extra_go_files_runtime)
1107 # Add generated files to the syscall package.
1108 extra_go_files_syscall = \
1109         libcalls.go \
1110         sysinfo.go \
1111         syscall_arch.go \
1112         $(syscall_epoll_file)
1113 syscall.lo.dep: $(extra_go_files_syscall)
1115 # Pass -fgo-compiling-runtime when compiling the runtime package.
1116 runtime_lo_GOCFLAGS = -fgo-c-header=runtime.inc.tmp -fgo-compiling-runtime
1117 runtime_check_GOCFLAGS = -fgo-compiling-runtime
1118 runtime_internal_atomic_lo_GOCFLAGS = -fgo-compiling-runtime
1119 runtime_internal_atomic_lo_check_GOCFLAGS = -fgo-compiling-runtime
1120 runtime_internal_sys_lo_GOCFLAGS = -fgo-compiling-runtime
1121 runtime_internal_sys_lo_check_GOCFLAGS = -fgo-compiling-runtime
1123 # If libffi is supported (the normal case) use the ffi build tag for
1124 # the runtime package.
1125 if USE_LIBFFI
1126 matchargs_runtime = --tag=libffi
1127 else
1128 matchargs_runtime =
1129 endif
1131 # At least for now, we need -static-libgo for this test, because
1132 # otherwise we can't get the line numbers.
1133 # Also use -fno-inline to get better results from the memory profiler.
1134 runtime_pprof_check_GOCFLAGS = -static-libgo -fno-inline
1136 extra_go_files_runtime_internal_sys = version.go
1137 runtime/internal/sys.lo.dep: $(extra_go_files_runtime_internal_sys)
1139 extra_go_files_cmd_go_internal_cfg = zdefaultcc.go
1140 cmd/go/internal/cfg.lo.dep: $(extra_go_files_cmd_go_internal_cfg)
1142 extra_go_files_cmd_go_internal_load = zstdpkglist.go
1143 cmd/go/internal/load.lo.dep: $(extra_go_files_cmd_go_internal_load)
1145 extra_check_libs_cmd_go_internal_generate = $(abs_builddir)/libgotool.a
1146 extra_check_libs_cmd_go_internal_get = $(abs_builddir)/libgotool.a
1147 extra_check_libs_cmd_go_internal_load = $(abs_builddir)/libgotool.a
1148 extra_check_libs_cmd_go_internal_work = $(abs_builddir)/libgotool.a
1150 # FIXME: The following C files may as well move to the runtime
1151 # directory and be treated like other C files.
1153 # Use C code to speed up {bytes,strings}.IndexByte and friends.
1154 bytes/index.lo: go/bytes/indexbyte.c runtime.inc
1155         @$(MKDIR_P) bytes
1156         $(LTCOMPILE) -c -o $@ $(srcdir)/go/bytes/indexbyte.c
1157 strings/index.lo: go/strings/indexbyte.c runtime.inc
1158         @$(MKDIR_P) strings
1159         $(LTCOMPILE) -c -o $@ $(srcdir)/go/strings/indexbyte.c
1161 # Use a C function with a fixed number of arguments to call a C
1162 # varargs function.
1163 log/syslog/syslog_c.lo: go/log/syslog/syslog_c.c runtime.inc
1164         @$(MKDIR_P) log/syslog
1165         $(LTCOMPILE) -c -o $@ $(srcdir)/go/log/syslog/syslog_c.c
1167 # The interface to libffi from the reflect package is written in C.
1168 reflect/makefunc_ffi_c.lo: go/reflect/makefunc_ffi_c.c runtime.inc
1169         @$(MKDIR_P) reflect
1170         $(LTCOMPILE) -c -o $@ $(srcdir)/go/reflect/makefunc_ffi_c.c
1172 # The atomic functions are written in C.
1173 runtime/internal/atomic_c.lo: go/runtime/internal/atomic/atomic.c runtime.inc
1174         @$(MKDIR_P) runtime/internal
1175         $(LTCOMPILE) -c -o $@ $(srcdir)/go/runtime/internal/atomic/atomic.c
1176 sync/atomic_c.lo: go/sync/atomic/atomic.c runtime.inc
1177         @$(MKDIR_P) sync
1178         $(LTCOMPILE) -c -o $@ $(srcdir)/go/sync/atomic/atomic.c
1180 # A few syscall functions are written in C.
1181 syscall/clone_linux.lo: go/syscall/clone_linux.c runtime.inc
1182         @$(MKDIR_P) syscall
1183         $(LTCOMPILE) -c -o $@ $(srcdir)/go/syscall/clone_linux.c
1184 syscall/errno.lo: go/syscall/errno.c runtime.inc
1185         @$(MKDIR_P) syscall
1186         $(LTCOMPILE) -c -o $@ $(srcdir)/go/syscall/errno.c
1187 syscall/signame.lo: go/syscall/signame.c runtime.inc
1188         @$(MKDIR_P) syscall
1189         $(LTCOMPILE) -c -o $@ $(srcdir)/go/syscall/signame.c
1190 syscall/wait.lo: go/syscall/wait.c runtime.inc
1191         @$(MKDIR_P) syscall
1192         $(LTCOMPILE) -c -o $@ $(srcdir)/go/syscall/wait.c
1194 # Solaris 12 changed the type of fields in struct stat.
1195 # Use a build tag, based on a configure check, to cope.
1196 if LIBGO_IS_SOLARIS
1197 if HAVE_STAT_TIMESPEC
1198 matchargs_os = --tag=solaristag
1199 else
1200 matchargs_os =
1201 endif
1202 else
1203 matchargs_os =
1204 endif
1206 if LIBGO_IS_BSD
1208 # Build golang_org/x/net/route only on BSD systems.
1210 $(eval $(call PACKAGE_template,golang_org/x/net/route))
1212 golang_org_x_net_route_lo = \
1213         golang_org/x/net/route.lo
1214 golang_org_x_net_route_check = \
1215         golang_org/x/net/route/check
1217 endif
1219 if LIBGO_IS_SOLARIS
1221 # Build golang_org/x/net/lif only on Solaris systems.
1223 $(eval $(call PACKAGE_template,golang_org/x/net/lif))
1225 golang_org_x_net_lif_lo = \
1226         golang_org/x/net/lif.lo
1227 golang_org_x_net_lif_check = \
1228         golang_org/x/net/lif/check
1230 endif
1232 TEST_PACKAGES = \
1233         bufio/check \
1234         bytes/check \
1235         context/check \
1236         errors/check \
1237         expvar/check \
1238         flag/check \
1239         fmt/check \
1240         html/check \
1241         image/check \
1242         io/check \
1243         log/check \
1244         math/check \
1245         mime/check \
1246         net/check \
1247         os/check \
1248         path/check \
1249         reflect/check \
1250         regexp/check \
1251         runtime/check \
1252         sort/check \
1253         strconv/check \
1254         strings/check \
1255         sync/check \
1256         syscall/check \
1257         time/check \
1258         unicode/check \
1259         archive/tar/check \
1260         archive/zip/check \
1261         cmd/go/internal/generate/check \
1262         cmd/go/internal/get/check \
1263         cmd/go/internal/load/check \
1264         cmd/go/internal/work/check \
1265         cmd/internal/objabi/check \
1266         compress/bzip2/check \
1267         compress/flate/check \
1268         compress/gzip/check \
1269         compress/lzw/check \
1270         compress/zlib/check \
1271         container/heap/check \
1272         container/list/check \
1273         container/ring/check \
1274         crypto/aes/check \
1275         crypto/cipher/check \
1276         crypto/des/check \
1277         crypto/dsa/check \
1278         crypto/ecdsa/check \
1279         crypto/elliptic/check \
1280         crypto/hmac/check \
1281         crypto/md5/check \
1282         crypto/rand/check \
1283         crypto/rc4/check \
1284         crypto/rsa/check \
1285         crypto/sha1/check \
1286         crypto/sha256/check \
1287         crypto/sha512/check \
1288         crypto/subtle/check \
1289         crypto/tls/check \
1290         crypto/x509/check \
1291         database/sql/check \
1292         database/sql/driver/check \
1293         debug/dwarf/check \
1294         debug/elf/check \
1295         debug/macho/check \
1296         debug/pe/check \
1297         debug/plan9obj/check \
1298         debug/xcoff/check \
1299         encoding/ascii85/check \
1300         encoding/asn1/check \
1301         encoding/base32/check \
1302         encoding/base64/check \
1303         encoding/binary/check \
1304         encoding/csv/check \
1305         encoding/gob/check \
1306         encoding/hex/check \
1307         encoding/json/check \
1308         encoding/pem/check \
1309         encoding/xml/check \
1310         exp/proxy/check \
1311         exp/terminal/check \
1312         html/template/check \
1313         go/ast/check \
1314         go/build/check \
1315         go/constant/check \
1316         go/doc/check \
1317         go/format/check \
1318         go/internal/gcimporter/check \
1319         go/internal/gccgoimporter/check \
1320         go/internal/srcimporter/check \
1321         go/parser/check \
1322         go/printer/check \
1323         go/scanner/check \
1324         go/token/check \
1325         go/types/check \
1326         golang_org/x/crypto/chacha20poly1305/check \
1327         golang_org/x/crypto/chacha20poly1305/internal/chacha20/check \
1328         golang_org/x/crypto/curve25519/check \
1329         golang_org/x/crypto/poly1305/check \
1330         golang_org/x/net/http2/hpack/check \
1331         golang_org/x/net/idna/check \
1332         golang_org/x/net/lex/httplex/check \
1333         $(golang_org_x_net_lif_check) \
1334         golang_org/x/net/proxy/check \
1335         $(golang_org_x_net_route_check) \
1336         hash/adler32/check \
1337         hash/crc32/check \
1338         hash/crc64/check \
1339         hash/fnv/check \
1340         image/color/check \
1341         image/draw/check \
1342         image/jpeg/check \
1343         image/png/check \
1344         index/suffixarray/check \
1345         internal/poll/check \
1346         internal/singleflight/check \
1347         internal/trace/check \
1348         io/ioutil/check \
1349         log/syslog/check \
1350         math/big/check \
1351         math/bits/check \
1352         math/cmplx/check \
1353         math/rand/check \
1354         mime/multipart/check \
1355         mime/quotedprintable/check \
1356         net/http/check \
1357         net/http/cgi/check \
1358         net/http/cookiejar/check \
1359         net/http/fcgi/check \
1360         net/http/httptest/check \
1361         net/http/httptrace/check \
1362         net/http/httputil/check \
1363         net/http/internal/check \
1364         net/internal/socktest/check \
1365         net/mail/check \
1366         net/rpc/check \
1367         net/smtp/check \
1368         net/textproto/check \
1369         net/url/check \
1370         net/rpc/jsonrpc/check \
1371         os/exec/check \
1372         os/signal/check \
1373         os/user/check \
1374         path/filepath/check \
1375         regexp/syntax/check \
1376         runtime/debug/check \
1377         runtime/internal/atomic/check \
1378         runtime/internal/sys/check \
1379         runtime/pprof/check \
1380         runtime/pprof/internal/profile/check \
1381         runtime/trace/check \
1382         sync/atomic/check \
1383         text/scanner/check \
1384         text/tabwriter/check \
1385         text/template/check \
1386         text/template/parse/check \
1387         testing/quick/check \
1388         unicode/utf16/check \
1389         unicode/utf8/check
1391 check: check-tail
1392 check-recursive: check-head
1394 check-head:
1395         @echo "Test Run By $${USER} on `date`" > libgo.head
1396         @echo "Native configuration is $(host_triplet)" >> libgo.head
1397         @echo >> libgo.head
1398         @echo "         === libgo tests ===" >> libgo.head
1399         @echo >> libgo.head
1401 check-tail: check-recursive check-multi
1402         @if test "$(USE_DEJAGNU)" = "yes"; then \
1403           exit 0; \
1404         fi; \
1405         lib=`${PWD_COMMAND} | sed -e 's,^.*/\([^/][^/]*\)$$,\1,'`; \
1406         for dir in . $(MULTIDIRS); do \
1407           mv ../$${dir}/$${lib}/libgo.sum ../$${dir}/$${lib}/libgo.sum.sep; \
1408           mv ../$${dir}/$${lib}/libgo.log ../$${dir}/$${lib}/libgo.log.sep; \
1409         done; \
1410         mv libgo.head libgo.sum; \
1411         cp libgo.sum libgo.log; \
1412         echo "Schedule of variations:" >> libgo.sum; \
1413         for dir in . $(MULTIDIRS); do \
1414           multidir=../$${dir}/$${lib}; \
1415           multivar=`cat $${multidir}/libgo.var`; \
1416           echo "    $${multivar}" >> libgo.sum; \
1417         done; \
1418         echo >> libgo.sum; \
1419         pass=0; fail=0; untested=0; \
1420         for dir in . $(MULTIDIRS); do \
1421           multidir=../$${dir}/$${lib}; \
1422           multivar=`cat $${multidir}/libgo.var`; \
1423           echo "Running target $${multivar}" >> libgo.sum; \
1424           echo "Running $(srcdir)/libgo.exp ..." >> libgo.sum; \
1425           cat $${multidir}/libgo.sum.sep >> libgo.sum; \
1426           cat $${multidir}/libgo.log.sep >> libgo.log; \
1427           if test -n "${MULTIDIRS}"; then \
1428             echo "              === libgo Summary for $${multivar} ===" >> libgo.sum; \
1429             echo >> libgo.sum; \
1430           fi; \
1431           p=`grep -c PASS $${multidir}/libgo.sum.sep`; \
1432           pass=`expr $$pass + $$p`; \
1433           if test "$$p" -ne "0" && test -n "${MULTIDIRS}"; then \
1434             echo "# of expected passes          $$p" >> libgo.sum; \
1435           fi; \
1436           p=`grep -c FAIL $${multidir}/libgo.sum.sep`; \
1437           fail=`expr $$fail + $$p`; \
1438           if test "$$p" -ne "0" && test -n "${MULTIDIRS}"; then \
1439             echo "# of unexpected failures      $$p" >> libgo.sum; \
1440           fi; \
1441           p=`grep -c UNTESTED $${multidir}/libgo.sum.sep`; \
1442           untested=`expr $$untested + $$p`; \
1443           if test "$$p" -ne "0" && test -n "${MULTIDIRS}"; then \
1444             echo "# of untested testcases               $$p" >> libgo.sum; \
1445           fi; \
1446         done; \
1447         echo >> libgo.sum; \
1448         echo "          === libgo Summary ===" >> libgo.sum; \
1449         echo >> libgo.sum; \
1450         if test "$$pass" -ne "0"; then \
1451           echo "# of expected passes            $$pass" >> libgo.sum; \
1452         fi; \
1453         if test "$$fail" -ne "0"; then \
1454           echo "# of unexpected failures        $$fail" >> libgo.sum; \
1455         fi; \
1456         if test "$$untested" -ne "0"; then \
1457           echo "# of untested testcases         $$untested" >> libgo.sum; \
1458         fi; \
1459         echo `echo $(GOC) | sed -e 's/ .*//'`  `$(GOC) -v 2>&1 | grep " version" | sed -n -e 's/.* \(version.*$$\)/\1/p'` >> libgo.sum; \
1460         echo >> libgo.log; \
1461         echo "runtest completed at `date`" >> libgo.log; \
1462         if test "$$fail" -ne "0"; then \
1463           status=1; \
1464         else \
1465           status=0; \
1466         fi; \
1467         exit $$status
1469 check-am:
1470         @rm -f libgo.sum libgo.log libgo.tail
1471         @multivar="unix"; \
1472         [ -z "$(MULTIFLAGS)" ] || multivar="$${multivar}/$(MULTIFLAGS)"; \
1473         echo "$${multivar}" > libgo.var
1474         @for f in $(TEST_PACKAGES); do \
1475            rm -f $$f-testsum $$f-testlog; \
1476          done
1477         -@$(MAKE) $(AM_MAKEFLAGS) -k $(TEST_PACKAGES)
1478         @for f in $(TEST_PACKAGES); do \
1479           if test -f $$f-testsum; then \
1480             cat $$f-testsum >> libgo.sum; \
1481           fi; \
1482           if test -f $$f-testlog; then \
1483             cat $$f-testlog >> libgo.log; \
1484           fi; \
1485         done
1487 check-multi:
1488         $(MULTIDO) $(AM_MAKEFLAGS) DO=check-am multi-do # $(MAKE)
1490 bench:
1491         -@$(MAKE) $(AM_MAKEFLAGS) -k $(TEST_PACKAGES) GOBENCH=.
1493 MOSTLYCLEANFILES = \
1494         s-runtime_sysinfo s-sigtab s-runtime-inc s-zstdpkglist \
1495         s-libcalls s-libcalls-list s-syscall_arch s-gen-sysinfo s-sysinfo \
1496         s-errno s-epoll \
1497         libgo.head libgo.sum.sep libgo.log.sep libgo.var \
1498         libcalls-list runtime.inc runtime.inc.tmp2 runtime.inc.tmp3
1500 mostlyclean-local:
1501         find . -name '*.lo' -print | xargs $(LIBTOOL) --mode=clean rm -f
1502         find . -name '*.$(OBJEXT)' -print | xargs rm -f
1503         find . -name '*-testsum' -print | xargs rm -f
1504         find . -name '*-testlog' -print | xargs rm -f
1506 CLEANFILES = *.go *.c s-* libgo.sum libgo.log runtime.inc
1508 clean-local:
1509         find . -name '*.la' -print | xargs $(LIBTOOL) --mode=clean rm -f
1510         find . -name '*.a' -print | xargs rm -f
1511         find . -name '*.gox' -print | xargs rm -f
1512         find . -name '*.s-gox' -print | xargs rm -f
1514 distclean-local:
1515         find . -name '*.lo.dep' -print | xargs rm -f