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 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 # sigset conflicts with system type sigset on AIX, so we need to rename it
547 runtime.inc: s-runtime-inc; @true
548 s-runtime-inc: runtime.lo Makefile
549 rm -f runtime.inc.tmp2 runtime.inc.tmp3
550 grep -v "#define _" runtime.inc.tmp | grep -v "#define [cm][01234] " | grep -v "#define empty " > runtime.inc.tmp2
551 for pattern in '_[GP][a-z]' _Max _Lock _Sig _Trace _MHeap _Num; do \
552 grep "#define $$pattern" runtime.inc.tmp >> runtime.inc.tmp2; \
554 for TYPE in _Complex_lock _Reader_lock; do \
555 sed -e '/struct '$${TYPE}' {/,/^}/s/^.*$$//' runtime.inc.tmp2 > runtime.inc.tmp3; \
556 mv runtime.inc.tmp3 runtime.inc.tmp2; \
558 sed -e 's/sigset/sigset_go/' runtime.inc.tmp2 > runtime.inc.tmp3
559 $(SHELL) $(srcdir)/mvifdiff.sh runtime.inc.tmp3 runtime.inc
560 rm -f runtime.inc.tmp2 runtime.inc.tmp3
563 noinst_DATA = zstdpkglist.go
565 # Generate the list of go std packages that were included in libgo
566 zstdpkglist.go: s-zstdpkglist; @true
567 s-zstdpkglist: Makefile
568 rm -f zstdpkglist.go.tmp
569 echo 'package main' > zstdpkglist.go.tmp
570 echo "" >> zstdpkglist.go.tmp
571 echo 'var stdpkg = map[string]bool{' >> zstdpkglist.go.tmp
572 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
573 echo '}' >> zstdpkglist.go.tmp
574 $(SHELL) $(srcdir)/mvifdiff.sh zstdpkglist.go.tmp zstdpkglist.go
578 syscall_epoll_file = epoll.go
583 libcalls.go: s-libcalls; @true
584 s-libcalls: libcalls-list go/syscall/mksyscall.awk $(srcdir)/go/syscall/*.go
585 rm -f libcalls.go.tmp
586 $(AWK) -f $(srcdir)/go/syscall/mksyscall.awk `cat libcalls-list` > libcalls.go.tmp
587 $(SHELL) $(srcdir)/mvifdiff.sh libcalls.go.tmp libcalls.go
590 libcalls-list: s-libcalls-list; @true
591 s-libcalls-list: Makefile $(srcdir)/go/syscall/*.go
592 rm -f libcalls-list.tmp
593 $(SHELL) $(srcdir)/match.sh --goarch=$(GOARCH) --goos=$(GOOS) --srcdir=$(srcdir)/go/syscall $(matchargs_syscall) > libcalls-list.tmp
594 $(SHELL) $(srcdir)/mvifdiff.sh libcalls-list.tmp libcalls-list
597 syscall_arch.go: s-syscall_arch; @true
598 s-syscall_arch: Makefile
599 rm -f syscall_arch.go.tmp
600 echo "package syscall" > syscall_arch.go.tmp
601 echo 'const ARCH = "'$(GOARCH)'"' >> syscall_arch.go.tmp
602 echo 'const OS = "'$(GOOS)'"' >> syscall_arch.go.tmp
603 $(SHELL) $(srcdir)/mvifdiff.sh syscall_arch.go.tmp syscall_arch.go
607 $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \
608 $(CPPFLAGS) $(OSCFLAGS) -O
610 gen-sysinfo.go: s-gen-sysinfo; @true
611 s-gen-sysinfo: $(srcdir)/sysinfo.c config.h
612 $(CC) $(SYSINFO_FLAGS) -fdump-go-spec=tmp-gen-sysinfo.go -std=gnu99 -S -o sysinfo.s $(srcdir)/sysinfo.c
614 $(SHELL) $(srcdir)/mvifdiff.sh tmp-gen-sysinfo.go gen-sysinfo.go
617 errno.i: s-errno; @true
619 echo '#include <errno.h>' | $(CC) $(SYSINFO_FLAGS) -x c - -E -dM > tmp-errno.i
620 $(SHELL) $(srcdir)/mvifdiff.sh tmp-errno.i errno.i
623 sysinfo.go: s-sysinfo; @true
624 s-sysinfo: $(srcdir)/mksysinfo.sh gen-sysinfo.go errno.i
625 GOOS=$(GOOS) $(SHELL) $(srcdir)/mksysinfo.sh
626 $(SHELL) $(srcdir)/mvifdiff.sh tmp-sysinfo.go sysinfo.go
629 # The epoll struct has an embedded union and is packed on x86_64,
630 # which is too complicated for mksysinfo.sh. We find the offset of
631 # the only field we care about in configure.ac, and generate the
633 epoll.go: s-epoll; @true
636 echo 'package syscall' > epoll.go.tmp
637 echo 'type EpollEvent struct {' >> epoll.go.tmp
638 echo ' Events uint32' >> epoll.go.tmp
639 case "$(SIZEOF_STRUCT_EPOLL_EVENT),$(STRUCT_EPOLL_EVENT_FD_OFFSET)" in \
640 0,0) echo 1>&2 "*** struct epoll_event data.fd offset unknown"; \
642 8,4) echo ' Fd int32' >> epoll.go.tmp; ;; \
643 12,4) echo ' Fd int32' >> epoll.go.tmp; \
644 echo ' Pad [4]byte' >> epoll.go.tmp; ;; \
645 12,8) echo ' Pad [4]byte' >> epoll.go.tmp; \
646 echo ' Fd int32' >> epoll.go.tmp; ;; \
647 16,8) echo ' Pad [4]byte' >> epoll.go.tmp; \
648 echo ' Fd int32' >> epoll.go.tmp; \
649 echo ' Pad2 [4]byte' >> epoll.go.tmp; ;; \
650 *) echo 1>&2 "*** struct epoll_event unsupported"; \
653 echo '}' >> epoll.go.tmp
654 $(SHELL) $(srcdir)/mvifdiff.sh epoll.go.tmp epoll.go
658 syscall_lib_clone_lo = syscall/clone_linux.lo
660 syscall_lib_clone_lo =
668 cmd/internal/browser \
686 crypto/internal/cipherhw \
699 database/sql/driver \
730 go/internal/gccgoimporter \
731 go/internal/gcimporter \
737 golang_org/x/crypto/chacha20poly1305 \
738 golang_org/x/crypto/chacha20poly1305/internal/chacha20 \
739 golang_org/x/crypto/curve25519 \
740 golang_org/x/crypto/poly1305 \
741 golang_org/x/net/http2/hpack \
742 golang_org/x/net/idna \
743 golang_org/x/net/lex/httplex \
744 golang_org/x/text/transform \
745 golang_org/x/text/unicode/norm \
746 golang_org/x/text/width \
756 image/color/palette \
759 image/internal/imageutil \
764 internal/pprof/profile \
766 internal/singleflight \
767 internal/syscall/unix \
780 mime/quotedprintable \
791 net/internal/socktest \
809 runtime/internal/atomic \
810 runtime/internal/sys \
812 runtime/pprof/internal/protopprof \
821 testing/internal/testdeps \
827 text/template/parse \
834 $(addsuffix .lo,$(PACKAGES)) \
836 reflect/makefunc_ffi_c.lo \
838 $(syscall_lib_clone_lo) \
842 $(golang_org_x_net_lif_lo) \
843 $(golang_org_x_net_route_lo) \
844 log/syslog/syslog_c.lo \
845 $(os_lib_inotify_lo) \
846 runtime/internal/atomic_c.lo \
850 -version-info $(libtool_VERSION) $(PTHREAD_CFLAGS) $(AM_LDFLAGS)
853 $(libgo_go_objs) ../libbacktrace/libbacktrace.la \
854 $(LIBATOMIC) $(LIBFFI) $(PTHREAD_LIBS) $(MATH_LIBS) $(NET_LIBS)
856 libgo_la_SOURCES = $(runtime_files)
857 libgo_la_LDFLAGS = $(libgo_ldflags)
858 libgo_la_LIBADD = $(libgo_libadd)
860 libgo_llgo_la_SOURCES = $(runtime_files)
861 libgo_llgo_la_LDFLAGS = $(libgo_ldflags)
862 libgo_llgo_la_LIBADD = $(libgo_libadd)
864 libgobegin_a_SOURCES = \
867 libgobegin_llgo_a_SOURCES = \
870 # Use -fPIC for libgobegin so that it can be put in a PIE.
871 libgobegin_a_CFLAGS = $(AM_CFLAGS) -fPIC
872 libgobegin_llgo_a_CFLAGS = $(AM_CFLAGS) -fPIC
874 libgolibbegin_a_SOURCES = \
877 libgolibbegin_a_CFLAGS = $(AM_CFLAGS) -fPIC
879 # Make sure runtime.inc is built before compiling any .c file.
880 $(libgo_la_OBJECTS): runtime.inc
881 $(libgo_llgo_la_OBJECTS): runtime.inc
882 $(libgobegin_a_OBJECTS): runtime.inc
883 $(libgobegin_llgo_a_OBJECTS): runtime.inc
884 $(libgolibbegin_a_OBJECTS): runtime.inc
886 LTLDFLAGS = $(shell $(SHELL) $(top_srcdir)/../libtool-ldflags $(LDFLAGS))
889 AM_GOCFLAGS = $(STRINGOPS_FLAG) $(GO_SPLIT_STACK)
890 GOCOMPILE = $(GOC) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_GOCFLAGS) $(GOCFLAGS)
892 LTGOCOMPILE = $(LIBTOOL) --tag GO --mode=compile $(GOC) $(INCLUDES) \
893 $(AM_GOCFLAGS) $(GOCFLAGS)
895 GOLINK = $(LIBTOOL) --tag GO --mode-link $(GOC) \
896 $(OPT_LDFLAGS) $(SECTION_LDFLAGS) $(AM_GOCFLAGS) $(LTLDFLAGS) -o $@
898 # Build the dependencies for a Go package.
901 dir=`echo $@ | sed -e 's/.lo.dep$$//'`; \
902 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,,$@)))`; \
903 $(SHELL) $(srcdir)/godeps.sh `echo $@ | sed -e 's/.dep$$//'` $$files > $@.tmp; \
904 if ! cmp $@.tmp $@ >/dev/null 2>/dev/null; then \
905 rm -f `echo $@ | sed -e 's/\.dep$$//'`; \
909 # Build the .go files for a package, generating a .lo file.
912 files=`echo $^ | sed -e 's/[^ ]*\.gox//g' -e 's/[^ ]*\.dep//'`; \
913 $(LTGOCOMPILE) -I . -c -fgo-pkgpath=`echo $@ | sed -e 's/.lo$$//'` $($(subst -,_,$(subst .,_,$(subst /,_,$@)))_GOCFLAGS) -o $@ $$files
915 # How to build a .gox file from a .lo file.
916 # Matching .o file can either be in the same directory as the .lo (non-PIC
917 # object) or in the .libs directory (PIC object).
919 f="$(basename $<).o"; \
920 if test ! -f $$f; then \
921 f="$(basename $(<D)/.libs/$(<F)).o"; \
923 $(OBJCOPY) -j .go_export $$f $@.tmp; \
924 $(SHELL) $(srcdir)/mvifdiff.sh $@.tmp `echo $@ | sed -e 's/s-gox/gox/'`
931 GC="$(GOC) $(GOCFLAGS) $($(subst /,_,$@)_GOCFLAGS) -L `${PWD_COMMAND}` -L `${PWD_COMMAND}`/.libs"; \
933 GOLIBS="$(MATH_LIBS) $(NET_LIBS) $(LIBS)"; \
935 RUNTESTFLAGS="$(RUNTESTFLAGS)"; \
936 export RUNTESTFLAGS; \
941 libgccdir=`${GOC} -print-libgcc-file-name | sed -e 's|/[^/]*$$||'`; \
942 LD_LIBRARY_PATH="`${PWD_COMMAND}`/.libs:$${libgccdir}:${LD_LIBRARY_PATH}"; \
943 LD_LIBRARY_PATH=`echo $${LD_LIBRARY_PATH} | sed 's,::*,:,g;s,^:*,,;s,:*$$,,'`; \
944 export LD_LIBRARY_PATH; \
946 rm -f $@-testsum $@-testlog; \
947 files=`$(SHELL) $(srcdir)/match.sh --goarch=$(GOARCH) --goos=$(GOOS) --srcdir=$(srcdir)/go/$(@D) --extrafiles="$(extra_go_files_$(subst /,_,$(@D)))" $(matchargs_$(subst /,_,$(@D)))`; \
948 if test "$(USE_DEJAGNU)" = "yes"; then \
949 $(SHELL) $(srcdir)/testsuite/gotest --goarch=$(GOARCH) --goos=$(GOOS) --dejagnu=yes --basedir=$(srcdir) --srcdir=$(srcdir)/go/$(@D) --pkgpath="$(@D)" --pkgfiles="$$files" --testname="$(@D)" $(GOTESTFLAGS); \
950 elif test "$(GOBENCH)" != ""; then \
951 $(SHELL) $(srcdir)/testsuite/gotest --goarch=$(GOARCH) --goos=$(GOOS) --basedir=$(srcdir) --srcdir=$(srcdir)/go/$(@D) --pkgpath="$(@D)" --pkgfiles="$$files" --bench="$(GOBENCH)" $(GOTESTFLAGS); \
953 if $(SHELL) $(srcdir)/testsuite/gotest --goarch=$(GOARCH) --goos=$(GOOS) --basedir=$(srcdir) --srcdir=$(srcdir)/go/$(@D) --pkgpath="$(@D)" --pkgfiles="$$files" $(GOTESTFLAGS) >>$@-testlog 2>&1; then \
954 echo "PASS: $(@D)" >> $@-testlog; \
955 echo "PASS: $(@D)"; \
956 echo "PASS: $(@D)" > $@-testsum; \
958 echo "FAIL: $(@D)" >> $@-testlog; \
960 echo "FAIL: $(@D)" > $@-testsum; \
965 # Build all packages before checking any.
967 $(toolexeclibgo_DATA) \
968 $(toolexeclibgoarchive_DATA) \
969 $(toolexeclibgocompress_DATA) \
970 $(toolexeclibgocontainer_DATA) \
971 $(toolexeclibgocrypto_DATA) \
972 $(toolexeclibgodebug_DATA) \
973 $(toolexeclibgoencoding_DATA) \
974 $(toolexeclibgoexp_DATA) \
975 $(toolexeclibgogo_DATA) \
976 $(toolexeclibgohash_DATA) \
977 $(toolexeclibgoimage_DATA) \
978 $(toolexeclibgoindex_DATA) \
979 $(toolexeclibgoio_DATA) \
980 $(toolexeclibgolog_DATA) \
981 $(toolexeclibgomath_DATA) \
982 $(toolexeclibgomime_DATA) \
983 $(toolexeclibgonet_DATA) \
984 $(toolexeclibgonethttp_DATA) \
985 $(toolexeclibgoos_DATA) \
986 $(toolexeclibgopath_DATA) \
987 $(toolexeclibgorpc_DATA) \
988 $(toolexeclibgoruntime_DATA) \
989 $(toolexeclibgosync_DATA) \
990 $(toolexeclibgotesting_DATA) \
991 $(toolexeclibgotext_DATA) \
992 $(toolexeclibgotexttemplate_DATA) \
993 $(toolexeclibgounicode_DATA)
996 CHECK_DEPS += libgo-llgo.la libgobegin-llgo.a
998 CHECK_DEPS += libgo.la libgobegin.a
1001 # PACKAGE_template defines the rules for each package.
1002 # For example, for the package bufio, it produces:
1004 # @go_include@ bufio.lo.dep
1005 # bufio.lo.dep: $(srcdir)/go/bufio/*.go
1009 # bufio/check: $(CHECK_DEPS)
1011 # .PHONY: bufio/check
1013 # This is invoked with $(1) set to a package, which is a directory name,
1014 # such as "bufio" or "archive/tar".
1015 define PACKAGE_template
1016 @go_include@ $(1).lo.dep
1017 $(1).lo.dep: $(srcdir)/go/$(1)/*.go
1021 $(1)/check: $$(CHECK_DEPS)
1024 $(1).gox: $(1).s-gox; @true
1030 # This line expands PACKAGE_template once for each package name listed
1032 $(foreach package,$(PACKAGES),$(eval $(call PACKAGE_template,$(package))))
1034 # Pass -ffp-contract=off, or 386-specific options, when building the
1035 # math package. MATH_FLAG is defined in configure.ac.
1036 math_lo_GOCFLAGS = $(MATH_FLAG)
1038 # Add the generated file runtime_sysinfo.go to the runtime package.
1039 extra_go_files_runtime = runtime_sysinfo.go sigtab.go
1040 runtime.lo.dep: $(extra_go_files_runtime)
1042 # Add generated files to the syscall package.
1043 extra_go_files_syscall = \
1047 $(syscall_epoll_file)
1048 syscall.lo.dep: $(extra_go_files_syscall)
1050 # Pass -fgo-compiling-runtime when compiling the runtime package.
1051 runtime_lo_GOCFLAGS = -fgo-c-header=runtime.inc.tmp -fgo-compiling-runtime
1052 runtime_check_GOCFLAGS = -fgo-compiling-runtime
1053 runtime_internal_atomic_lo_GOCFLAGS = -fgo-compiling-runtime
1054 runtime_internal_atomic_lo_check_GOCFLAGS = -fgo-compiling-runtime
1055 runtime_internal_sys_lo_GOCFLAGS = -fgo-compiling-runtime
1056 runtime_internal_sys_lo_check_GOCFLAGS = -fgo-compiling-runtime
1058 # If libffi is supported (the normal case) use the ffi build tag for
1059 # the runtime package.
1061 matchargs_runtime = --tag=libffi
1066 # At least for now, we need -static-libgo for this test, because
1067 # otherwise we can't get the line numbers.
1068 # Also use -fno-inline to get better results from the memory profiler.
1069 runtime_pprof_check_GOCFLAGS = -static-libgo -fno-inline
1071 extra_go_files_runtime_internal_sys = version.go
1072 runtime/internal/sys.lo.dep: $(extra_go_files_runtime_internal_sys)
1074 # FIXME: The following C files may as well move to the runtime
1075 # directory and be treated like other C files.
1077 # Use C code to speed up {bytes,strings}.IndexByte and friends.
1078 bytes/index.lo: go/bytes/indexbyte.c runtime.inc
1080 $(LTCOMPILE) -c -o $@ $(srcdir)/go/bytes/indexbyte.c
1081 strings/index.lo: go/strings/indexbyte.c runtime.inc
1083 $(LTCOMPILE) -c -o $@ $(srcdir)/go/strings/indexbyte.c
1085 # Use a C function with a fixed number of arguments to call a C
1087 log/syslog/syslog_c.lo: go/log/syslog/syslog_c.c runtime.inc
1088 @$(MKDIR_P) log/syslog
1089 $(LTCOMPILE) -c -o $@ $(srcdir)/go/log/syslog/syslog_c.c
1091 # The interface to libffi from the reflect package is written in C.
1092 reflect/makefunc_ffi_c.lo: go/reflect/makefunc_ffi_c.c runtime.inc
1094 $(LTCOMPILE) -c -o $@ $(srcdir)/go/reflect/makefunc_ffi_c.c
1096 # The atomic functions are written in C.
1097 runtime/internal/atomic_c.lo: go/runtime/internal/atomic/atomic.c runtime.inc
1098 @$(MKDIR_P) runtime/internal
1099 $(LTCOMPILE) -c -o $@ $(srcdir)/go/runtime/internal/atomic/atomic.c
1100 sync/atomic_c.lo: go/sync/atomic/atomic.c runtime.inc
1102 $(LTCOMPILE) -c -o $@ $(srcdir)/go/sync/atomic/atomic.c
1104 # A few syscall functions are written in C.
1105 syscall/clone_linux.lo: go/syscall/clone_linux.c runtime.inc
1107 $(LTCOMPILE) -c -o $@ $(srcdir)/go/syscall/clone_linux.c
1108 syscall/errno.lo: go/syscall/errno.c runtime.inc
1110 $(LTCOMPILE) -c -o $@ $(srcdir)/go/syscall/errno.c
1111 syscall/signame.lo: go/syscall/signame.c runtime.inc
1113 $(LTCOMPILE) -c -o $@ $(srcdir)/go/syscall/signame.c
1114 syscall/wait.lo: go/syscall/wait.c runtime.inc
1116 $(LTCOMPILE) -c -o $@ $(srcdir)/go/syscall/wait.c
1118 # Solaris 12 changed the type of fields in struct stat.
1119 # Use a build tag, based on a configure check, to cope.
1121 if HAVE_STAT_TIMESPEC
1122 matchargs_os = --tag=solaristag
1132 # Build golang_org/x/net/route only on BSD systems.
1134 $(eval $(call PACKAGE_template,golang_org/x/net/route))
1136 golang_org_x_net_route_lo = \
1137 golang_org/x/net/route.lo
1138 golang_org_x_net_route_check = \
1139 golang_org/x/net/route/check
1145 # Build golang_org/x/net/lif only on Solaris systems.
1147 $(eval $(call PACKAGE_template,golang_org/x/net/lif))
1149 golang_org_x_net_lif_lo = \
1150 golang_org/x/net/lif.lo
1151 golang_org_x_net_lif_check = \
1152 golang_org/x/net/lif/check
1185 compress/bzip2/check \
1186 compress/flate/check \
1187 compress/gzip/check \
1188 compress/lzw/check \
1189 compress/zlib/check \
1190 container/heap/check \
1191 container/list/check \
1192 container/ring/check \
1194 crypto/cipher/check \
1197 crypto/ecdsa/check \
1198 crypto/elliptic/check \
1205 crypto/sha256/check \
1206 crypto/sha512/check \
1207 crypto/subtle/check \
1210 database/sql/check \
1211 database/sql/driver/check \
1216 debug/plan9obj/check \
1217 encoding/ascii85/check \
1218 encoding/asn1/check \
1219 encoding/base32/check \
1220 encoding/base64/check \
1221 encoding/binary/check \
1222 encoding/csv/check \
1223 encoding/gob/check \
1224 encoding/hex/check \
1225 encoding/json/check \
1226 encoding/pem/check \
1227 encoding/xml/check \
1229 exp/terminal/check \
1230 html/template/check \
1236 go/internal/gcimporter/check \
1237 go/internal/gccgoimporter/check \
1243 golang_org/x/crypto/chacha20poly1305/check \
1244 golang_org/x/crypto/chacha20poly1305/internal/chacha20/check \
1245 golang_org/x/crypto/curve25519/check \
1246 golang_org/x/crypto/poly1305/check \
1247 golang_org/x/net/http2/hpack/check \
1248 golang_org/x/net/idna/check \
1249 golang_org/x/net/lex/httplex/check \
1250 $(golang_org_x_net_lif_check) \
1251 $(golang_org_x_net_route_check) \
1252 hash/adler32/check \
1260 index/suffixarray/check \
1261 internal/pprof/profile/check \
1262 internal/singleflight/check \
1263 internal/trace/check \
1269 mime/multipart/check \
1270 mime/quotedprintable/check \
1272 net/http/cgi/check \
1273 net/http/cookiejar/check \
1274 net/http/fcgi/check \
1275 net/http/httptest/check \
1276 net/http/httptrace/check \
1277 net/http/httputil/check \
1278 net/http/internal/check \
1279 net/internal/socktest/check \
1283 net/textproto/check \
1285 net/rpc/jsonrpc/check \
1289 path/filepath/check \
1290 regexp/syntax/check \
1291 runtime/debug/check \
1292 runtime/internal/atomic/check \
1293 runtime/internal/sys/check \
1294 runtime/pprof/check \
1295 runtime/pprof/internal/protopprof/check \
1296 runtime/trace/check \
1298 text/scanner/check \
1299 text/tabwriter/check \
1300 text/template/check \
1301 text/template/parse/check \
1302 testing/quick/check \
1303 unicode/utf16/check \
1307 check-recursive: check-head
1310 @echo "Test Run By $${USER} on `date`" > libgo.head
1311 @echo "Native configuration is $(host_triplet)" >> libgo.head
1313 @echo " === libgo tests ===" >> libgo.head
1316 check-tail: check-recursive check-multi
1317 @if test "$(USE_DEJAGNU)" = "yes"; then \
1320 lib=`${PWD_COMMAND} | sed -e 's,^.*/\([^/][^/]*\)$$,\1,'`; \
1321 for dir in . $(MULTIDIRS); do \
1322 mv ../$${dir}/$${lib}/libgo.sum ../$${dir}/$${lib}/libgo.sum.sep; \
1323 mv ../$${dir}/$${lib}/libgo.log ../$${dir}/$${lib}/libgo.log.sep; \
1325 mv libgo.head libgo.sum; \
1326 cp libgo.sum libgo.log; \
1327 echo "Schedule of variations:" >> libgo.sum; \
1328 for dir in . $(MULTIDIRS); do \
1329 multidir=../$${dir}/$${lib}; \
1330 multivar=`cat $${multidir}/libgo.var`; \
1331 echo " $${multivar}" >> libgo.sum; \
1333 echo >> libgo.sum; \
1334 pass=0; fail=0; untested=0; \
1335 for dir in . $(MULTIDIRS); do \
1336 multidir=../$${dir}/$${lib}; \
1337 multivar=`cat $${multidir}/libgo.var`; \
1338 echo "Running target $${multivar}" >> libgo.sum; \
1339 echo "Running $(srcdir)/libgo.exp ..." >> libgo.sum; \
1340 cat $${multidir}/libgo.sum.sep >> libgo.sum; \
1341 cat $${multidir}/libgo.log.sep >> libgo.log; \
1342 if test -n "${MULTIDIRS}"; then \
1343 echo " === libgo Summary for $${multivar} ===" >> libgo.sum; \
1344 echo >> libgo.sum; \
1346 p=`grep -c PASS $${multidir}/libgo.sum.sep`; \
1347 pass=`expr $$pass + $$p`; \
1348 if test "$$p" -ne "0" && test -n "${MULTIDIRS}"; then \
1349 echo "# of expected passes $$p" >> libgo.sum; \
1351 p=`grep -c FAIL $${multidir}/libgo.sum.sep`; \
1352 fail=`expr $$fail + $$p`; \
1353 if test "$$p" -ne "0" && test -n "${MULTIDIRS}"; then \
1354 echo "# of unexpected failures $$p" >> libgo.sum; \
1356 p=`grep -c UNTESTED $${multidir}/libgo.sum.sep`; \
1357 untested=`expr $$untested + $$p`; \
1358 if test "$$p" -ne "0" && test -n "${MULTIDIRS}"; then \
1359 echo "# of untested testcases $$p" >> libgo.sum; \
1362 echo >> libgo.sum; \
1363 echo " === libgo Summary ===" >> libgo.sum; \
1364 echo >> libgo.sum; \
1365 if test "$$pass" -ne "0"; then \
1366 echo "# of expected passes $$pass" >> libgo.sum; \
1368 if test "$$fail" -ne "0"; then \
1369 echo "# of unexpected failures $$fail" >> libgo.sum; \
1371 if test "$$untested" -ne "0"; then \
1372 echo "# of untested testcases $$untested" >> libgo.sum; \
1374 echo `echo $(GOC) | sed -e 's/ .*//'` `$(GOC) -v 2>&1 | grep " version" | sed -n -e 's/.* \(version.*$$\)/\1/p'` >> libgo.sum; \
1375 echo >> libgo.log; \
1376 echo "runtest completed at `date`" >> libgo.log; \
1377 if test "$$fail" -ne "0"; then \
1385 @rm -f libgo.sum libgo.log libgo.tail
1387 [ -z "$(MULTIFLAGS)" ] || multivar="$${multivar}/$(MULTIFLAGS)"; \
1388 echo "$${multivar}" > libgo.var
1389 @for f in $(TEST_PACKAGES); do \
1390 rm -f $$f-testsum $$f-testlog; \
1392 -@$(MAKE) -k $(TEST_PACKAGES)
1393 @for f in $(TEST_PACKAGES); do \
1394 if test -f $$f-testsum; then \
1395 cat $$f-testsum >> libgo.sum; \
1397 if test -f $$f-testlog; then \
1398 cat $$f-testlog >> libgo.log; \
1403 $(MULTIDO) $(AM_MAKEFLAGS) DO=check-am multi-do # $(MAKE)
1406 -@$(MAKE) -k $(TEST_PACKAGES) GOBENCH=.
1408 MOSTLYCLEANFILES = \
1409 s-runtime_sysinfo s-sigtab s-runtime-inc s-zstdpkglist \
1410 s-libcalls s-libcalls-list s-syscall_arch s-gen-sysinfo s-sysinfo \
1412 libgo.head libgo.sum.sep libgo.log.sep libgo.var \
1413 libcalls-list runtime.inc runtime.inc.tmp2 runtime.inc.tmp3
1416 find . -name '*.lo' -print | xargs $(LIBTOOL) --mode=clean rm -f
1417 find . -name '*.$(OBJEXT)' -print | xargs rm -f
1418 find . -name '*-testsum' -print | xargs rm -f
1419 find . -name '*-testlog' -print | xargs rm -f
1421 CLEANFILES = *.go *.c s-version libgo.sum libgo.log runtime.inc
1424 find . -name '*.la' -print | xargs $(LIBTOOL) --mode=clean rm -f
1425 find . -name '*.a' -print | xargs rm -f
1426 find . -name '*.gox' -print | xargs rm -f
1427 find . -name '*.s-gox' -print | xargs rm -f
1430 find . -name '*.lo.dep' -print | xargs rm -f