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.
10 SUFFIXES = .c .go .gox .o .obj .lo .a
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)
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
52 AM_LDFLAGS += -XCClinker $(SPLIT_STACK)
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
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.
69 "AR_FLAGS=$(AR_FLAGS)" \
70 "CC_FOR_BUILD=$(CC_FOR_BUILD)" \
71 "CC_FOR_TARGET=$(CC_FOR_TARGET)" \
73 "CXXFLAGS=$(CXXFLAGS)" \
74 "CFLAGS_FOR_BUILD=$(CFLAGS_FOR_BUILD)" \
75 "CFLAGS_FOR_TARGET=$(CFLAGS_FOR_TARGET)" \
76 "GOC_FOR_TARGET=$(GOC_FOR_TARGET)" \
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)" \
87 "MAKEINFO=$(MAKEINFO) $(MAKEINFOFLAGS)" \
88 "PICFLAG=$(PICFLAG)" \
89 "PICFLAG_FOR_TARGET=$(PICFLAG_FOR_TARGET)" \
91 "RUNTESTFLAGS=$(RUNTESTFLAGS)" \
92 "exec_prefix=$(exec_prefix)" \
93 "infodir=$(infodir)" \
95 "includedir=$(includedir)" \
97 "tooldir=$(tooldir)" \
98 "gxx_include_dir=$(gxx_include_dir)" \
104 "NM_FOR_BUILD=$(NM_FOR_BUILD)" \
105 "NM_FOR_TARGET=$(NM_FOR_TARGET)" \
106 "DESTDIR=$(DESTDIR)" \
109 # Subdir rules rely on $(FLAGS_TO_PASS)
110 FLAGS_TO_PASS = $(AM_MAKEFLAGS)
113 toolexeclib_LTLIBRARIES = libgo-llgo.la
114 toolexeclib_LIBRARIES = libgobegin-llgo.a
116 toolexeclib_LTLIBRARIES = libgo.la
117 toolexeclib_LIBRARIES = libgobegin.a libgolibbegin.a
120 toolexeclibgo_DATA = \
152 toolexeclibgoarchivedir = $(toolexeclibgodir)/archive
154 toolexeclibgoarchive_DATA = \
158 toolexeclibgocompressdir = $(toolexeclibgodir)/compress
160 toolexeclibgocompress_DATA = \
167 toolexeclibgocontainerdir = $(toolexeclibgodir)/container
169 toolexeclibgocontainer_DATA = \
174 toolexeclibgocryptodir = $(toolexeclibgodir)/crypto
176 toolexeclibgocrypto_DATA = \
182 crypto/elliptic.gox \
195 toolexeclibgocryptox509dir = $(toolexeclibgocryptodir)/x509
197 toolexeclibgocryptox509_DATA = \
200 toolexeclibgodatabasedir = $(toolexeclibgodir)/database
202 toolexeclibgodatabase_DATA = \
205 toolexeclibgodatabasesqldir = $(toolexeclibgodatabasedir)/sql
207 toolexeclibgodatabasesql_DATA = \
208 database/sql/driver.gox
210 toolexeclibgodebugdir = $(toolexeclibgodir)/debug
212 toolexeclibgodebug_DATA = \
220 toolexeclibgoencodingdir = $(toolexeclibgodir)/encoding
222 toolexeclibgoencoding_DATA = \
223 encoding/ascii85.gox \
225 encoding/base32.gox \
226 encoding/base64.gox \
227 encoding/binary.gox \
235 toolexeclibgoexpdir = $(toolexeclibgodir)/exp
237 toolexeclibgoexp_DATA = \
241 toolexeclibgogodir = $(toolexeclibgodir)/go
243 toolexeclibgogo_DATA = \
256 toolexeclibgohashdir = $(toolexeclibgodir)/hash
258 toolexeclibgohash_DATA = \
264 toolexeclibgohtmldir = $(toolexeclibgodir)/html
266 toolexeclibgohtml_DATA = \
269 toolexeclibgoimagedir = $(toolexeclibgodir)/image
271 toolexeclibgoimage_DATA = \
278 toolexeclibgoimagecolordir = $(toolexeclibgoimagedir)/color
280 toolexeclibgoimagecolor_DATA = \
281 image/color/palette.gox
283 toolexeclibgoindexdir = $(toolexeclibgodir)/index
285 toolexeclibgoindex_DATA = \
286 index/suffixarray.gox
288 toolexeclibgoiodir = $(toolexeclibgodir)/io
290 toolexeclibgoio_DATA = \
293 toolexeclibgologdir = $(toolexeclibgodir)/log
295 toolexeclibgolog_DATA = \
298 toolexeclibgomathdir = $(toolexeclibgodir)/math
300 toolexeclibgomath_DATA = \
305 toolexeclibgomimedir = $(toolexeclibgodir)/mime
307 toolexeclibgomime_DATA = \
309 mime/quotedprintable.gox
311 toolexeclibgonetdir = $(toolexeclibgodir)/net
313 toolexeclibgonet_DATA = \
321 toolexeclibgonethttpdir = $(toolexeclibgonetdir)/http
323 toolexeclibgonethttp_DATA = \
325 net/http/cookiejar.gox \
327 net/http/httptest.gox \
328 net/http/httptrace.gox \
329 net/http/httputil.gox \
332 toolexeclibgonetrpcdir = $(toolexeclibgonetdir)/rpc
334 toolexeclibgonetrpc_DATA = \
337 toolexeclibgoosdir = $(toolexeclibgodir)/os
339 toolexeclibgoos_DATA = \
344 toolexeclibgopathdir = $(toolexeclibgodir)/path
346 toolexeclibgopath_DATA = \
349 toolexeclibgoregexpdir = $(toolexeclibgodir)/regexp
351 toolexeclibgoregexp_DATA = \
354 toolexeclibgoruntimedir = $(toolexeclibgodir)/runtime
356 toolexeclibgoruntime_DATA = \
361 toolexeclibgosyncdir = $(toolexeclibgodir)/sync
363 toolexeclibgosync_DATA = \
366 toolexeclibgotestingdir = $(toolexeclibgodir)/testing
368 toolexeclibgotesting_DATA = \
372 toolexeclibgotestinginternaldir = $(toolexeclibgotestingdir)/internal
374 toolexeclibgotestinginternal_DATA = \
375 testing/internal/testdeps.gox
377 toolexeclibgotextdir = $(toolexeclibgodir)/text
379 toolexeclibgotext_DATA = \
384 toolexeclibgotexttemplatedir = $(toolexeclibgotextdir)/template
386 toolexeclibgotexttemplate_DATA = \
387 text/template/parse.gox
389 toolexeclibgounicodedir = $(toolexeclibgodir)/unicode
391 toolexeclibgounicode_DATA = \
396 rtems_task_variable_add_file = runtime/rtems-task-variable-add.c
398 rtems_task_variable_add_file =
402 runtime_thread_files = runtime/thread-linux.c
404 runtime_thread_files = runtime/thread-sema.c
408 runtime_getncpu_file = runtime/getncpu-linux.c
411 runtime_getncpu_file = runtime/getncpu-bsd.c
414 runtime_getncpu_file = runtime/getncpu-irix.c
417 runtime_getncpu_file = runtime/getncpu-solaris.c
420 runtime_getncpu_file = runtime/getncpu-bsd.c
423 runtime_getncpu_file = runtime/getncpu-bsd.c
426 runtime_getncpu_file = runtime/getncpu-aix.c
428 runtime_getncpu_file = runtime/getncpu-none.c
439 runtime/go-assert.c \
440 runtime/go-caller.c \
441 runtime/go-callers.c \
444 runtime/go-construct-map.c \
446 runtime/go-fieldtrack.c \
447 runtime/go-matherr.c \
448 runtime/go-memclr.c \
449 runtime/go-memcmp.c \
450 runtime/go-memequal.c \
451 runtime/go-memmove.c \
452 runtime/go-nanotime.c \
455 runtime/go-reflect-call.c \
456 runtime/go-runtime-error.c \
457 runtime/go-setenv.c \
458 runtime/go-signal.c \
459 runtime/go-strslice.c \
460 runtime/go-typedesc-equal.c \
461 runtime/go-unsafe-pointer.c \
462 runtime/go-unsetenv.c \
463 runtime/go-unwind.c \
464 runtime/go-varargs.c \
465 runtime/env_posix.c \
469 runtime/runtime_c.c \
472 $(runtime_thread_files) \
474 $(rtems_task_variable_add_file) \
475 $(runtime_getncpu_file)
477 version.go: s-version; @true
480 echo "package sys" > version.go.tmp
481 echo 'const DefaultGoroot = "$(prefix)"' >> version.go.tmp
482 echo 'const TheVersion = "'`cat $(srcdir)/VERSION | sed 1q`' '`$(GOC) --version | sed 1q`'"' >> version.go.tmp
483 echo 'const Goexperiment = ``' >> version.go.tmp
484 echo 'const GOARCH = "'$(GOARCH)'"' >> version.go.tmp
485 echo 'const GOOS = "'$(GOOS)'"' >> version.go.tmp
486 echo 'const GccgoToolDir = "$(libexecsubdir)"' >> version.go.tmp
487 echo >> version.go.tmp
488 echo "type ArchFamilyType int" >> version.go.tmp
489 echo >> version.go.tmp
490 echo "const (" >> version.go.tmp
491 echo " UNKNOWN ArchFamilyType = iota" >> version.go.tmp
492 for a in $(ALLGOARCHFAMILY); do \
493 echo " $${a}" >> version.go.tmp; \
495 echo ")" >> version.go.tmp
496 echo >> version.go.tmp
497 for a in $(ALLGOARCH); do \
498 f=`echo $${a} | sed -e 's/\(.\).*/\1/' -e 'y/abcdefghijklmnopqrstuvwxyz/ABCDEFGHIJKLMNOPQRSTUVWXYZ/'`; \
499 n="$${f}`echo $${a} | sed -e 's/.//'`"; \
500 if test "$${a}" = "$(GOARCH)"; then \
501 echo "const Goarch$${n} = 1" >> version.go.tmp; \
503 echo "const Goarch$${n} = 0" >> version.go.tmp; \
506 echo >> version.go.tmp
507 echo "const (" >> version.go.tmp
508 echo " ArchFamily = $(GOARCH_FAMILY)" >> version.go.tmp
509 echo " BigEndian = $(GOARCH_BIGENDIAN)" >> version.go.tmp
510 echo " CacheLineSize = $(GOARCH_CACHELINESIZE)" >> version.go.tmp
511 echo " PhysPageSize = $(GOARCH_PHYSPAGESIZE)" >> version.go.tmp
512 echo " PCQuantum = $(GOARCH_PCQUANTUM)" >> version.go.tmp
513 echo " Int64Align = $(GOARCH_INT64ALIGN)" >> version.go.tmp
514 echo " HugePageSize = $(GOARCH_HUGEPAGESIZE)" >> version.go.tmp
515 echo " MinFrameSize = $(GOARCH_MINFRAMESIZE)" >> version.go.tmp
516 echo ")" >> version.go.tmp
517 echo >> version.go.tmp
518 for a in $(ALLGOOS); do \
519 f=`echo $${a} | sed -e 's/\(.\).*/\1/' -e 'y/abcdefghijklmnopqrstuvwxyz/ABCDEFGHIJKLMNOPQRSTUVWXYZ/'`; \
520 n="$${f}`echo $${a} | sed -e 's/.//'`"; \
521 if test "$${a}" = "$(GOOS)"; then \
522 echo "const Goos$${n} = 1" >> version.go.tmp; \
524 echo "const Goos$${n} = 0" >> version.go.tmp; \
527 echo >> version.go.tmp
528 echo "type Uintreg uintptr" >> version.go.tmp
529 $(SHELL) $(srcdir)/mvifdiff.sh version.go.tmp version.go
532 runtime_sysinfo.go: s-runtime_sysinfo; @true
533 s-runtime_sysinfo: $(srcdir)/mkrsysinfo.sh gen-sysinfo.go
534 GOARCH=$(GOARCH) GOOS=$(GOOS) $(SHELL) $(srcdir)/mkrsysinfo.sh
535 $(SHELL) $(srcdir)/mvifdiff.sh tmp-runtime_sysinfo.go runtime_sysinfo.go
538 sigtab.go: s-sigtab; @true
539 s-sigtab: $(srcdir)/mksigtab.sh gen-sysinfo.go
540 GOOS=$(GOOS) $(SHELL) $(srcdir)/mksigtab.sh > tmp-sigtab.go
541 $(SHELL) $(srcdir)/mvifdiff.sh tmp-sigtab.go sigtab.go
544 # _Complex_lock and _Reader_lock are Go translations of some AIX system
545 # types and should not be exported back to C
546 # semt is a Go translation of the C type sem_t; it fails to convert on
547 # some systems and need not be exported back to C.
548 # sigset conflicts with system type sigset on AIX, so we need to rename it
549 runtime.inc: s-runtime-inc; @true
550 s-runtime-inc: runtime.lo Makefile
551 rm -f runtime.inc.tmp2 runtime.inc.tmp3
552 grep -v "#define _" runtime.inc.tmp | grep -v "#define [cm][01234] " | grep -v "#define empty " > runtime.inc.tmp2
553 for pattern in '_[GP][a-z]' _Max _Lock _Sig _Trace _MHeap _Num; do \
554 grep "#define $$pattern" runtime.inc.tmp >> runtime.inc.tmp2; \
556 for TYPE in _Complex_lock _Reader_lock semt; do \
557 sed -e '/struct '$${TYPE}' {/,/^}/s/^.*$$//' runtime.inc.tmp2 > runtime.inc.tmp3; \
558 mv runtime.inc.tmp3 runtime.inc.tmp2; \
560 sed -e 's/sigset/sigset_go/' runtime.inc.tmp2 > runtime.inc.tmp3
561 $(SHELL) $(srcdir)/mvifdiff.sh runtime.inc.tmp3 runtime.inc
562 rm -f runtime.inc.tmp2 runtime.inc.tmp3
565 noinst_DATA = zstdpkglist.go
567 # Generate the list of go std packages that were included in libgo
568 zstdpkglist.go: s-zstdpkglist; @true
569 s-zstdpkglist: Makefile
570 rm -f zstdpkglist.go.tmp
571 echo 'package main' > zstdpkglist.go.tmp
572 echo "" >> zstdpkglist.go.tmp
573 echo 'var stdpkg = map[string]bool{' >> zstdpkglist.go.tmp
574 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
575 echo '}' >> zstdpkglist.go.tmp
576 $(SHELL) $(srcdir)/mvifdiff.sh zstdpkglist.go.tmp zstdpkglist.go
580 syscall_epoll_file = epoll.go
585 libcalls.go: s-libcalls; @true
586 s-libcalls: libcalls-list go/syscall/mksyscall.awk $(srcdir)/go/syscall/*.go
587 rm -f libcalls.go.tmp
588 $(AWK) -f $(srcdir)/go/syscall/mksyscall.awk `cat libcalls-list` > libcalls.go.tmp
589 $(SHELL) $(srcdir)/mvifdiff.sh libcalls.go.tmp libcalls.go
592 libcalls-list: s-libcalls-list; @true
593 s-libcalls-list: Makefile $(srcdir)/go/syscall/*.go
594 rm -f libcalls-list.tmp
595 $(SHELL) $(srcdir)/match.sh --goarch=$(GOARCH) --goos=$(GOOS) --srcdir=$(srcdir)/go/syscall $(matchargs_syscall) > libcalls-list.tmp
596 $(SHELL) $(srcdir)/mvifdiff.sh libcalls-list.tmp libcalls-list
599 syscall_arch.go: s-syscall_arch; @true
600 s-syscall_arch: Makefile
601 rm -f syscall_arch.go.tmp
602 echo "package syscall" > syscall_arch.go.tmp
603 echo 'const ARCH = "'$(GOARCH)'"' >> syscall_arch.go.tmp
604 echo 'const OS = "'$(GOOS)'"' >> syscall_arch.go.tmp
605 $(SHELL) $(srcdir)/mvifdiff.sh syscall_arch.go.tmp syscall_arch.go
609 $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \
610 $(CPPFLAGS) $(OSCFLAGS) -O
612 gen-sysinfo.go: s-gen-sysinfo; @true
613 s-gen-sysinfo: $(srcdir)/sysinfo.c config.h
614 $(CC) $(SYSINFO_FLAGS) -fdump-go-spec=tmp-gen-sysinfo.go -std=gnu99 -S -o sysinfo.s $(srcdir)/sysinfo.c
616 $(SHELL) $(srcdir)/mvifdiff.sh tmp-gen-sysinfo.go gen-sysinfo.go
619 errno.i: s-errno; @true
621 echo '#include <errno.h>' | $(CC) $(SYSINFO_FLAGS) -x c - -E -dM > tmp-errno.i
622 $(SHELL) $(srcdir)/mvifdiff.sh tmp-errno.i errno.i
625 sysinfo.go: s-sysinfo; @true
626 s-sysinfo: $(srcdir)/mksysinfo.sh gen-sysinfo.go errno.i
627 GOOS=$(GOOS) $(SHELL) $(srcdir)/mksysinfo.sh
628 $(SHELL) $(srcdir)/mvifdiff.sh tmp-sysinfo.go sysinfo.go
631 # The epoll struct has an embedded union and is packed on x86_64,
632 # which is too complicated for mksysinfo.sh. We find the offset of
633 # the only field we care about in configure.ac, and generate the
635 epoll.go: s-epoll; @true
638 echo 'package syscall' > epoll.go.tmp
639 echo 'type EpollEvent struct {' >> epoll.go.tmp
640 echo ' Events uint32' >> epoll.go.tmp
641 case "$(SIZEOF_STRUCT_EPOLL_EVENT),$(STRUCT_EPOLL_EVENT_FD_OFFSET)" in \
642 0,0) echo 1>&2 "*** struct epoll_event data.fd offset unknown"; \
644 8,4) echo ' Fd int32' >> epoll.go.tmp; ;; \
645 12,4) echo ' Fd int32' >> epoll.go.tmp; \
646 echo ' Pad [4]byte' >> epoll.go.tmp; ;; \
647 12,8) echo ' Pad [4]byte' >> epoll.go.tmp; \
648 echo ' Fd int32' >> epoll.go.tmp; ;; \
649 16,8) echo ' Pad [4]byte' >> epoll.go.tmp; \
650 echo ' Fd int32' >> epoll.go.tmp; \
651 echo ' Pad2 [4]byte' >> epoll.go.tmp; ;; \
652 *) echo 1>&2 "*** struct epoll_event unsupported"; \
655 echo '}' >> epoll.go.tmp
656 $(SHELL) $(srcdir)/mvifdiff.sh epoll.go.tmp epoll.go
660 syscall_lib_clone_lo = syscall/clone_linux.lo
662 syscall_lib_clone_lo =
670 cmd/internal/browser \
688 crypto/internal/cipherhw \
701 database/sql/driver \
732 go/internal/gccgoimporter \
733 go/internal/gcimporter \
739 golang_org/x/crypto/chacha20poly1305 \
740 golang_org/x/crypto/chacha20poly1305/internal/chacha20 \
741 golang_org/x/crypto/curve25519 \
742 golang_org/x/crypto/poly1305 \
743 golang_org/x/net/http2/hpack \
744 golang_org/x/net/idna \
745 golang_org/x/net/lex/httplex \
746 golang_org/x/text/transform \
747 golang_org/x/text/unicode/norm \
748 golang_org/x/text/width \
758 image/color/palette \
761 image/internal/imageutil \
766 internal/pprof/profile \
768 internal/singleflight \
769 internal/syscall/unix \
782 mime/quotedprintable \
793 net/internal/socktest \
811 runtime/internal/atomic \
812 runtime/internal/sys \
814 runtime/pprof/internal/protopprof \
823 testing/internal/testdeps \
829 text/template/parse \
836 $(addsuffix .lo,$(PACKAGES)) \
838 reflect/makefunc_ffi_c.lo \
840 $(syscall_lib_clone_lo) \
844 $(golang_org_x_net_lif_lo) \
845 $(golang_org_x_net_route_lo) \
846 log/syslog/syslog_c.lo \
847 $(os_lib_inotify_lo) \
848 runtime/internal/atomic_c.lo \
852 -version-info $(libtool_VERSION) $(PTHREAD_CFLAGS) $(AM_LDFLAGS)
855 $(libgo_go_objs) ../libbacktrace/libbacktrace.la \
856 $(LIBATOMIC) $(LIBFFI) $(PTHREAD_LIBS) $(MATH_LIBS) $(NET_LIBS)
858 libgo_la_SOURCES = $(runtime_files)
859 libgo_la_LDFLAGS = $(libgo_ldflags)
860 libgo_la_LIBADD = $(libgo_libadd)
862 libgo_llgo_la_SOURCES = $(runtime_files)
863 libgo_llgo_la_LDFLAGS = $(libgo_ldflags)
864 libgo_llgo_la_LIBADD = $(libgo_libadd)
866 libgobegin_a_SOURCES = \
869 libgobegin_llgo_a_SOURCES = \
872 # Use -fPIC for libgobegin so that it can be put in a PIE.
873 libgobegin_a_CFLAGS = $(AM_CFLAGS) -fPIC
874 libgobegin_llgo_a_CFLAGS = $(AM_CFLAGS) -fPIC
876 libgolibbegin_a_SOURCES = \
879 libgolibbegin_a_CFLAGS = $(AM_CFLAGS) -fPIC
881 # Make sure runtime.inc is built before compiling any .c file.
882 $(libgo_la_OBJECTS): runtime.inc
883 $(libgo_llgo_la_OBJECTS): runtime.inc
884 $(libgobegin_a_OBJECTS): runtime.inc
885 $(libgobegin_llgo_a_OBJECTS): runtime.inc
886 $(libgolibbegin_a_OBJECTS): runtime.inc
888 LTLDFLAGS = $(shell $(SHELL) $(top_srcdir)/../libtool-ldflags $(LDFLAGS))
891 AM_GOCFLAGS = $(STRINGOPS_FLAG) $(GO_SPLIT_STACK)
892 GOCOMPILE = $(GOC) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_GOCFLAGS) $(GOCFLAGS)
894 LTGOCOMPILE = $(LIBTOOL) --tag GO --mode=compile $(GOC) $(INCLUDES) \
895 $(AM_GOCFLAGS) $(GOCFLAGS)
897 GOLINK = $(LIBTOOL) --tag GO --mode-link $(GOC) \
898 $(OPT_LDFLAGS) $(SECTION_LDFLAGS) $(AM_GOCFLAGS) $(LTLDFLAGS) -o $@
900 # Build the dependencies for a Go package.
903 dir=`echo $@ | sed -e 's/.lo.dep$$//'`; \
904 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,,$@)))`; \
905 $(SHELL) $(srcdir)/godeps.sh `echo $@ | sed -e 's/.dep$$//'` $$files > $@.tmp; \
906 if ! cmp $@.tmp $@ >/dev/null 2>/dev/null; then \
907 rm -f `echo $@ | sed -e 's/\.dep$$//'`; \
911 # Build the .go files for a package, generating a .lo file.
914 files=`echo $^ | sed -e 's/[^ ]*\.gox//g' -e 's/[^ ]*\.dep//'`; \
915 $(LTGOCOMPILE) -I . -c -fgo-pkgpath=`echo $@ | sed -e 's/.lo$$//' -e 's|golang_org|vendor/golang_org|'` $($(subst -,_,$(subst .,_,$(subst /,_,$@)))_GOCFLAGS) -o $@ $$files
917 # How to build a .gox file from a .lo file.
918 # Matching .o file can either be in the same directory as the .lo (non-PIC
919 # object) or in the .libs directory (PIC object).
921 f="$(basename $<).o"; \
922 if test ! -f $$f; then \
923 f="$(basename $(<D)/.libs/$(<F)).o"; \
925 $(OBJCOPY) -j .go_export $$f $@.tmp; \
926 $(SHELL) $(srcdir)/mvifdiff.sh $@.tmp `echo $@ | sed -e 's/s-gox/gox/'`
933 GC="$(GOC) $(GOCFLAGS) $($(subst /,_,$@)_GOCFLAGS) -L `${PWD_COMMAND}` -L `${PWD_COMMAND}`/.libs"; \
935 GOLIBS="$(MATH_LIBS) $(NET_LIBS) $(LIBS)"; \
937 RUNTESTFLAGS="$(RUNTESTFLAGS)"; \
938 export RUNTESTFLAGS; \
943 libgccdir=`${GOC} -print-libgcc-file-name | sed -e 's|/[^/]*$$||'`; \
944 LD_LIBRARY_PATH="`${PWD_COMMAND}`/.libs:$${libgccdir}:${LD_LIBRARY_PATH}"; \
945 LD_LIBRARY_PATH=`echo $${LD_LIBRARY_PATH} | sed 's,::*,:,g;s,^:*,,;s,:*$$,,'`; \
946 export LD_LIBRARY_PATH; \
948 rm -f $@-testsum $@-testlog; \
949 files=`$(SHELL) $(srcdir)/match.sh --goarch=$(GOARCH) --goos=$(GOOS) --srcdir=$(srcdir)/go/$(@D) --extrafiles="$(extra_go_files_$(subst /,_,$(@D)))" $(matchargs_$(subst /,_,$(@D)))`; \
950 if test "$(USE_DEJAGNU)" = "yes"; then \
951 $(SHELL) $(srcdir)/testsuite/gotest --goarch=$(GOARCH) --goos=$(GOOS) --dejagnu=yes --basedir=$(srcdir) --srcdir=$(srcdir)/go/$(@D) --pkgpath="$(@D)" --pkgfiles="$$files" --testname="$(@D)" $(GOTESTFLAGS); \
952 elif test "$(GOBENCH)" != ""; then \
953 $(SHELL) $(srcdir)/testsuite/gotest --goarch=$(GOARCH) --goos=$(GOOS) --basedir=$(srcdir) --srcdir=$(srcdir)/go/$(@D) --pkgpath="$(@D)" --pkgfiles="$$files" --bench="$(GOBENCH)" $(GOTESTFLAGS); \
955 if $(SHELL) $(srcdir)/testsuite/gotest --goarch=$(GOARCH) --goos=$(GOOS) --basedir=$(srcdir) --srcdir=$(srcdir)/go/$(@D) --pkgpath="$(@D)" --pkgfiles="$$files" $(GOTESTFLAGS) >>$@-testlog 2>&1; then \
956 echo "PASS: $(@D)" >> $@-testlog; \
957 echo "PASS: $(@D)"; \
958 echo "PASS: $(@D)" > $@-testsum; \
960 echo "FAIL: $(@D)" >> $@-testlog; \
962 echo "FAIL: $(@D)" > $@-testsum; \
967 # Build all packages before checking any.
969 $(toolexeclibgo_DATA) \
970 $(toolexeclibgoarchive_DATA) \
971 $(toolexeclibgocompress_DATA) \
972 $(toolexeclibgocontainer_DATA) \
973 $(toolexeclibgocrypto_DATA) \
974 $(toolexeclibgodebug_DATA) \
975 $(toolexeclibgoencoding_DATA) \
976 $(toolexeclibgoexp_DATA) \
977 $(toolexeclibgogo_DATA) \
978 $(toolexeclibgohash_DATA) \
979 $(toolexeclibgoimage_DATA) \
980 $(toolexeclibgoindex_DATA) \
981 $(toolexeclibgoio_DATA) \
982 $(toolexeclibgolog_DATA) \
983 $(toolexeclibgomath_DATA) \
984 $(toolexeclibgomime_DATA) \
985 $(toolexeclibgonet_DATA) \
986 $(toolexeclibgonethttp_DATA) \
987 $(toolexeclibgoos_DATA) \
988 $(toolexeclibgopath_DATA) \
989 $(toolexeclibgorpc_DATA) \
990 $(toolexeclibgoruntime_DATA) \
991 $(toolexeclibgosync_DATA) \
992 $(toolexeclibgotesting_DATA) \
993 $(toolexeclibgotext_DATA) \
994 $(toolexeclibgotexttemplate_DATA) \
995 $(toolexeclibgounicode_DATA)
998 CHECK_DEPS += libgo-llgo.la libgobegin-llgo.a
1000 CHECK_DEPS += libgo.la libgobegin.a
1003 # PACKAGE_template defines the rules for each package.
1004 # For example, for the package bufio, it produces:
1006 # @go_include@ bufio.lo.dep
1007 # bufio.lo.dep: $(srcdir)/go/bufio/*.go
1011 # bufio/check: $(CHECK_DEPS)
1013 # .PHONY: bufio/check
1015 # This is invoked with $(1) set to a package, which is a directory name,
1016 # such as "bufio" or "archive/tar".
1017 define PACKAGE_template
1018 @go_include@ $(1).lo.dep
1019 $(1).lo.dep: $(srcdir)/go/$(1)/*.go
1023 $(1)/check: $$(CHECK_DEPS)
1026 $(1).gox: $(1).s-gox; @true
1032 # This line expands PACKAGE_template once for each package name listed
1034 $(foreach package,$(PACKAGES),$(eval $(call PACKAGE_template,$(package))))
1036 # Pass -ffp-contract=off, or 386-specific options, when building the
1037 # math package. MATH_FLAG is defined in configure.ac.
1038 math_lo_GOCFLAGS = $(MATH_FLAG)
1040 # Add the generated file runtime_sysinfo.go to the runtime package.
1041 extra_go_files_runtime = runtime_sysinfo.go sigtab.go
1042 runtime.lo.dep: $(extra_go_files_runtime)
1044 # Add generated files to the syscall package.
1045 extra_go_files_syscall = \
1049 $(syscall_epoll_file)
1050 syscall.lo.dep: $(extra_go_files_syscall)
1052 # Pass -fgo-compiling-runtime when compiling the runtime package.
1053 runtime_lo_GOCFLAGS = -fgo-c-header=runtime.inc.tmp -fgo-compiling-runtime
1054 runtime_check_GOCFLAGS = -fgo-compiling-runtime
1055 runtime_internal_atomic_lo_GOCFLAGS = -fgo-compiling-runtime
1056 runtime_internal_atomic_lo_check_GOCFLAGS = -fgo-compiling-runtime
1057 runtime_internal_sys_lo_GOCFLAGS = -fgo-compiling-runtime
1058 runtime_internal_sys_lo_check_GOCFLAGS = -fgo-compiling-runtime
1060 # If libffi is supported (the normal case) use the ffi build tag for
1061 # the runtime package.
1063 matchargs_runtime = --tag=libffi
1068 # At least for now, we need -static-libgo for this test, because
1069 # otherwise we can't get the line numbers.
1070 # Also use -fno-inline to get better results from the memory profiler.
1071 runtime_pprof_check_GOCFLAGS = -static-libgo -fno-inline
1073 extra_go_files_runtime_internal_sys = version.go
1074 runtime/internal/sys.lo.dep: $(extra_go_files_runtime_internal_sys)
1076 # FIXME: The following C files may as well move to the runtime
1077 # directory and be treated like other C files.
1079 # Use C code to speed up {bytes,strings}.IndexByte and friends.
1080 bytes/index.lo: go/bytes/indexbyte.c runtime.inc
1082 $(LTCOMPILE) -c -o $@ $(srcdir)/go/bytes/indexbyte.c
1083 strings/index.lo: go/strings/indexbyte.c runtime.inc
1085 $(LTCOMPILE) -c -o $@ $(srcdir)/go/strings/indexbyte.c
1087 # Use a C function with a fixed number of arguments to call a C
1089 log/syslog/syslog_c.lo: go/log/syslog/syslog_c.c runtime.inc
1090 @$(MKDIR_P) log/syslog
1091 $(LTCOMPILE) -c -o $@ $(srcdir)/go/log/syslog/syslog_c.c
1093 # The interface to libffi from the reflect package is written in C.
1094 reflect/makefunc_ffi_c.lo: go/reflect/makefunc_ffi_c.c runtime.inc
1096 $(LTCOMPILE) -c -o $@ $(srcdir)/go/reflect/makefunc_ffi_c.c
1098 # The atomic functions are written in C.
1099 runtime/internal/atomic_c.lo: go/runtime/internal/atomic/atomic.c runtime.inc
1100 @$(MKDIR_P) runtime/internal
1101 $(LTCOMPILE) -c -o $@ $(srcdir)/go/runtime/internal/atomic/atomic.c
1102 sync/atomic_c.lo: go/sync/atomic/atomic.c runtime.inc
1104 $(LTCOMPILE) -c -o $@ $(srcdir)/go/sync/atomic/atomic.c
1106 # A few syscall functions are written in C.
1107 syscall/clone_linux.lo: go/syscall/clone_linux.c runtime.inc
1109 $(LTCOMPILE) -c -o $@ $(srcdir)/go/syscall/clone_linux.c
1110 syscall/errno.lo: go/syscall/errno.c runtime.inc
1112 $(LTCOMPILE) -c -o $@ $(srcdir)/go/syscall/errno.c
1113 syscall/signame.lo: go/syscall/signame.c runtime.inc
1115 $(LTCOMPILE) -c -o $@ $(srcdir)/go/syscall/signame.c
1116 syscall/wait.lo: go/syscall/wait.c runtime.inc
1118 $(LTCOMPILE) -c -o $@ $(srcdir)/go/syscall/wait.c
1120 # Solaris 12 changed the type of fields in struct stat.
1121 # Use a build tag, based on a configure check, to cope.
1123 if HAVE_STAT_TIMESPEC
1124 matchargs_os = --tag=solaristag
1134 # Build golang_org/x/net/route only on BSD systems.
1136 $(eval $(call PACKAGE_template,golang_org/x/net/route))
1138 golang_org_x_net_route_lo = \
1139 golang_org/x/net/route.lo
1140 golang_org_x_net_route_check = \
1141 golang_org/x/net/route/check
1147 # Build golang_org/x/net/lif only on Solaris systems.
1149 $(eval $(call PACKAGE_template,golang_org/x/net/lif))
1151 golang_org_x_net_lif_lo = \
1152 golang_org/x/net/lif.lo
1153 golang_org_x_net_lif_check = \
1154 golang_org/x/net/lif/check
1187 compress/bzip2/check \
1188 compress/flate/check \
1189 compress/gzip/check \
1190 compress/lzw/check \
1191 compress/zlib/check \
1192 container/heap/check \
1193 container/list/check \
1194 container/ring/check \
1196 crypto/cipher/check \
1199 crypto/ecdsa/check \
1200 crypto/elliptic/check \
1207 crypto/sha256/check \
1208 crypto/sha512/check \
1209 crypto/subtle/check \
1212 database/sql/check \
1213 database/sql/driver/check \
1218 debug/plan9obj/check \
1219 encoding/ascii85/check \
1220 encoding/asn1/check \
1221 encoding/base32/check \
1222 encoding/base64/check \
1223 encoding/binary/check \
1224 encoding/csv/check \
1225 encoding/gob/check \
1226 encoding/hex/check \
1227 encoding/json/check \
1228 encoding/pem/check \
1229 encoding/xml/check \
1231 exp/terminal/check \
1232 html/template/check \
1238 go/internal/gcimporter/check \
1239 go/internal/gccgoimporter/check \
1245 golang_org/x/crypto/chacha20poly1305/check \
1246 golang_org/x/crypto/chacha20poly1305/internal/chacha20/check \
1247 golang_org/x/crypto/curve25519/check \
1248 golang_org/x/crypto/poly1305/check \
1249 golang_org/x/net/http2/hpack/check \
1250 golang_org/x/net/idna/check \
1251 golang_org/x/net/lex/httplex/check \
1252 $(golang_org_x_net_lif_check) \
1253 $(golang_org_x_net_route_check) \
1254 hash/adler32/check \
1262 index/suffixarray/check \
1263 internal/pprof/profile/check \
1264 internal/singleflight/check \
1265 internal/trace/check \
1271 mime/multipart/check \
1272 mime/quotedprintable/check \
1274 net/http/cgi/check \
1275 net/http/cookiejar/check \
1276 net/http/fcgi/check \
1277 net/http/httptest/check \
1278 net/http/httptrace/check \
1279 net/http/httputil/check \
1280 net/http/internal/check \
1281 net/internal/socktest/check \
1285 net/textproto/check \
1287 net/rpc/jsonrpc/check \
1291 path/filepath/check \
1292 regexp/syntax/check \
1293 runtime/debug/check \
1294 runtime/internal/atomic/check \
1295 runtime/internal/sys/check \
1296 runtime/pprof/check \
1297 runtime/pprof/internal/protopprof/check \
1298 runtime/trace/check \
1300 text/scanner/check \
1301 text/tabwriter/check \
1302 text/template/check \
1303 text/template/parse/check \
1304 testing/quick/check \
1305 unicode/utf16/check \
1309 check-recursive: check-head
1312 @echo "Test Run By $${USER} on `date`" > libgo.head
1313 @echo "Native configuration is $(host_triplet)" >> libgo.head
1315 @echo " === libgo tests ===" >> libgo.head
1318 check-tail: check-recursive check-multi
1319 @if test "$(USE_DEJAGNU)" = "yes"; then \
1322 lib=`${PWD_COMMAND} | sed -e 's,^.*/\([^/][^/]*\)$$,\1,'`; \
1323 for dir in . $(MULTIDIRS); do \
1324 mv ../$${dir}/$${lib}/libgo.sum ../$${dir}/$${lib}/libgo.sum.sep; \
1325 mv ../$${dir}/$${lib}/libgo.log ../$${dir}/$${lib}/libgo.log.sep; \
1327 mv libgo.head libgo.sum; \
1328 cp libgo.sum libgo.log; \
1329 echo "Schedule of variations:" >> libgo.sum; \
1330 for dir in . $(MULTIDIRS); do \
1331 multidir=../$${dir}/$${lib}; \
1332 multivar=`cat $${multidir}/libgo.var`; \
1333 echo " $${multivar}" >> libgo.sum; \
1335 echo >> libgo.sum; \
1336 pass=0; fail=0; untested=0; \
1337 for dir in . $(MULTIDIRS); do \
1338 multidir=../$${dir}/$${lib}; \
1339 multivar=`cat $${multidir}/libgo.var`; \
1340 echo "Running target $${multivar}" >> libgo.sum; \
1341 echo "Running $(srcdir)/libgo.exp ..." >> libgo.sum; \
1342 cat $${multidir}/libgo.sum.sep >> libgo.sum; \
1343 cat $${multidir}/libgo.log.sep >> libgo.log; \
1344 if test -n "${MULTIDIRS}"; then \
1345 echo " === libgo Summary for $${multivar} ===" >> libgo.sum; \
1346 echo >> libgo.sum; \
1348 p=`grep -c PASS $${multidir}/libgo.sum.sep`; \
1349 pass=`expr $$pass + $$p`; \
1350 if test "$$p" -ne "0" && test -n "${MULTIDIRS}"; then \
1351 echo "# of expected passes $$p" >> libgo.sum; \
1353 p=`grep -c FAIL $${multidir}/libgo.sum.sep`; \
1354 fail=`expr $$fail + $$p`; \
1355 if test "$$p" -ne "0" && test -n "${MULTIDIRS}"; then \
1356 echo "# of unexpected failures $$p" >> libgo.sum; \
1358 p=`grep -c UNTESTED $${multidir}/libgo.sum.sep`; \
1359 untested=`expr $$untested + $$p`; \
1360 if test "$$p" -ne "0" && test -n "${MULTIDIRS}"; then \
1361 echo "# of untested testcases $$p" >> libgo.sum; \
1364 echo >> libgo.sum; \
1365 echo " === libgo Summary ===" >> libgo.sum; \
1366 echo >> libgo.sum; \
1367 if test "$$pass" -ne "0"; then \
1368 echo "# of expected passes $$pass" >> libgo.sum; \
1370 if test "$$fail" -ne "0"; then \
1371 echo "# of unexpected failures $$fail" >> libgo.sum; \
1373 if test "$$untested" -ne "0"; then \
1374 echo "# of untested testcases $$untested" >> libgo.sum; \
1376 echo `echo $(GOC) | sed -e 's/ .*//'` `$(GOC) -v 2>&1 | grep " version" | sed -n -e 's/.* \(version.*$$\)/\1/p'` >> libgo.sum; \
1377 echo >> libgo.log; \
1378 echo "runtest completed at `date`" >> libgo.log; \
1379 if test "$$fail" -ne "0"; then \
1387 @rm -f libgo.sum libgo.log libgo.tail
1389 [ -z "$(MULTIFLAGS)" ] || multivar="$${multivar}/$(MULTIFLAGS)"; \
1390 echo "$${multivar}" > libgo.var
1391 @for f in $(TEST_PACKAGES); do \
1392 rm -f $$f-testsum $$f-testlog; \
1394 -@$(MAKE) -k $(TEST_PACKAGES)
1395 @for f in $(TEST_PACKAGES); do \
1396 if test -f $$f-testsum; then \
1397 cat $$f-testsum >> libgo.sum; \
1399 if test -f $$f-testlog; then \
1400 cat $$f-testlog >> libgo.log; \
1405 $(MULTIDO) $(AM_MAKEFLAGS) DO=check-am multi-do # $(MAKE)
1408 -@$(MAKE) -k $(TEST_PACKAGES) GOBENCH=.
1410 MOSTLYCLEANFILES = \
1411 s-runtime_sysinfo s-sigtab s-runtime-inc s-zstdpkglist \
1412 s-libcalls s-libcalls-list s-syscall_arch s-gen-sysinfo s-sysinfo \
1414 libgo.head libgo.sum.sep libgo.log.sep libgo.var \
1415 libcalls-list runtime.inc runtime.inc.tmp2 runtime.inc.tmp3
1418 find . -name '*.lo' -print | xargs $(LIBTOOL) --mode=clean rm -f
1419 find . -name '*.$(OBJEXT)' -print | xargs rm -f
1420 find . -name '*-testsum' -print | xargs rm -f
1421 find . -name '*-testlog' -print | xargs rm -f
1423 CLEANFILES = *.go *.c s-version libgo.sum libgo.log runtime.inc
1426 find . -name '*.la' -print | xargs $(LIBTOOL) --mode=clean rm -f
1427 find . -name '*.a' -print | xargs rm -f
1428 find . -name '*.gox' -print | xargs rm -f
1429 find . -name '*.s-gox' -print | xargs rm -f
1432 find . -name '*.lo.dep' -print | xargs rm -f