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_getncpu_file = runtime/getncpu-linux.c
405 runtime_getncpu_file = runtime/getncpu-bsd.c
408 runtime_getncpu_file = runtime/getncpu-irix.c
411 runtime_getncpu_file = runtime/getncpu-solaris.c
414 runtime_getncpu_file = runtime/getncpu-bsd.c
417 runtime_getncpu_file = runtime/getncpu-bsd.c
420 runtime_getncpu_file = runtime/getncpu-aix.c
422 runtime_getncpu_file = runtime/getncpu-none.c
433 runtime/go-assert.c \
434 runtime/go-caller.c \
435 runtime/go-callers.c \
438 runtime/go-construct-map.c \
440 runtime/go-fieldtrack.c \
441 runtime/go-matherr.c \
442 runtime/go-memclr.c \
443 runtime/go-memcmp.c \
444 runtime/go-memequal.c \
445 runtime/go-memmove.c \
446 runtime/go-nanotime.c \
449 runtime/go-reflect-call.c \
450 runtime/go-runtime-error.c \
451 runtime/go-setenv.c \
452 runtime/go-signal.c \
453 runtime/go-strslice.c \
454 runtime/go-typedesc-equal.c \
455 runtime/go-unsafe-pointer.c \
456 runtime/go-unsetenv.c \
457 runtime/go-unwind.c \
458 runtime/go-varargs.c \
459 runtime/env_posix.c \
463 runtime/runtime_c.c \
467 $(rtems_task_variable_add_file) \
468 $(runtime_getncpu_file)
470 version.go: s-version; @true
473 echo "package sys" > version.go.tmp
474 echo 'const DefaultGoroot = "$(prefix)"' >> version.go.tmp
475 echo 'const TheVersion = "'`cat $(srcdir)/VERSION | sed 1q`' '`$(GOC) --version | sed 1q`'"' >> version.go.tmp
476 echo 'const Goexperiment = ``' >> version.go.tmp
477 echo 'const GOARCH = "'$(GOARCH)'"' >> version.go.tmp
478 echo 'const GOOS = "'$(GOOS)'"' >> version.go.tmp
479 echo 'const GccgoToolDir = "$(libexecsubdir)"' >> version.go.tmp
480 echo >> version.go.tmp
481 echo "type ArchFamilyType int" >> version.go.tmp
482 echo >> version.go.tmp
483 echo "const (" >> version.go.tmp
484 echo " UNKNOWN ArchFamilyType = iota" >> version.go.tmp
485 for a in $(ALLGOARCHFAMILY); do \
486 echo " $${a}" >> version.go.tmp; \
488 echo ")" >> version.go.tmp
489 echo >> version.go.tmp
490 for a in $(ALLGOARCH); do \
491 f=`echo $${a} | sed -e 's/\(.\).*/\1/' -e 'y/abcdefghijklmnopqrstuvwxyz/ABCDEFGHIJKLMNOPQRSTUVWXYZ/'`; \
492 n="$${f}`echo $${a} | sed -e 's/.//'`"; \
493 if test "$${a}" = "$(GOARCH)"; then \
494 echo "const Goarch$${n} = 1" >> version.go.tmp; \
496 echo "const Goarch$${n} = 0" >> version.go.tmp; \
499 echo >> version.go.tmp
500 echo "const (" >> version.go.tmp
501 echo " ArchFamily = $(GOARCH_FAMILY)" >> version.go.tmp
502 echo " BigEndian = $(GOARCH_BIGENDIAN)" >> version.go.tmp
503 echo " CacheLineSize = $(GOARCH_CACHELINESIZE)" >> version.go.tmp
504 echo " PhysPageSize = $(GOARCH_PHYSPAGESIZE)" >> version.go.tmp
505 echo " PCQuantum = $(GOARCH_PCQUANTUM)" >> version.go.tmp
506 echo " Int64Align = $(GOARCH_INT64ALIGN)" >> version.go.tmp
507 echo " HugePageSize = $(GOARCH_HUGEPAGESIZE)" >> version.go.tmp
508 echo " MinFrameSize = $(GOARCH_MINFRAMESIZE)" >> version.go.tmp
509 echo ")" >> version.go.tmp
510 echo >> version.go.tmp
511 for a in $(ALLGOOS); do \
512 f=`echo $${a} | sed -e 's/\(.\).*/\1/' -e 'y/abcdefghijklmnopqrstuvwxyz/ABCDEFGHIJKLMNOPQRSTUVWXYZ/'`; \
513 n="$${f}`echo $${a} | sed -e 's/.//'`"; \
514 if test "$${a}" = "$(GOOS)"; then \
515 echo "const Goos$${n} = 1" >> version.go.tmp; \
517 echo "const Goos$${n} = 0" >> version.go.tmp; \
520 echo >> version.go.tmp
521 echo "type Uintreg uintptr" >> version.go.tmp
522 $(SHELL) $(srcdir)/mvifdiff.sh version.go.tmp version.go
525 runtime_sysinfo.go: s-runtime_sysinfo; @true
526 s-runtime_sysinfo: $(srcdir)/mkrsysinfo.sh gen-sysinfo.go
527 GOARCH=$(GOARCH) GOOS=$(GOOS) $(SHELL) $(srcdir)/mkrsysinfo.sh
528 $(SHELL) $(srcdir)/mvifdiff.sh tmp-runtime_sysinfo.go runtime_sysinfo.go
531 sigtab.go: s-sigtab; @true
532 s-sigtab: $(srcdir)/mksigtab.sh gen-sysinfo.go
533 GOOS=$(GOOS) $(SHELL) $(srcdir)/mksigtab.sh > tmp-sigtab.go
534 $(SHELL) $(srcdir)/mvifdiff.sh tmp-sigtab.go sigtab.go
537 # _Complex_lock and _Reader_lock are Go translations of some AIX system
538 # types and should not be exported back to C
539 # semt is a Go translation of the C type sem_t; it fails to convert on
540 # some systems and need not be exported back to C.
541 # sigset conflicts with system type sigset on AIX, so we need to rename it
542 runtime.inc: s-runtime-inc; @true
543 s-runtime-inc: runtime.lo Makefile
544 rm -f runtime.inc.tmp2 runtime.inc.tmp3
545 grep -v "#define _" runtime.inc.tmp | grep -v "#define [cm][01234] " | grep -v "#define empty " > runtime.inc.tmp2
546 for pattern in '_[GP][a-z]' _Max _Lock _Sig _Trace _MHeap _Num; do \
547 grep "#define $$pattern" runtime.inc.tmp >> runtime.inc.tmp2; \
549 for TYPE in _Complex_lock _Reader_lock semt; do \
550 sed -e '/struct '$${TYPE}' {/,/^}/s/^.*$$//' runtime.inc.tmp2 > runtime.inc.tmp3; \
551 mv runtime.inc.tmp3 runtime.inc.tmp2; \
553 sed -e 's/sigset/sigset_go/' runtime.inc.tmp2 > runtime.inc.tmp3
554 $(SHELL) $(srcdir)/mvifdiff.sh runtime.inc.tmp3 runtime.inc
555 rm -f runtime.inc.tmp2 runtime.inc.tmp3
558 noinst_DATA = zstdpkglist.go
560 # Generate the list of go std packages that were included in libgo
561 zstdpkglist.go: s-zstdpkglist; @true
562 s-zstdpkglist: Makefile
563 rm -f zstdpkglist.go.tmp
564 echo 'package main' > zstdpkglist.go.tmp
565 echo "" >> zstdpkglist.go.tmp
566 echo 'var stdpkg = map[string]bool{' >> zstdpkglist.go.tmp
567 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
568 echo '}' >> zstdpkglist.go.tmp
569 $(SHELL) $(srcdir)/mvifdiff.sh zstdpkglist.go.tmp zstdpkglist.go
573 syscall_epoll_file = epoll.go
578 libcalls.go: s-libcalls; @true
579 s-libcalls: libcalls-list go/syscall/mksyscall.awk $(srcdir)/go/syscall/*.go
580 rm -f libcalls.go.tmp
581 $(AWK) -f $(srcdir)/go/syscall/mksyscall.awk `cat libcalls-list` > libcalls.go.tmp
582 $(SHELL) $(srcdir)/mvifdiff.sh libcalls.go.tmp libcalls.go
585 libcalls-list: s-libcalls-list; @true
586 s-libcalls-list: Makefile $(srcdir)/go/syscall/*.go
587 rm -f libcalls-list.tmp
588 $(SHELL) $(srcdir)/match.sh --goarch=$(GOARCH) --goos=$(GOOS) --srcdir=$(srcdir)/go/syscall $(matchargs_syscall) > libcalls-list.tmp
589 $(SHELL) $(srcdir)/mvifdiff.sh libcalls-list.tmp libcalls-list
592 syscall_arch.go: s-syscall_arch; @true
593 s-syscall_arch: Makefile
594 rm -f syscall_arch.go.tmp
595 echo "package syscall" > syscall_arch.go.tmp
596 echo 'const ARCH = "'$(GOARCH)'"' >> syscall_arch.go.tmp
597 echo 'const OS = "'$(GOOS)'"' >> syscall_arch.go.tmp
598 $(SHELL) $(srcdir)/mvifdiff.sh syscall_arch.go.tmp syscall_arch.go
602 $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \
603 $(CPPFLAGS) $(OSCFLAGS) -O
605 gen-sysinfo.go: s-gen-sysinfo; @true
606 s-gen-sysinfo: $(srcdir)/sysinfo.c config.h
607 $(CC) $(SYSINFO_FLAGS) -fdump-go-spec=tmp-gen-sysinfo.go -std=gnu99 -S -o sysinfo.s $(srcdir)/sysinfo.c
609 $(SHELL) $(srcdir)/mvifdiff.sh tmp-gen-sysinfo.go gen-sysinfo.go
612 errno.i: s-errno; @true
614 echo '#include <errno.h>' | $(CC) $(SYSINFO_FLAGS) -x c - -E -dM > tmp-errno.i
615 $(SHELL) $(srcdir)/mvifdiff.sh tmp-errno.i errno.i
618 sysinfo.go: s-sysinfo; @true
619 s-sysinfo: $(srcdir)/mksysinfo.sh gen-sysinfo.go errno.i
620 GOOS=$(GOOS) $(SHELL) $(srcdir)/mksysinfo.sh
621 $(SHELL) $(srcdir)/mvifdiff.sh tmp-sysinfo.go sysinfo.go
624 # The epoll struct has an embedded union and is packed on x86_64,
625 # which is too complicated for mksysinfo.sh. We find the offset of
626 # the only field we care about in configure.ac, and generate the
628 epoll.go: s-epoll; @true
631 echo 'package syscall' > epoll.go.tmp
632 echo 'type EpollEvent struct {' >> epoll.go.tmp
633 echo ' Events uint32' >> epoll.go.tmp
634 case "$(SIZEOF_STRUCT_EPOLL_EVENT),$(STRUCT_EPOLL_EVENT_FD_OFFSET)" in \
635 0,0) echo 1>&2 "*** struct epoll_event data.fd offset unknown"; \
637 8,4) echo ' Fd int32' >> epoll.go.tmp; ;; \
638 12,4) echo ' Fd int32' >> epoll.go.tmp; \
639 echo ' Pad [4]byte' >> epoll.go.tmp; ;; \
640 12,8) echo ' Pad [4]byte' >> epoll.go.tmp; \
641 echo ' Fd int32' >> epoll.go.tmp; ;; \
642 16,8) echo ' Pad [4]byte' >> epoll.go.tmp; \
643 echo ' Fd int32' >> epoll.go.tmp; \
644 echo ' Pad2 [4]byte' >> epoll.go.tmp; ;; \
645 *) echo 1>&2 "*** struct epoll_event unsupported"; \
648 echo '}' >> epoll.go.tmp
649 $(SHELL) $(srcdir)/mvifdiff.sh epoll.go.tmp epoll.go
653 syscall_lib_clone_lo = syscall/clone_linux.lo
655 syscall_lib_clone_lo =
663 cmd/internal/browser \
681 crypto/internal/cipherhw \
694 database/sql/driver \
725 go/internal/gccgoimporter \
726 go/internal/gcimporter \
732 golang_org/x/crypto/chacha20poly1305 \
733 golang_org/x/crypto/chacha20poly1305/internal/chacha20 \
734 golang_org/x/crypto/curve25519 \
735 golang_org/x/crypto/poly1305 \
736 golang_org/x/net/http2/hpack \
737 golang_org/x/net/idna \
738 golang_org/x/net/lex/httplex \
739 golang_org/x/text/transform \
740 golang_org/x/text/unicode/norm \
741 golang_org/x/text/width \
751 image/color/palette \
754 image/internal/imageutil \
759 internal/pprof/profile \
761 internal/singleflight \
762 internal/syscall/unix \
775 mime/quotedprintable \
786 net/internal/socktest \
804 runtime/internal/atomic \
805 runtime/internal/sys \
807 runtime/pprof/internal/protopprof \
816 testing/internal/testdeps \
822 text/template/parse \
829 $(addsuffix .lo,$(PACKAGES)) \
831 reflect/makefunc_ffi_c.lo \
833 $(syscall_lib_clone_lo) \
837 $(golang_org_x_net_lif_lo) \
838 $(golang_org_x_net_route_lo) \
839 log/syslog/syslog_c.lo \
840 $(os_lib_inotify_lo) \
841 runtime/internal/atomic_c.lo \
845 -version-info $(libtool_VERSION) $(PTHREAD_CFLAGS) $(AM_LDFLAGS)
848 $(libgo_go_objs) ../libbacktrace/libbacktrace.la \
849 $(LIBATOMIC) $(LIBFFI) $(PTHREAD_LIBS) $(MATH_LIBS) $(NET_LIBS)
851 libgo_la_SOURCES = $(runtime_files)
852 libgo_la_LDFLAGS = $(libgo_ldflags)
853 libgo_la_LIBADD = $(libgo_libadd)
855 libgo_llgo_la_SOURCES = $(runtime_files)
856 libgo_llgo_la_LDFLAGS = $(libgo_ldflags)
857 libgo_llgo_la_LIBADD = $(libgo_libadd)
859 libgobegin_a_SOURCES = \
862 libgobegin_llgo_a_SOURCES = \
865 # Use -fPIC for libgobegin so that it can be put in a PIE.
866 libgobegin_a_CFLAGS = $(AM_CFLAGS) -fPIC
867 libgobegin_llgo_a_CFLAGS = $(AM_CFLAGS) -fPIC
869 libgolibbegin_a_SOURCES = \
872 libgolibbegin_a_CFLAGS = $(AM_CFLAGS) -fPIC
874 # Make sure runtime.inc is built before compiling any .c file.
875 $(libgo_la_OBJECTS): runtime.inc
876 $(libgo_llgo_la_OBJECTS): runtime.inc
877 $(libgobegin_a_OBJECTS): runtime.inc
878 $(libgobegin_llgo_a_OBJECTS): runtime.inc
879 $(libgolibbegin_a_OBJECTS): runtime.inc
881 LTLDFLAGS = $(shell $(SHELL) $(top_srcdir)/../libtool-ldflags $(LDFLAGS))
884 AM_GOCFLAGS = $(STRINGOPS_FLAG) $(GO_SPLIT_STACK)
885 GOCOMPILE = $(GOC) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_GOCFLAGS) $(GOCFLAGS)
887 LTGOCOMPILE = $(LIBTOOL) --tag GO --mode=compile $(GOC) $(INCLUDES) \
888 $(AM_GOCFLAGS) $(GOCFLAGS)
890 GOLINK = $(LIBTOOL) --tag GO --mode-link $(GOC) \
891 $(OPT_LDFLAGS) $(SECTION_LDFLAGS) $(AM_GOCFLAGS) $(LTLDFLAGS) -o $@
893 # Build the dependencies for a Go package.
896 dir=`echo $@ | sed -e 's/.lo.dep$$//'`; \
897 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,,$@)))`; \
898 $(SHELL) $(srcdir)/godeps.sh `echo $@ | sed -e 's/.dep$$//'` $$files > $@.tmp; \
899 if ! cmp $@.tmp $@ >/dev/null 2>/dev/null; then \
900 rm -f `echo $@ | sed -e 's/\.dep$$//'`; \
904 # Build the .go files for a package, generating a .lo file.
907 files=`echo $^ | sed -e 's/[^ ]*\.gox//g' -e 's/[^ ]*\.dep//'`; \
908 $(LTGOCOMPILE) -I . -c -fgo-pkgpath=`echo $@ | sed -e 's/.lo$$//' -e 's|golang_org|vendor/golang_org|'` $($(subst -,_,$(subst .,_,$(subst /,_,$@)))_GOCFLAGS) -o $@ $$files
910 # How to build a .gox file from a .lo file.
911 # Matching .o file can either be in the same directory as the .lo (non-PIC
912 # object) or in the .libs directory (PIC object).
914 f="$(basename $<).o"; \
915 if test ! -f $$f; then \
916 f="$(basename $(<D)/.libs/$(<F)).o"; \
918 $(OBJCOPY) -j .go_export $$f $@.tmp; \
919 $(SHELL) $(srcdir)/mvifdiff.sh $@.tmp `echo $@ | sed -e 's/s-gox/gox/'`
926 GC="$(GOC) $(GOCFLAGS) $($(subst /,_,$@)_GOCFLAGS) -L `${PWD_COMMAND}` -L `${PWD_COMMAND}`/.libs"; \
928 GOLIBS="$(MATH_LIBS) $(NET_LIBS) $(LIBS)"; \
930 RUNTESTFLAGS="$(RUNTESTFLAGS)"; \
931 export RUNTESTFLAGS; \
936 libgccdir=`${GOC} -print-libgcc-file-name | sed -e 's|/[^/]*$$||'`; \
937 LD_LIBRARY_PATH="`${PWD_COMMAND}`/.libs:$${libgccdir}:${LD_LIBRARY_PATH}"; \
938 LD_LIBRARY_PATH=`echo $${LD_LIBRARY_PATH} | sed 's,::*,:,g;s,^:*,,;s,:*$$,,'`; \
939 export LD_LIBRARY_PATH; \
941 rm -f $@-testsum $@-testlog; \
942 files=`$(SHELL) $(srcdir)/match.sh --goarch=$(GOARCH) --goos=$(GOOS) --srcdir=$(srcdir)/go/$(@D) --extrafiles="$(extra_go_files_$(subst /,_,$(@D)))" $(matchargs_$(subst /,_,$(@D)))`; \
943 if test "$(USE_DEJAGNU)" = "yes"; then \
944 $(SHELL) $(srcdir)/testsuite/gotest --goarch=$(GOARCH) --goos=$(GOOS) --dejagnu=yes --basedir=$(srcdir) --srcdir=$(srcdir)/go/$(@D) --pkgpath="$(@D)" --pkgfiles="$$files" --testname="$(@D)" $(GOTESTFLAGS); \
945 elif test "$(GOBENCH)" != ""; then \
946 $(SHELL) $(srcdir)/testsuite/gotest --goarch=$(GOARCH) --goos=$(GOOS) --basedir=$(srcdir) --srcdir=$(srcdir)/go/$(@D) --pkgpath="$(@D)" --pkgfiles="$$files" --bench="$(GOBENCH)" $(GOTESTFLAGS); \
948 if $(SHELL) $(srcdir)/testsuite/gotest --goarch=$(GOARCH) --goos=$(GOOS) --basedir=$(srcdir) --srcdir=$(srcdir)/go/$(@D) --pkgpath="$(@D)" --pkgfiles="$$files" $(GOTESTFLAGS) >>$@-testlog 2>&1; then \
949 echo "PASS: $(@D)" >> $@-testlog; \
950 echo "PASS: $(@D)"; \
951 echo "PASS: $(@D)" > $@-testsum; \
953 echo "FAIL: $(@D)" >> $@-testlog; \
955 echo "FAIL: $(@D)" > $@-testsum; \
960 # Build all packages before checking any.
962 $(toolexeclibgo_DATA) \
963 $(toolexeclibgoarchive_DATA) \
964 $(toolexeclibgocompress_DATA) \
965 $(toolexeclibgocontainer_DATA) \
966 $(toolexeclibgocrypto_DATA) \
967 $(toolexeclibgodebug_DATA) \
968 $(toolexeclibgoencoding_DATA) \
969 $(toolexeclibgoexp_DATA) \
970 $(toolexeclibgogo_DATA) \
971 $(toolexeclibgohash_DATA) \
972 $(toolexeclibgoimage_DATA) \
973 $(toolexeclibgoindex_DATA) \
974 $(toolexeclibgoio_DATA) \
975 $(toolexeclibgolog_DATA) \
976 $(toolexeclibgomath_DATA) \
977 $(toolexeclibgomime_DATA) \
978 $(toolexeclibgonet_DATA) \
979 $(toolexeclibgonethttp_DATA) \
980 $(toolexeclibgoos_DATA) \
981 $(toolexeclibgopath_DATA) \
982 $(toolexeclibgorpc_DATA) \
983 $(toolexeclibgoruntime_DATA) \
984 $(toolexeclibgosync_DATA) \
985 $(toolexeclibgotesting_DATA) \
986 $(toolexeclibgotext_DATA) \
987 $(toolexeclibgotexttemplate_DATA) \
988 $(toolexeclibgounicode_DATA)
991 CHECK_DEPS += libgo-llgo.la libgobegin-llgo.a
993 CHECK_DEPS += libgo.la libgobegin.a
996 # PACKAGE_template defines the rules for each package.
997 # For example, for the package bufio, it produces:
999 # @go_include@ bufio.lo.dep
1000 # bufio.lo.dep: $(srcdir)/go/bufio/*.go
1004 # bufio/check: $(CHECK_DEPS)
1006 # .PHONY: bufio/check
1008 # This is invoked with $(1) set to a package, which is a directory name,
1009 # such as "bufio" or "archive/tar".
1010 define PACKAGE_template
1011 @go_include@ $(1).lo.dep
1012 $(1).lo.dep: $(srcdir)/go/$(1)/*.go
1016 $(1)/check: $$(CHECK_DEPS)
1019 $(1).gox: $(1).s-gox; @true
1025 # This line expands PACKAGE_template once for each package name listed
1027 $(foreach package,$(PACKAGES),$(eval $(call PACKAGE_template,$(package))))
1029 # Pass -ffp-contract=off, or 386-specific options, when building the
1030 # math package. MATH_FLAG is defined in configure.ac.
1031 math_lo_GOCFLAGS = $(MATH_FLAG)
1033 # Add the generated file runtime_sysinfo.go to the runtime package.
1034 extra_go_files_runtime = runtime_sysinfo.go sigtab.go
1035 runtime.lo.dep: $(extra_go_files_runtime)
1037 # Add generated files to the syscall package.
1038 extra_go_files_syscall = \
1042 $(syscall_epoll_file)
1043 syscall.lo.dep: $(extra_go_files_syscall)
1045 # Pass -fgo-compiling-runtime when compiling the runtime package.
1046 runtime_lo_GOCFLAGS = -fgo-c-header=runtime.inc.tmp -fgo-compiling-runtime
1047 runtime_check_GOCFLAGS = -fgo-compiling-runtime
1048 runtime_internal_atomic_lo_GOCFLAGS = -fgo-compiling-runtime
1049 runtime_internal_atomic_lo_check_GOCFLAGS = -fgo-compiling-runtime
1050 runtime_internal_sys_lo_GOCFLAGS = -fgo-compiling-runtime
1051 runtime_internal_sys_lo_check_GOCFLAGS = -fgo-compiling-runtime
1053 # If libffi is supported (the normal case) use the ffi build tag for
1054 # the runtime package.
1056 matchargs_runtime = --tag=libffi
1061 # At least for now, we need -static-libgo for this test, because
1062 # otherwise we can't get the line numbers.
1063 # Also use -fno-inline to get better results from the memory profiler.
1064 runtime_pprof_check_GOCFLAGS = -static-libgo -fno-inline
1066 extra_go_files_runtime_internal_sys = version.go
1067 runtime/internal/sys.lo.dep: $(extra_go_files_runtime_internal_sys)
1069 # FIXME: The following C files may as well move to the runtime
1070 # directory and be treated like other C files.
1072 # Use C code to speed up {bytes,strings}.IndexByte and friends.
1073 bytes/index.lo: go/bytes/indexbyte.c runtime.inc
1075 $(LTCOMPILE) -c -o $@ $(srcdir)/go/bytes/indexbyte.c
1076 strings/index.lo: go/strings/indexbyte.c runtime.inc
1078 $(LTCOMPILE) -c -o $@ $(srcdir)/go/strings/indexbyte.c
1080 # Use a C function with a fixed number of arguments to call a C
1082 log/syslog/syslog_c.lo: go/log/syslog/syslog_c.c runtime.inc
1083 @$(MKDIR_P) log/syslog
1084 $(LTCOMPILE) -c -o $@ $(srcdir)/go/log/syslog/syslog_c.c
1086 # The interface to libffi from the reflect package is written in C.
1087 reflect/makefunc_ffi_c.lo: go/reflect/makefunc_ffi_c.c runtime.inc
1089 $(LTCOMPILE) -c -o $@ $(srcdir)/go/reflect/makefunc_ffi_c.c
1091 # The atomic functions are written in C.
1092 runtime/internal/atomic_c.lo: go/runtime/internal/atomic/atomic.c runtime.inc
1093 @$(MKDIR_P) runtime/internal
1094 $(LTCOMPILE) -c -o $@ $(srcdir)/go/runtime/internal/atomic/atomic.c
1095 sync/atomic_c.lo: go/sync/atomic/atomic.c runtime.inc
1097 $(LTCOMPILE) -c -o $@ $(srcdir)/go/sync/atomic/atomic.c
1099 # A few syscall functions are written in C.
1100 syscall/clone_linux.lo: go/syscall/clone_linux.c runtime.inc
1102 $(LTCOMPILE) -c -o $@ $(srcdir)/go/syscall/clone_linux.c
1103 syscall/errno.lo: go/syscall/errno.c runtime.inc
1105 $(LTCOMPILE) -c -o $@ $(srcdir)/go/syscall/errno.c
1106 syscall/signame.lo: go/syscall/signame.c runtime.inc
1108 $(LTCOMPILE) -c -o $@ $(srcdir)/go/syscall/signame.c
1109 syscall/wait.lo: go/syscall/wait.c runtime.inc
1111 $(LTCOMPILE) -c -o $@ $(srcdir)/go/syscall/wait.c
1113 # Solaris 12 changed the type of fields in struct stat.
1114 # Use a build tag, based on a configure check, to cope.
1116 if HAVE_STAT_TIMESPEC
1117 matchargs_os = --tag=solaristag
1127 # Build golang_org/x/net/route only on BSD systems.
1129 $(eval $(call PACKAGE_template,golang_org/x/net/route))
1131 golang_org_x_net_route_lo = \
1132 golang_org/x/net/route.lo
1133 golang_org_x_net_route_check = \
1134 golang_org/x/net/route/check
1140 # Build golang_org/x/net/lif only on Solaris systems.
1142 $(eval $(call PACKAGE_template,golang_org/x/net/lif))
1144 golang_org_x_net_lif_lo = \
1145 golang_org/x/net/lif.lo
1146 golang_org_x_net_lif_check = \
1147 golang_org/x/net/lif/check
1180 compress/bzip2/check \
1181 compress/flate/check \
1182 compress/gzip/check \
1183 compress/lzw/check \
1184 compress/zlib/check \
1185 container/heap/check \
1186 container/list/check \
1187 container/ring/check \
1189 crypto/cipher/check \
1192 crypto/ecdsa/check \
1193 crypto/elliptic/check \
1200 crypto/sha256/check \
1201 crypto/sha512/check \
1202 crypto/subtle/check \
1205 database/sql/check \
1206 database/sql/driver/check \
1211 debug/plan9obj/check \
1212 encoding/ascii85/check \
1213 encoding/asn1/check \
1214 encoding/base32/check \
1215 encoding/base64/check \
1216 encoding/binary/check \
1217 encoding/csv/check \
1218 encoding/gob/check \
1219 encoding/hex/check \
1220 encoding/json/check \
1221 encoding/pem/check \
1222 encoding/xml/check \
1224 exp/terminal/check \
1225 html/template/check \
1231 go/internal/gcimporter/check \
1232 go/internal/gccgoimporter/check \
1238 golang_org/x/crypto/chacha20poly1305/check \
1239 golang_org/x/crypto/chacha20poly1305/internal/chacha20/check \
1240 golang_org/x/crypto/curve25519/check \
1241 golang_org/x/crypto/poly1305/check \
1242 golang_org/x/net/http2/hpack/check \
1243 golang_org/x/net/idna/check \
1244 golang_org/x/net/lex/httplex/check \
1245 $(golang_org_x_net_lif_check) \
1246 $(golang_org_x_net_route_check) \
1247 hash/adler32/check \
1255 index/suffixarray/check \
1256 internal/pprof/profile/check \
1257 internal/singleflight/check \
1258 internal/trace/check \
1264 mime/multipart/check \
1265 mime/quotedprintable/check \
1267 net/http/cgi/check \
1268 net/http/cookiejar/check \
1269 net/http/fcgi/check \
1270 net/http/httptest/check \
1271 net/http/httptrace/check \
1272 net/http/httputil/check \
1273 net/http/internal/check \
1274 net/internal/socktest/check \
1278 net/textproto/check \
1280 net/rpc/jsonrpc/check \
1284 path/filepath/check \
1285 regexp/syntax/check \
1286 runtime/debug/check \
1287 runtime/internal/atomic/check \
1288 runtime/internal/sys/check \
1289 runtime/pprof/check \
1290 runtime/pprof/internal/protopprof/check \
1291 runtime/trace/check \
1293 text/scanner/check \
1294 text/tabwriter/check \
1295 text/template/check \
1296 text/template/parse/check \
1297 testing/quick/check \
1298 unicode/utf16/check \
1302 check-recursive: check-head
1305 @echo "Test Run By $${USER} on `date`" > libgo.head
1306 @echo "Native configuration is $(host_triplet)" >> libgo.head
1308 @echo " === libgo tests ===" >> libgo.head
1311 check-tail: check-recursive check-multi
1312 @if test "$(USE_DEJAGNU)" = "yes"; then \
1315 lib=`${PWD_COMMAND} | sed -e 's,^.*/\([^/][^/]*\)$$,\1,'`; \
1316 for dir in . $(MULTIDIRS); do \
1317 mv ../$${dir}/$${lib}/libgo.sum ../$${dir}/$${lib}/libgo.sum.sep; \
1318 mv ../$${dir}/$${lib}/libgo.log ../$${dir}/$${lib}/libgo.log.sep; \
1320 mv libgo.head libgo.sum; \
1321 cp libgo.sum libgo.log; \
1322 echo "Schedule of variations:" >> libgo.sum; \
1323 for dir in . $(MULTIDIRS); do \
1324 multidir=../$${dir}/$${lib}; \
1325 multivar=`cat $${multidir}/libgo.var`; \
1326 echo " $${multivar}" >> libgo.sum; \
1328 echo >> libgo.sum; \
1329 pass=0; fail=0; untested=0; \
1330 for dir in . $(MULTIDIRS); do \
1331 multidir=../$${dir}/$${lib}; \
1332 multivar=`cat $${multidir}/libgo.var`; \
1333 echo "Running target $${multivar}" >> libgo.sum; \
1334 echo "Running $(srcdir)/libgo.exp ..." >> libgo.sum; \
1335 cat $${multidir}/libgo.sum.sep >> libgo.sum; \
1336 cat $${multidir}/libgo.log.sep >> libgo.log; \
1337 if test -n "${MULTIDIRS}"; then \
1338 echo " === libgo Summary for $${multivar} ===" >> libgo.sum; \
1339 echo >> libgo.sum; \
1341 p=`grep -c PASS $${multidir}/libgo.sum.sep`; \
1342 pass=`expr $$pass + $$p`; \
1343 if test "$$p" -ne "0" && test -n "${MULTIDIRS}"; then \
1344 echo "# of expected passes $$p" >> libgo.sum; \
1346 p=`grep -c FAIL $${multidir}/libgo.sum.sep`; \
1347 fail=`expr $$fail + $$p`; \
1348 if test "$$p" -ne "0" && test -n "${MULTIDIRS}"; then \
1349 echo "# of unexpected failures $$p" >> libgo.sum; \
1351 p=`grep -c UNTESTED $${multidir}/libgo.sum.sep`; \
1352 untested=`expr $$untested + $$p`; \
1353 if test "$$p" -ne "0" && test -n "${MULTIDIRS}"; then \
1354 echo "# of untested testcases $$p" >> libgo.sum; \
1357 echo >> libgo.sum; \
1358 echo " === libgo Summary ===" >> libgo.sum; \
1359 echo >> libgo.sum; \
1360 if test "$$pass" -ne "0"; then \
1361 echo "# of expected passes $$pass" >> libgo.sum; \
1363 if test "$$fail" -ne "0"; then \
1364 echo "# of unexpected failures $$fail" >> libgo.sum; \
1366 if test "$$untested" -ne "0"; then \
1367 echo "# of untested testcases $$untested" >> libgo.sum; \
1369 echo `echo $(GOC) | sed -e 's/ .*//'` `$(GOC) -v 2>&1 | grep " version" | sed -n -e 's/.* \(version.*$$\)/\1/p'` >> libgo.sum; \
1370 echo >> libgo.log; \
1371 echo "runtest completed at `date`" >> libgo.log; \
1372 if test "$$fail" -ne "0"; then \
1380 @rm -f libgo.sum libgo.log libgo.tail
1382 [ -z "$(MULTIFLAGS)" ] || multivar="$${multivar}/$(MULTIFLAGS)"; \
1383 echo "$${multivar}" > libgo.var
1384 @for f in $(TEST_PACKAGES); do \
1385 rm -f $$f-testsum $$f-testlog; \
1387 -@$(MAKE) -k $(TEST_PACKAGES)
1388 @for f in $(TEST_PACKAGES); do \
1389 if test -f $$f-testsum; then \
1390 cat $$f-testsum >> libgo.sum; \
1392 if test -f $$f-testlog; then \
1393 cat $$f-testlog >> libgo.log; \
1398 $(MULTIDO) $(AM_MAKEFLAGS) DO=check-am multi-do # $(MAKE)
1401 -@$(MAKE) -k $(TEST_PACKAGES) GOBENCH=.
1403 MOSTLYCLEANFILES = \
1404 s-runtime_sysinfo s-sigtab s-runtime-inc s-zstdpkglist \
1405 s-libcalls s-libcalls-list s-syscall_arch s-gen-sysinfo s-sysinfo \
1407 libgo.head libgo.sum.sep libgo.log.sep libgo.var \
1408 libcalls-list runtime.inc runtime.inc.tmp2 runtime.inc.tmp3
1411 find . -name '*.lo' -print | xargs $(LIBTOOL) --mode=clean rm -f
1412 find . -name '*.$(OBJEXT)' -print | xargs rm -f
1413 find . -name '*-testsum' -print | xargs rm -f
1414 find . -name '*-testlog' -print | xargs rm -f
1416 CLEANFILES = *.go *.c s-version libgo.sum libgo.log runtime.inc
1419 find . -name '*.la' -print | xargs $(LIBTOOL) --mode=clean rm -f
1420 find . -name '*.a' -print | xargs rm -f
1421 find . -name '*.gox' -print | xargs rm -f
1422 find . -name '*.s-gox' -print | xargs rm -f
1425 find . -name '*.lo.dep' -print | xargs rm -f