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
50 AM_LDFLAGS = -XCClinker $(SPLIT_STACK)
56 # Work around what appears to be a GNU make handling MAKEFLAGS
57 # values defined in terms of make variables, as is the case for CC and
58 # friends when we are called from the top level Makefile.
60 "AR_FLAGS=$(AR_FLAGS)" \
61 "CC_FOR_BUILD=$(CC_FOR_BUILD)" \
62 "CC_FOR_TARGET=$(CC_FOR_TARGET)" \
64 "CXXFLAGS=$(CXXFLAGS)" \
65 "CFLAGS_FOR_BUILD=$(CFLAGS_FOR_BUILD)" \
66 "CFLAGS_FOR_TARGET=$(CFLAGS_FOR_TARGET)" \
67 "GOC_FOR_TARGET=$(GOC_FOR_TARGET)" \
69 "GOCFLAGS=$(GOCFLAGS)" \
70 "INSTALL=$(INSTALL)" \
71 "INSTALL_DATA=$(INSTALL_DATA)" \
72 "INSTALL_PROGRAM=$(INSTALL_PROGRAM)" \
73 "INSTALL_SCRIPT=$(INSTALL_SCRIPT)" \
74 "LDFLAGS=$(LDFLAGS)" \
75 "LIBCFLAGS=$(LIBCFLAGS)" \
76 "LIBCFLAGS_FOR_TARGET=$(LIBCFLAGS_FOR_TARGET)" \
78 "MAKEINFO=$(MAKEINFO) $(MAKEINFOFLAGS)" \
79 "PICFLAG=$(PICFLAG)" \
80 "PICFLAG_FOR_TARGET=$(PICFLAG_FOR_TARGET)" \
82 "RUNTESTFLAGS=$(RUNTESTFLAGS)" \
83 "exec_prefix=$(exec_prefix)" \
84 "infodir=$(infodir)" \
86 "includedir=$(includedir)" \
88 "tooldir=$(tooldir)" \
89 "gxx_include_dir=$(gxx_include_dir)" \
95 "NM_FOR_BUILD=$(NM_FOR_BUILD)" \
96 "NM_FOR_TARGET=$(NM_FOR_TARGET)" \
97 "DESTDIR=$(DESTDIR)" \
100 # Subdir rules rely on $(FLAGS_TO_PASS)
101 FLAGS_TO_PASS = $(AM_MAKEFLAGS)
104 toolexeclib_LTLIBRARIES = libgo-llgo.la
105 toolexeclib_LIBRARIES = libgobegin-llgo.a
107 toolexeclib_LTLIBRARIES = libgo.la
108 toolexeclib_LIBRARIES = libgobegin.a libgolibbegin.a
111 toolexeclibgo_DATA = \
143 toolexeclibgoarchivedir = $(toolexeclibgodir)/archive
145 toolexeclibgoarchive_DATA = \
149 toolexeclibgocompressdir = $(toolexeclibgodir)/compress
151 toolexeclibgocompress_DATA = \
158 toolexeclibgocontainerdir = $(toolexeclibgodir)/container
160 toolexeclibgocontainer_DATA = \
165 toolexeclibgocryptodir = $(toolexeclibgodir)/crypto
167 toolexeclibgocrypto_DATA = \
173 crypto/elliptic.gox \
186 toolexeclibgocryptox509dir = $(toolexeclibgocryptodir)/x509
188 toolexeclibgocryptox509_DATA = \
191 toolexeclibgodatabasedir = $(toolexeclibgodir)/database
193 toolexeclibgodatabase_DATA = \
196 toolexeclibgodatabasesqldir = $(toolexeclibgodatabasedir)/sql
198 toolexeclibgodatabasesql_DATA = \
199 database/sql/driver.gox
201 toolexeclibgodebugdir = $(toolexeclibgodir)/debug
203 toolexeclibgodebug_DATA = \
211 toolexeclibgoencodingdir = $(toolexeclibgodir)/encoding
213 toolexeclibgoencoding_DATA = \
214 encoding/ascii85.gox \
216 encoding/base32.gox \
217 encoding/base64.gox \
218 encoding/binary.gox \
226 toolexeclibgoexpdir = $(toolexeclibgodir)/exp
228 toolexeclibgoexp_DATA = \
232 toolexeclibgogodir = $(toolexeclibgodir)/go
234 toolexeclibgogo_DATA = \
247 toolexeclibgohashdir = $(toolexeclibgodir)/hash
249 toolexeclibgohash_DATA = \
255 toolexeclibgohtmldir = $(toolexeclibgodir)/html
257 toolexeclibgohtml_DATA = \
260 toolexeclibgoimagedir = $(toolexeclibgodir)/image
262 toolexeclibgoimage_DATA = \
269 toolexeclibgoimagecolordir = $(toolexeclibgoimagedir)/color
271 toolexeclibgoimagecolor_DATA = \
272 image/color/palette.gox
274 toolexeclibgoindexdir = $(toolexeclibgodir)/index
276 toolexeclibgoindex_DATA = \
277 index/suffixarray.gox
279 toolexeclibgoiodir = $(toolexeclibgodir)/io
281 toolexeclibgoio_DATA = \
284 toolexeclibgologdir = $(toolexeclibgodir)/log
286 toolexeclibgolog_DATA = \
289 toolexeclibgomathdir = $(toolexeclibgodir)/math
291 toolexeclibgomath_DATA = \
296 toolexeclibgomimedir = $(toolexeclibgodir)/mime
298 toolexeclibgomime_DATA = \
300 mime/quotedprintable.gox
302 toolexeclibgonetdir = $(toolexeclibgodir)/net
304 toolexeclibgonet_DATA = \
312 toolexeclibgonethttpdir = $(toolexeclibgonetdir)/http
314 toolexeclibgonethttp_DATA = \
316 net/http/cookiejar.gox \
318 net/http/httptest.gox \
319 net/http/httptrace.gox \
320 net/http/httputil.gox \
323 toolexeclibgonetrpcdir = $(toolexeclibgonetdir)/rpc
325 toolexeclibgonetrpc_DATA = \
328 toolexeclibgoosdir = $(toolexeclibgodir)/os
330 toolexeclibgoos_DATA = \
335 toolexeclibgopathdir = $(toolexeclibgodir)/path
337 toolexeclibgopath_DATA = \
340 toolexeclibgoregexpdir = $(toolexeclibgodir)/regexp
342 toolexeclibgoregexp_DATA = \
345 toolexeclibgoruntimedir = $(toolexeclibgodir)/runtime
347 toolexeclibgoruntime_DATA = \
352 toolexeclibgosyncdir = $(toolexeclibgodir)/sync
354 toolexeclibgosync_DATA = \
357 toolexeclibgotestingdir = $(toolexeclibgodir)/testing
359 toolexeclibgotesting_DATA = \
363 toolexeclibgotextdir = $(toolexeclibgodir)/text
365 toolexeclibgotext_DATA = \
370 toolexeclibgotexttemplatedir = $(toolexeclibgotextdir)/template
372 toolexeclibgotexttemplate_DATA = \
373 text/template/parse.gox
375 toolexeclibgounicodedir = $(toolexeclibgodir)/unicode
377 toolexeclibgounicode_DATA = \
382 runtime_mem_file = runtime/mem.c
384 runtime_mem_file = runtime/mem_posix_memalign.c
388 rtems_task_variable_add_file = runtime/rtems-task-variable-add.c
390 rtems_task_variable_add_file =
394 runtime_thread_files = runtime/thread-linux.c
396 runtime_thread_files = runtime/thread-sema.c
400 runtime_getncpu_file = runtime/getncpu-linux.c
403 runtime_getncpu_file = runtime/getncpu-bsd.c
406 runtime_getncpu_file = runtime/getncpu-irix.c
409 runtime_getncpu_file = runtime/getncpu-solaris.c
412 runtime_getncpu_file = runtime/getncpu-bsd.c
415 runtime_getncpu_file = runtime/getncpu-bsd.c
417 runtime_getncpu_file = runtime/getncpu-none.c
427 runtime/go-assert.c \
428 runtime/go-breakpoint.c \
429 runtime/go-caller.c \
430 runtime/go-callers.c \
433 runtime/go-construct-map.c \
435 runtime/go-fieldtrack.c \
436 runtime/go-matherr.c \
437 runtime/go-memclr.c \
438 runtime/go-memcmp.c \
439 runtime/go-memequal.c \
440 runtime/go-memmove.c \
441 runtime/go-nanotime.c \
445 runtime/go-reflect-call.c \
446 runtime/go-runtime-error.c \
447 runtime/go-setenv.c \
448 runtime/go-signal.c \
449 runtime/go-strslice.c \
450 runtime/go-typedesc-equal.c \
451 runtime/go-unsafe-new.c \
452 runtime/go-unsafe-newarray.c \
453 runtime/go-unsafe-pointer.c \
454 runtime/go-unsetenv.c \
455 runtime/go-unwind.c \
456 runtime/go-varargs.c \
457 runtime/env_posix.c \
461 $(runtime_mem_file) \
462 runtime/mfixalloc.c \
470 runtime/runtime_c.c \
472 $(runtime_thread_files) \
474 $(rtems_task_variable_add_file) \
476 $(runtime_getncpu_file)
478 goc2c.$(OBJEXT): runtime/goc2c.c
479 $(CC_FOR_BUILD) -c $(CFLAGS_FOR_BUILD) $<
481 goc2c: goc2c.$(OBJEXT)
482 $(CC_FOR_BUILD) $(CFLAGS_FOR_BUILD) $(LDFLAGS_FOR_BUILD) -o $@ $<
484 malloc.c: $(srcdir)/runtime/malloc.goc goc2c
488 %.c: $(srcdir)/runtime/%.goc goc2c
492 version.go: s-version; @true
495 echo "package sys" > version.go.tmp
496 echo 'const DefaultGoroot = "$(prefix)"' >> version.go.tmp
497 echo 'const TheVersion = "'`cat $(srcdir)/VERSION | sed 1q`' '`$(GOC) --version | sed 1q`'"' >> version.go.tmp
498 echo 'const GOARCH = "'$(GOARCH)'"' >> version.go.tmp
499 echo 'const GOOS = "'$(GOOS)'"' >> version.go.tmp
500 echo 'const GccgoToolDir = "$(libexecsubdir)"' >> version.go.tmp
501 echo >> version.go.tmp
502 echo "type ArchFamilyType int" >> version.go.tmp
503 echo >> version.go.tmp
504 echo "const (" >> version.go.tmp
505 echo " UNKNOWN ArchFamilyType = iota" >> version.go.tmp
506 for a in $(ALLGOARCHFAMILY); do \
507 echo " $${a}" >> version.go.tmp; \
509 echo ")" >> version.go.tmp
510 echo >> version.go.tmp
511 for a in $(ALLGOARCH); 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}" = "$(GOARCH)"; then \
515 echo "const Goarch$${n} = 1" >> version.go.tmp; \
517 echo "const Goarch$${n} = 0" >> version.go.tmp; \
520 echo >> version.go.tmp
521 echo "const (" >> version.go.tmp
522 echo " ArchFamily = $(GOARCH_FAMILY)" >> version.go.tmp
523 echo " BigEndian = $(GOARCH_BIGENDIAN)" >> version.go.tmp
524 echo " CacheLineSize = $(GOARCH_CACHELINESIZE)" >> version.go.tmp
525 echo " PhysPageSize = $(GOARCH_PHYSPAGESIZE)" >> version.go.tmp
526 echo " PCQuantum = $(GOARCH_PCQUANTUM)" >> version.go.tmp
527 echo " Int64Align = $(GOARCH_INT64ALIGN)" >> version.go.tmp
528 echo " HugePageSize = $(GOARCH_HUGEPAGESIZE)" >> version.go.tmp
529 echo " MinFrameSize = $(GOARCH_MINFRAMESIZE)" >> version.go.tmp
530 echo ")" >> version.go.tmp
531 echo >> version.go.tmp
532 for a in $(ALLGOOS); do \
533 f=`echo $${a} | sed -e 's/\(.\).*/\1/' -e 'y/abcdefghijklmnopqrstuvwxyz/ABCDEFGHIJKLMNOPQRSTUVWXYZ/'`; \
534 n="$${f}`echo $${a} | sed -e 's/.//'`"; \
535 if test "$${a}" = "$(GOOS)"; then \
536 echo "const Goos$${n} = 1" >> version.go.tmp; \
538 echo "const Goos$${n} = 0" >> version.go.tmp; \
541 echo >> version.go.tmp
542 echo "type Uintreg uintptr" >> version.go.tmp
543 $(SHELL) $(srcdir)/mvifdiff.sh version.go.tmp version.go
546 runtime_sysinfo.go: s-runtime_sysinfo; @true
547 s-runtime_sysinfo: $(srcdir)/mkrsysinfo.sh gen-sysinfo.go
548 $(SHELL) $(srcdir)/mkrsysinfo.sh
549 $(SHELL) $(srcdir)/mvifdiff.sh tmp-runtime_sysinfo.go runtime_sysinfo.go
552 sigtab.go: s-sigtab; @true
553 s-sigtab: $(srcdir)/mksigtab.sh gen-sysinfo.go
554 GOOS=$(GOOS) $(SHELL) $(srcdir)/mksigtab.sh > tmp-sigtab.go
555 $(SHELL) $(srcdir)/mvifdiff.sh tmp-sigtab.go sigtab.go
558 runtime.inc: s-runtime-inc; @true
559 s-runtime-inc: runtime.lo Makefile
560 rm -f runtime.inc.tmp2
561 grep -v "#define _" runtime.inc.tmp | grep -v "#define [cm][01234] " > runtime.inc.tmp2
562 for pattern in '_[GP][a-z]' _Max _Lock _Sig _Trace _MHeap _Num; do \
563 grep "#define $$pattern" runtime.inc.tmp >> runtime.inc.tmp2; \
565 $(SHELL) $(srcdir)/mvifdiff.sh runtime.inc.tmp2 runtime.inc
568 noinst_DATA = zstdpkglist.go
570 # Generate the list of go std packages that were included in libgo
571 zstdpkglist.go: s-zstdpkglist; @true
572 s-zstdpkglist: Makefile
573 rm -f zstdpkglist.go.tmp
574 echo 'package main' > zstdpkglist.go.tmp
575 echo "" >> zstdpkglist.go.tmp
576 echo 'var stdpkg = map[string]bool{' >> zstdpkglist.go.tmp
577 echo $(libgo_go_objs) 'unsafe.lo' 'runtime/cgo.lo' | sed 's/\.lo /\": true,\n/g' | grep -v _c | sed 's/\.lo/\": true,/' | sed 's/^/\t\"/' | sort -u >> zstdpkglist.go.tmp
578 echo '}' >> zstdpkglist.go.tmp
579 $(SHELL) $(srcdir)/mvifdiff.sh zstdpkglist.go.tmp zstdpkglist.go
583 syscall_epoll_file = epoll.go
588 libcalls.go: s-libcalls; @true
589 s-libcalls: libcalls-list go/syscall/mksyscall.awk $(srcdir)/go/syscall/*.go
590 rm -f libcalls.go.tmp
591 $(AWK) -f $(srcdir)/go/syscall/mksyscall.awk `cat libcalls-list` > libcalls.go.tmp
592 $(SHELL) $(srcdir)/mvifdiff.sh libcalls.go.tmp libcalls.go
595 libcalls-list: s-libcalls-list; @true
596 s-libcalls-list: Makefile $(srcdir)/go/syscall/*.go
597 rm -f libcalls-list.tmp
598 $(SHELL) $(srcdir)/match.sh --goarch=$(GOARCH) --goos=$(GOOS) --srcdir=$(srcdir)/go/syscall $(matchargs_syscall) > libcalls-list.tmp
599 $(SHELL) $(srcdir)/mvifdiff.sh libcalls-list.tmp libcalls-list
602 syscall_arch.go: s-syscall_arch; @true
603 s-syscall_arch: Makefile
604 rm -f syscall_arch.go.tmp
605 echo "package syscall" > syscall_arch.go.tmp
606 echo 'const ARCH = "'$(GOARCH)'"' >> syscall_arch.go.tmp
607 echo 'const OS = "'$(GOOS)'"' >> syscall_arch.go.tmp
608 $(SHELL) $(srcdir)/mvifdiff.sh syscall_arch.go.tmp syscall_arch.go
612 $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \
613 $(CPPFLAGS) $(OSCFLAGS) -O
615 gen-sysinfo.go: s-gen-sysinfo; @true
616 s-gen-sysinfo: $(srcdir)/sysinfo.c config.h
617 $(CC) $(SYSINFO_FLAGS) -fdump-go-spec=tmp-gen-sysinfo.go -std=gnu99 -S -o sysinfo.s $(srcdir)/sysinfo.c
619 $(SHELL) $(srcdir)/mvifdiff.sh tmp-gen-sysinfo.go gen-sysinfo.go
622 errno.i: s-errno; @true
624 echo '#include <errno.h>' | $(CC) $(SYSINFO_FLAGS) -x c - -E -dM > tmp-errno.i
625 $(SHELL) $(srcdir)/mvifdiff.sh tmp-errno.i errno.i
628 sysinfo.go: s-sysinfo; @true
629 s-sysinfo: $(srcdir)/mksysinfo.sh gen-sysinfo.go errno.i
630 $(SHELL) $(srcdir)/mksysinfo.sh
631 $(SHELL) $(srcdir)/mvifdiff.sh tmp-sysinfo.go sysinfo.go
634 # The epoll struct has an embedded union and is packed on x86_64,
635 # which is too complicated for mksysinfo.sh. We find the offset of
636 # the only field we care about in configure.ac, and generate the
638 epoll.go: s-epoll; @true
641 echo 'package syscall' > epoll.go.tmp
642 echo 'type EpollEvent struct {' >> epoll.go.tmp
643 echo ' Events uint32' >> epoll.go.tmp
644 case "$(SIZEOF_STRUCT_EPOLL_EVENT),$(STRUCT_EPOLL_EVENT_FD_OFFSET)" in \
645 0,0) echo 1>&2 "*** struct epoll_event data.fd offset unknown"; \
647 8,4) echo ' Fd int32' >> epoll.go.tmp; ;; \
648 12,4) echo ' Fd int32' >> epoll.go.tmp; \
649 echo ' Pad [4]byte' >> epoll.go.tmp; ;; \
650 12,8) echo ' Pad [4]byte' >> epoll.go.tmp; \
651 echo ' Fd int32' >> epoll.go.tmp; ;; \
652 16,8) echo ' Pad [4]byte' >> epoll.go.tmp; \
653 echo ' Fd int32' >> epoll.go.tmp; \
654 echo ' Pad2 [4]byte' >> epoll.go.tmp; ;; \
655 *) echo 1>&2 "*** struct epoll_event unsupported"; \
658 echo '}' >> epoll.go.tmp
659 $(SHELL) $(srcdir)/mvifdiff.sh epoll.go.tmp epoll.go
663 syscall_lib_clone_lo = syscall/clone_linux.lo
665 syscall_lib_clone_lo =
673 cmd/internal/browser \
691 crypto/internal/cipherhw \
704 database/sql/driver \
735 go/internal/gccgoimporter \
736 go/internal/gcimporter \
742 golang_org/x/crypto/chacha20poly1305 \
743 golang_org/x/crypto/chacha20poly1305/internal/chacha20 \
744 golang_org/x/crypto/curve25519 \
745 golang_org/x/crypto/poly1305 \
746 golang_org/x/net/http2/hpack \
747 golang_org/x/net/idna \
748 golang_org/x/net/lex/httplex \
749 golang_org/x/text/transform \
750 golang_org/x/text/unicode/norm \
751 golang_org/x/text/width \
761 image/color/palette \
764 image/internal/imageutil \
769 internal/pprof/profile \
771 internal/singleflight \
772 internal/syscall/unix \
785 mime/quotedprintable \
796 net/internal/socktest \
814 runtime/internal/atomic \
815 runtime/internal/sys \
817 runtime/pprof/internal/protopprof \
826 testing/internal/testdeps \
832 text/template/parse \
839 $(addsuffix .lo,$(PACKAGES)) \
841 reflect/makefunc_ffi_c.lo \
843 $(syscall_lib_clone_lo) \
847 $(golang_org_x_net_lif_lo) \
848 $(golang_org_x_net_route_lo) \
849 log/syslog/syslog_c.lo \
850 $(os_lib_inotify_lo) \
851 runtime/internal/atomic_c.lo \
855 -version-info $(libtool_VERSION) $(PTHREAD_CFLAGS) $(AM_LDFLAGS)
858 $(libgo_go_objs) ../libbacktrace/libbacktrace.la \
859 $(LIBATOMIC) $(LIBFFI) $(PTHREAD_LIBS) $(MATH_LIBS) $(NET_LIBS)
861 libgo_la_SOURCES = $(runtime_files)
862 libgo_la_LDFLAGS = $(libgo_ldflags)
863 libgo_la_LIBADD = $(libgo_libadd)
865 libgo_llgo_la_SOURCES = $(runtime_files)
866 libgo_llgo_la_LDFLAGS = $(libgo_ldflags)
867 libgo_llgo_la_LIBADD = $(libgo_libadd)
869 libgobegin_a_SOURCES = \
872 libgobegin_llgo_a_SOURCES = \
875 # Use -fPIC for libgobegin so that it can be put in a PIE.
876 libgobegin_a_CFLAGS = $(AM_CFLAGS) -fPIC
877 libgobegin_llgo_a_CFLAGS = $(AM_CFLAGS) -fPIC
879 libgolibbegin_a_SOURCES = \
882 libgolibbegin_a_CFLAGS = $(AM_CFLAGS) -fPIC
884 # Make sure runtime.inc is built before compiling any .c file.
885 $(libgo_la_OBJECTS): runtime.inc
886 $(libgo_llgo_la_OBJECTS): runtime.inc
887 $(libgobegin_a_OBJECTS): runtime.inc
888 $(libgobegin_llgo_a_OBJECTS): runtime.inc
889 $(libgolibbegin_a_OBJECTS): runtime.inc
891 LTLDFLAGS = $(shell $(SHELL) $(top_srcdir)/../libtool-ldflags $(LDFLAGS))
894 AM_GOCFLAGS = $(STRINGOPS_FLAG) $(GO_SPLIT_STACK)
895 GOCOMPILE = $(GOC) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_GOCFLAGS) $(GOCFLAGS)
897 LTGOCOMPILE = $(LIBTOOL) --tag GO --mode=compile $(GOC) $(INCLUDES) \
898 $(AM_GOCFLAGS) $(GOCFLAGS)
900 GOLINK = $(LIBTOOL) --tag GO --mode-link $(GOC) \
901 $(OPT_LDFLAGS) $(SECTION_LDFLAGS) $(AM_GOCFLAGS) $(LTLDFLAGS) -o $@
903 # Build the dependencies for a Go package.
906 dir=`echo $@ | sed -e 's/.lo.dep$$//'`; \
907 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,,$@)))`; \
908 $(SHELL) $(srcdir)/godeps.sh `echo $@ | sed -e 's/.dep$$//'` $$files > $@.tmp; \
909 if ! cmp $@.tmp $@ >/dev/null 2>/dev/null; then \
910 rm -f `echo $@ | sed -e 's/\.dep$$//'`; \
914 # Build the .go files for a package, generating a .lo file.
917 files=`echo $^ | sed -e 's/[^ ]*\.gox//g' -e 's/[^ ]*\.dep//'`; \
918 $(LTGOCOMPILE) -I . -c -fgo-pkgpath=`echo $@ | sed -e 's/.lo$$//'` $($(subst -,_,$(subst .,_,$(subst /,_,$@)))_GOCFLAGS) -o $@ $$files
920 # How to build a .gox file from a .lo file.
922 f=`echo $< | sed -e 's/.lo$$/.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; \
939 libgccdir=`${GOC} -print-libgcc-file-name | sed -e 's|/[^/]*$$||'`; \
940 LD_LIBRARY_PATH="`${PWD_COMMAND}`/.libs:$${libgccdir}:${LD_LIBRARY_PATH}"; \
941 LD_LIBRARY_PATH=`echo $${LD_LIBRARY_PATH} | sed 's,::*,:,g;s,^:*,,;s,:*$$,,'`; \
942 export LD_LIBRARY_PATH; \
944 rm -f $@-testsum $@-testlog; \
945 files=`$(SHELL) $(srcdir)/match.sh --goarch=$(GOARCH) --goos=$(GOOS) --srcdir=$(srcdir)/go/$(@D) --extrafiles="$(extra_go_files_$(subst /,_,$(@D)))" $(matchargs_$(subst /,_,$(@D)))`; \
946 if test "$(USE_DEJAGNU)" = "yes"; then \
947 $(SHELL) $(srcdir)/testsuite/gotest --goarch=$(GOARCH) --goos=$(GOOS) --dejagnu=yes --basedir=$(srcdir) --srcdir=$(srcdir)/go/$(@D) --pkgpath="$(@D)" --pkgfiles="$$files" --testname="$(@D)" $(GOTESTFLAGS); \
948 elif test "$(GOBENCH)" != ""; then \
949 $(SHELL) $(srcdir)/testsuite/gotest --goarch=$(GOARCH) --goos=$(GOOS) --basedir=$(srcdir) --srcdir=$(srcdir)/go/$(@D) --pkgpath="$(@D)" --pkgfiles="$$files" --bench="$(GOBENCH)" $(GOTESTFLAGS); \
951 if $(SHELL) $(srcdir)/testsuite/gotest --goarch=$(GOARCH) --goos=$(GOOS) --basedir=$(srcdir) --srcdir=$(srcdir)/go/$(@D) --pkgpath="$(@D)" --pkgfiles="$$files" $(GOTESTFLAGS) >>$@-testlog 2>&1; then \
952 echo "PASS: $(@D)" >> $@-testlog; \
953 echo "PASS: $(@D)"; \
954 echo "PASS: $(@D)" > $@-testsum; \
956 echo "FAIL: $(@D)" >> $@-testlog; \
958 echo "FAIL: $(@D)" > $@-testsum; \
963 # Build all packages before checking any.
965 $(toolexeclibgo_DATA) \
966 $(toolexeclibgoarchive_DATA) \
967 $(toolexeclibgocompress_DATA) \
968 $(toolexeclibgocontainer_DATA) \
969 $(toolexeclibgocrypto_DATA) \
970 $(toolexeclibgodebug_DATA) \
971 $(toolexeclibgoencoding_DATA) \
972 $(toolexeclibgoexp_DATA) \
973 $(toolexeclibgogo_DATA) \
974 $(toolexeclibgohash_DATA) \
975 $(toolexeclibgoimage_DATA) \
976 $(toolexeclibgoindex_DATA) \
977 $(toolexeclibgoio_DATA) \
978 $(toolexeclibgolog_DATA) \
979 $(toolexeclibgomath_DATA) \
980 $(toolexeclibgomime_DATA) \
981 $(toolexeclibgonet_DATA) \
982 $(toolexeclibgonethttp_DATA) \
983 $(toolexeclibgoos_DATA) \
984 $(toolexeclibgopath_DATA) \
985 $(toolexeclibgorpc_DATA) \
986 $(toolexeclibgoruntime_DATA) \
987 $(toolexeclibgosync_DATA) \
988 $(toolexeclibgotesting_DATA) \
989 $(toolexeclibgotext_DATA) \
990 $(toolexeclibgotexttemplate_DATA) \
991 $(toolexeclibgounicode_DATA)
994 CHECK_DEPS += libgo-llgo.la libgobegin-llgo.a
996 CHECK_DEPS += libgo.la libgobegin.a
999 # PACKAGE_template defines the rules for each package.
1000 # For example, for the package bufio, it produces:
1002 # @go_include@ bufio.lo.dep
1003 # bufio.lo.dep: $(srcdir)/go/bufio/*.go
1007 # bufio/check: $(CHECK_DEPS)
1009 # .PHONY: bufio/check
1011 # This is invoked with $(1) set to a package, which is a directory name,
1012 # such as "bufio" or "archive/tar".
1013 define PACKAGE_template
1014 @go_include@ $(1).lo.dep
1015 $(1).lo.dep: $(srcdir)/go/$(1)/*.go
1019 $(1)/check: $$(CHECK_DEPS)
1022 $(1).gox: $(1).s-gox; @true
1028 # This line expands PACKAGE_template once for each package name listed
1030 $(foreach package,$(PACKAGES),$(eval $(call PACKAGE_template,$(package))))
1032 # Pass -ffp-contract=off, or 386-specific options, when building the
1033 # math package. MATH_FLAG is defined in configure.ac.
1034 math_lo_GOCFLAGS = $(MATH_FLAG)
1036 # Add the generated file runtime_sysinfo.go to the runtime package.
1037 extra_go_files_runtime = runtime_sysinfo.go sigtab.go
1038 runtime.lo.dep: $(extra_go_files_runtime)
1040 # Add generated files to the syscall package.
1041 extra_go_files_syscall = \
1045 $(syscall_epoll_file)
1046 syscall.lo.dep: $(extra_go_files_syscall)
1048 # Pass -fgo-compiling-runtime when compiling the runtime package.
1049 runtime_lo_GOCFLAGS = -fgo-c-header=runtime.inc.tmp -fgo-compiling-runtime
1050 runtime_check_GOCFLAGS = -fgo-compiling-runtime
1051 runtime_internal_atomic_lo_GOCFLAGS = -fgo-compiling-runtime
1052 runtime_internal_atomic_lo_check_GOCFLAGS = -fgo-compiling-runtime
1053 runtime_internal_sys_lo_GOCFLAGS = -fgo-compiling-runtime
1054 runtime_internal_sys_lo_check_GOCFLAGS = -fgo-compiling-runtime
1056 # If libffi is supported (the normal case) use the ffi build tag for
1057 # the runtime package.
1059 matchargs_runtime = --tag=libffi
1064 # At least for now, we need -static-libgo for this test, because
1065 # otherwise we can't get the line numbers.
1066 # Also use -fno-inline to get better results from the memory profiler.
1067 runtime_pprof_check_GOCFLAGS = -static-libgo -fno-inline
1069 extra_go_files_runtime_internal_sys = version.go
1070 runtime/internal/sys.lo.dep: $(extra_go_files_runtime_internal_sys)
1072 # FIXME: The following C files may as well move to the runtime
1073 # directory and be treated like other C files.
1075 # Use C code to speed up {bytes,strings}.IndexByte and friends.
1076 bytes/index.lo: go/bytes/indexbyte.c runtime.inc
1078 $(LTCOMPILE) -c -o $@ $(srcdir)/go/bytes/indexbyte.c
1079 strings/index.lo: go/strings/indexbyte.c runtime.inc
1081 $(LTCOMPILE) -c -o $@ $(srcdir)/go/strings/indexbyte.c
1083 # Use a C function with a fixed number of arguments to call a C
1085 log/syslog/syslog_c.lo: go/log/syslog/syslog_c.c runtime.inc
1086 @$(MKDIR_P) log/syslog
1087 $(LTCOMPILE) -c -o $@ $(srcdir)/go/log/syslog/syslog_c.c
1089 # The interface to libffi from the reflect package is written in C.
1090 reflect/makefunc_ffi_c.lo: go/reflect/makefunc_ffi_c.c runtime.inc
1092 $(LTCOMPILE) -c -o $@ $(srcdir)/go/reflect/makefunc_ffi_c.c
1094 # The atomic functions are written in C.
1095 runtime/internal/atomic_c.lo: go/runtime/internal/atomic/atomic.c runtime.inc
1096 @$(MKDIR_P) runtime/internal
1097 $(LTCOMPILE) -c -o $@ $(srcdir)/go/runtime/internal/atomic/atomic.c
1098 sync/atomic_c.lo: go/sync/atomic/atomic.c runtime.inc
1100 $(LTCOMPILE) -c -o $@ $(srcdir)/go/sync/atomic/atomic.c
1102 # A few syscall functions are written in C.
1103 syscall/clone_linux.lo: go/syscall/clone_linux.c runtime.inc
1105 $(LTCOMPILE) -c -o $@ $(srcdir)/go/syscall/clone_linux.c
1106 syscall/errno.lo: go/syscall/errno.c runtime.inc
1108 $(LTCOMPILE) -c -o $@ $(srcdir)/go/syscall/errno.c
1109 syscall/signame.lo: go/syscall/signame.c runtime.inc
1111 $(LTCOMPILE) -c -o $@ $(srcdir)/go/syscall/signame.c
1112 syscall/wait.lo: go/syscall/wait.c runtime.inc
1114 $(LTCOMPILE) -c -o $@ $(srcdir)/go/syscall/wait.c
1116 # Solaris 12 changed the type of fields in struct stat.
1117 # Use a build tag, based on a configure check, to cope.
1119 if HAVE_STAT_TIMESPEC
1120 matchargs_os = --tag=solaristag
1130 # Build golang_org/x/net/route only on BSD systems.
1132 $(eval $(call PACKAGE_template,golang_org/x/net/route))
1134 golang_org_x_net_route_lo = \
1135 golang_org/x/net/route.lo
1136 golang_org_x_net_route_check = \
1137 golang_org/x/net/route/check
1143 # Build golang_org/x/net/lif only on Solaris systems.
1145 $(eval $(call PACKAGE_template,golang_org/x/net/lif))
1147 golang_org_x_net_lif_lo = \
1148 golang_org/x/net/lif.lo
1149 golang_org_x_net_lif_check = \
1150 golang_org/x/net/lif/check
1183 compress/bzip2/check \
1184 compress/flate/check \
1185 compress/gzip/check \
1186 compress/lzw/check \
1187 compress/zlib/check \
1188 container/heap/check \
1189 container/list/check \
1190 container/ring/check \
1192 crypto/cipher/check \
1195 crypto/ecdsa/check \
1196 crypto/elliptic/check \
1203 crypto/sha256/check \
1204 crypto/sha512/check \
1205 crypto/subtle/check \
1208 database/sql/check \
1209 database/sql/driver/check \
1214 debug/plan9obj/check \
1215 encoding/ascii85/check \
1216 encoding/asn1/check \
1217 encoding/base32/check \
1218 encoding/base64/check \
1219 encoding/binary/check \
1220 encoding/csv/check \
1221 encoding/gob/check \
1222 encoding/hex/check \
1223 encoding/json/check \
1224 encoding/pem/check \
1225 encoding/xml/check \
1227 exp/terminal/check \
1228 html/template/check \
1234 go/internal/gcimporter/check \
1235 go/internal/gccgoimporter/check \
1241 golang_org/x/crypto/chacha20poly1305/check \
1242 golang_org/x/crypto/chacha20poly1305/internal/chacha20/check \
1243 golang_org/x/crypto/curve25519/check \
1244 golang_org/x/crypto/poly1305/check \
1245 golang_org/x/net/http2/hpack/check \
1246 golang_org/x/net/idna/check \
1247 golang_org/x/net/lex/httplex/check \
1248 $(golang_org_x_net_lif_check) \
1249 $(golang_org_x_net_route_check) \
1250 hash/adler32/check \
1258 index/suffixarray/check \
1259 internal/pprof/profile/check \
1260 internal/singleflight/check \
1261 internal/trace/check \
1267 mime/multipart/check \
1268 mime/quotedprintable/check \
1270 net/http/cgi/check \
1271 net/http/cookiejar/check \
1272 net/http/fcgi/check \
1273 net/http/httptest/check \
1274 net/http/httptrace/check \
1275 net/http/httputil/check \
1276 net/http/internal/check \
1277 net/internal/socktest/check \
1281 net/textproto/check \
1283 net/rpc/jsonrpc/check \
1287 path/filepath/check \
1288 regexp/syntax/check \
1289 runtime/debug/check \
1290 runtime/internal/atomic/check \
1291 runtime/internal/sys/check \
1292 runtime/pprof/check \
1293 runtime/pprof/internal/protopprof/check \
1295 text/scanner/check \
1296 text/tabwriter/check \
1297 text/template/check \
1298 text/template/parse/check \
1299 testing/quick/check \
1300 unicode/utf16/check \
1304 check-recursive: check-head
1307 @echo "Test Run By $${USER} on `date`" > libgo.head
1308 @echo "Native configuration is $(host_triplet)" >> libgo.head
1310 @echo " === libgo tests ===" >> libgo.head
1313 check-tail: check-recursive check-multi
1314 @if test "$(USE_DEJAGNU)" = "yes"; then \
1317 lib=`${PWD_COMMAND} | sed -e 's,^.*/\([^/][^/]*\)$$,\1,'`; \
1318 for dir in . $(MULTIDIRS); do \
1319 mv ../$${dir}/$${lib}/libgo.sum ../$${dir}/$${lib}/libgo.sum.sep; \
1320 mv ../$${dir}/$${lib}/libgo.log ../$${dir}/$${lib}/libgo.log.sep; \
1322 mv libgo.head libgo.sum; \
1323 cp libgo.sum libgo.log; \
1324 echo "Schedule of variations:" >> libgo.sum; \
1325 for dir in . $(MULTIDIRS); do \
1326 multidir=../$${dir}/$${lib}; \
1327 multivar=`cat $${multidir}/libgo.var`; \
1328 echo " $${multivar}" >> libgo.sum; \
1330 echo >> libgo.sum; \
1331 pass=0; fail=0; untested=0; \
1332 for dir in . $(MULTIDIRS); do \
1333 multidir=../$${dir}/$${lib}; \
1334 multivar=`cat $${multidir}/libgo.var`; \
1335 echo "Running target $${multivar}" >> libgo.sum; \
1336 echo "Running $(srcdir)/libgo.exp ..." >> libgo.sum; \
1337 cat $${multidir}/libgo.sum.sep >> libgo.sum; \
1338 cat $${multidir}/libgo.log.sep >> libgo.log; \
1339 if test -n "${MULTIDIRS}"; then \
1340 echo " === libgo Summary for $${multivar} ===" >> libgo.sum; \
1341 echo >> libgo.sum; \
1343 p=`grep -c PASS $${multidir}/libgo.sum.sep`; \
1344 pass=`expr $$pass + $$p`; \
1345 if test "$$p" -ne "0" && test -n "${MULTIDIRS}"; then \
1346 echo "# of expected passes $$p" >> libgo.sum; \
1348 p=`grep -c FAIL $${multidir}/libgo.sum.sep`; \
1349 fail=`expr $$fail + $$p`; \
1350 if test "$$p" -ne "0" && test -n "${MULTIDIRS}"; then \
1351 echo "# of unexpected failures $$p" >> libgo.sum; \
1353 p=`grep -c UNTESTED $${multidir}/libgo.sum.sep`; \
1354 untested=`expr $$untested + $$p`; \
1355 if test "$$p" -ne "0" && test -n "${MULTIDIRS}"; then \
1356 echo "# of untested testcases $$p" >> libgo.sum; \
1359 echo >> libgo.sum; \
1360 echo " === libgo Summary ===" >> libgo.sum; \
1361 echo >> libgo.sum; \
1362 if test "$$pass" -ne "0"; then \
1363 echo "# of expected passes $$pass" >> libgo.sum; \
1365 if test "$$fail" -ne "0"; then \
1366 echo "# of unexpected failures $$fail" >> libgo.sum; \
1368 if test "$$untested" -ne "0"; then \
1369 echo "# of untested testcases $$untested" >> libgo.sum; \
1371 echo `echo $(GOC) | sed -e 's/ .*//'` `$(GOC) -v 2>&1 | grep " version" | sed -n -e 's/.* \(version.*$$\)/\1/p'` >> libgo.sum; \
1372 echo >> libgo.log; \
1373 echo "runtest completed at `date`" >> libgo.log; \
1374 if test "$$fail" -ne "0"; then \
1382 @rm -f libgo.sum libgo.log libgo.tail
1384 [ -z "$(MULTIFLAGS)" ] || multivar="$${multivar}/$(MULTIFLAGS)"; \
1385 echo "$${multivar}" > libgo.var
1386 @for f in $(TEST_PACKAGES); do \
1387 rm -f $$f-testsum $$f-testlog; \
1389 -@$(MAKE) -k $(TEST_PACKAGES)
1390 @for f in $(TEST_PACKAGES); do \
1391 if test -f $$f-testsum; then \
1392 cat $$f-testsum >> libgo.sum; \
1394 if test -f $$f-testlog; then \
1395 cat $$f-testlog >> libgo.log; \
1400 $(MULTIDO) $(AM_MAKEFLAGS) DO=check-am multi-do # $(MAKE)
1403 -@$(MAKE) -k $(TEST_PACKAGES) GOBENCH=.
1405 MOSTLYCLEAN_FILES = libgo.head libgo.sum.sep libgo.log.sep
1408 find . -name '*.lo' -print | xargs $(LIBTOOL) --mode=clean rm -f
1409 find . -name '*.$(OBJEXT)' -print | xargs rm -f
1410 find . -name '*-testsum' -print | xargs rm -f
1411 find . -name '*-testlog' -print | xargs rm -f
1413 CLEANFILES = *.go *.gox goc2c *.c s-version libgo.sum libgo.log
1416 find . -name '*.la' -print | xargs $(LIBTOOL) --mode=clean rm -f
1417 find . -name '*.a' -print | xargs rm -f