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) $(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 toolexeclibgoolddir = $(toolexeclibgodir)/old
330 toolexeclibgoold_DATA = \
334 toolexeclibgoosdir = $(toolexeclibgodir)/os
336 toolexeclibgoos_DATA = \
341 toolexeclibgopathdir = $(toolexeclibgodir)/path
343 toolexeclibgopath_DATA = \
346 toolexeclibgoregexpdir = $(toolexeclibgodir)/regexp
348 toolexeclibgoregexp_DATA = \
351 toolexeclibgoruntimedir = $(toolexeclibgodir)/runtime
353 toolexeclibgoruntime_DATA = \
357 toolexeclibgosyncdir = $(toolexeclibgodir)/sync
359 toolexeclibgosync_DATA = \
362 toolexeclibgotestingdir = $(toolexeclibgodir)/testing
364 toolexeclibgotesting_DATA = \
368 toolexeclibgotextdir = $(toolexeclibgodir)/text
370 toolexeclibgotext_DATA = \
375 toolexeclibgotexttemplatedir = $(toolexeclibgotextdir)/template
377 toolexeclibgotexttemplate_DATA = \
378 text/template/parse.gox
380 toolexeclibgounicodedir = $(toolexeclibgodir)/unicode
382 toolexeclibgounicode_DATA = \
387 runtime_mem_file = runtime/mem.c
389 runtime_mem_file = runtime/mem_posix_memalign.c
393 rtems_task_variable_add_file = runtime/rtems-task-variable-add.c
395 rtems_task_variable_add_file =
399 runtime_thread_files = runtime/thread-linux.c
401 runtime_thread_files = runtime/thread-sema.c
405 runtime_getncpu_file = runtime/getncpu-linux.c
408 runtime_getncpu_file = runtime/getncpu-bsd.c
411 runtime_getncpu_file = runtime/getncpu-irix.c
414 runtime_getncpu_file = runtime/getncpu-solaris.c
417 runtime_getncpu_file = runtime/getncpu-bsd.c
420 runtime_getncpu_file = runtime/getncpu-bsd.c
422 runtime_getncpu_file = runtime/getncpu-none.c
431 runtime/go-assert.c \
432 runtime/go-breakpoint.c \
433 runtime/go-caller.c \
434 runtime/go-callers.c \
437 runtime/go-construct-map.c \
439 runtime/go-deferred-recover.c \
441 runtime/go-fieldtrack.c \
442 runtime/go-matherr.c \
443 runtime/go-memclr.c \
444 runtime/go-memcmp.c \
445 runtime/go-memequal.c \
446 runtime/go-memmove.c \
447 runtime/go-nanotime.c \
452 runtime/go-recover.c \
453 runtime/go-reflect-call.c \
454 runtime/go-runtime-error.c \
455 runtime/go-setenv.c \
456 runtime/go-signal.c \
457 runtime/go-strslice.c \
458 runtime/go-type-complex.c \
459 runtime/go-type-float.c \
460 runtime/go-type-identity.c \
461 runtime/go-type-string.c \
462 runtime/go-typedesc-equal.c \
463 runtime/go-unsafe-new.c \
464 runtime/go-unsafe-newarray.c \
465 runtime/go-unsafe-pointer.c \
466 runtime/go-unsetenv.c \
467 runtime/go-unwind.c \
468 runtime/go-varargs.c \
469 runtime/env_posix.c \
473 $(runtime_mem_file) \
474 runtime/mfixalloc.c \
482 runtime/runtime_c.c \
483 runtime/signal_unix.c \
485 $(runtime_thread_files) \
487 $(rtems_task_variable_add_file) \
491 $(runtime_getncpu_file)
493 goc2c.$(OBJEXT): runtime/goc2c.c
494 $(CC_FOR_BUILD) -c $(CFLAGS_FOR_BUILD) $<
496 goc2c: goc2c.$(OBJEXT)
497 $(CC_FOR_BUILD) $(CFLAGS_FOR_BUILD) $(LDFLAGS_FOR_BUILD) -o $@ $<
499 malloc.c: $(srcdir)/runtime/malloc.goc goc2c
503 runtime1.c: $(srcdir)/runtime/runtime1.goc goc2c
507 sigqueue.c: $(srcdir)/runtime/sigqueue.goc goc2c
508 ./goc2c --go-pkgpath os_signal $< > $@.tmp
511 %.c: $(srcdir)/runtime/%.goc goc2c
515 version.go: s-version; @true
518 echo "package sys" > version.go.tmp
519 echo 'const DefaultGoroot = "$(prefix)"' >> version.go.tmp
520 echo 'const TheVersion = "'`cat $(srcdir)/VERSION | sed 1q`' '`$(GOC) --version | sed 1q`'"' >> version.go.tmp
521 echo 'const GOARCH = "'$(GOARCH)'"' >> version.go.tmp
522 echo 'const GOOS = "'$(GOOS)'"' >> version.go.tmp
523 echo 'const GccgoToolDir = "$(libexecsubdir)"' >> version.go.tmp
524 echo >> version.go.tmp
525 echo "type ArchFamilyType int" >> version.go.tmp
526 echo >> version.go.tmp
527 echo "const (" >> version.go.tmp
528 echo " UNKNOWN ArchFamilyType = iota" >> version.go.tmp
529 for a in $(ALLGOARCHFAMILY); do \
530 echo " $${a}" >> version.go.tmp; \
532 echo ")" >> version.go.tmp
533 echo >> version.go.tmp
534 for a in $(ALLGOARCH); do \
535 f=`echo $${a} | sed -e 's/\(.\).*/\1/' -e 'y/abcdefghijklmnopqrstuvwxyz/ABCDEFGHIJKLMNOPQRSTUVWXYZ/'`; \
536 n="$${f}`echo $${a} | sed -e 's/.//'`"; \
537 if test "$${a}" = "$(GOARCH)"; then \
538 echo "const Goarch$${n} = 1" >> version.go.tmp; \
540 echo "const Goarch$${n} = 0" >> version.go.tmp; \
543 echo >> version.go.tmp
544 echo "const (" >> version.go.tmp
545 echo " ArchFamily = $(GOARCH_FAMILY)" >> version.go.tmp
546 echo " BigEndian = $(GOARCH_BIGENDIAN)" >> version.go.tmp
547 echo " CacheLineSize = $(GOARCH_CACHELINESIZE)" >> version.go.tmp
548 echo " PhysPageSize = $(GOARCH_PHYSPAGESIZE)" >> version.go.tmp
549 echo " PCQuantum = $(GOARCH_PCQUANTUM)" >> version.go.tmp
550 echo " Int64Align = $(GOARCH_INT64ALIGN)" >> version.go.tmp
551 echo " HugePageSize = $(GOARCH_HUGEPAGESIZE)" >> version.go.tmp
552 echo " MinFrameSize = $(GOARCH_MINFRAMESIZE)" >> version.go.tmp
553 echo ")" >> version.go.tmp
554 echo >> version.go.tmp
555 for a in $(ALLGOOS); do \
556 f=`echo $${a} | sed -e 's/\(.\).*/\1/' -e 'y/abcdefghijklmnopqrstuvwxyz/ABCDEFGHIJKLMNOPQRSTUVWXYZ/'`; \
557 n="$${f}`echo $${a} | sed -e 's/.//'`"; \
558 if test "$${a}" = "$(GOOS)"; then \
559 echo "const Goos$${n} = 1" >> version.go.tmp; \
561 echo "const Goos$${n} = 0" >> version.go.tmp; \
564 echo >> version.go.tmp
565 echo "type Uintreg uintptr" >> version.go.tmp
566 $(SHELL) $(srcdir)/mvifdiff.sh version.go.tmp version.go
569 runtime_sysinfo.go: s-runtime_sysinfo; @true
570 s-runtime_sysinfo: $(srcdir)/mkrsysinfo.sh gen-sysinfo.go
571 $(SHELL) $(srcdir)/mkrsysinfo.sh
572 $(SHELL) $(srcdir)/mvifdiff.sh tmp-runtime_sysinfo.go runtime_sysinfo.go
575 runtime.inc: s-runtime-inc; @true
576 s-runtime-inc: runtime.lo Makefile
577 rm -f runtime.inc.tmp2
578 grep -v "#define _" runtime.inc.tmp | grep -v "#define c[01] " > runtime.inc.tmp2
579 for pattern in '_[GP][a-z]' _Max _Lock _Sig _Trace _MHeap _Num; do \
580 grep "#define $$pattern" runtime.inc.tmp >> runtime.inc.tmp2; \
582 $(SHELL) $(srcdir)/mvifdiff.sh runtime.inc.tmp2 runtime.inc
585 noinst_DATA = zstdpkglist.go
587 # Generate the list of go std packages that were included in libgo
588 zstdpkglist.go: s-zstdpkglist; @true
589 s-zstdpkglist: Makefile
590 rm -f zstdpkglist.go.tmp
591 echo 'package main' > zstdpkglist.go.tmp
592 echo "" >> zstdpkglist.go.tmp
593 echo 'var stdpkg = map[string]bool{' >> zstdpkglist.go.tmp
594 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
595 echo '}' >> zstdpkglist.go.tmp
596 $(SHELL) $(srcdir)/mvifdiff.sh zstdpkglist.go.tmp zstdpkglist.go
600 syscall_epoll_file = epoll.go
605 libcalls.go: s-libcalls; @true
606 s-libcalls: libcalls-list go/syscall/mksyscall.awk $(srcdir)/go/syscall/*.go
607 rm -f libcalls.go.tmp
608 $(AWK) -f $(srcdir)/go/syscall/mksyscall.awk `cat libcalls-list` > libcalls.go.tmp
609 $(SHELL) $(srcdir)/mvifdiff.sh libcalls.go.tmp libcalls.go
612 libcalls-list: s-libcalls-list; @true
613 s-libcalls-list: Makefile $(srcdir)/go/syscall/*.go
614 rm -f libcalls-list.tmp
615 $(SHELL) $(srcdir)/match.sh --goarch=$(GOARCH) --goos=$(GOOS) --srcdir=$(srcdir)/go/syscall $(matchargs_syscall) > libcalls-list.tmp
616 $(SHELL) $(srcdir)/mvifdiff.sh libcalls-list.tmp libcalls-list
619 syscall_arch.go: s-syscall_arch; @true
620 s-syscall_arch: Makefile
621 rm -f syscall_arch.go.tmp
622 echo "package syscall" > syscall_arch.go.tmp
623 echo 'const ARCH = "'$(GOARCH)'"' >> syscall_arch.go.tmp
624 echo 'const OS = "'$(GOOS)'"' >> syscall_arch.go.tmp
625 $(SHELL) $(srcdir)/mvifdiff.sh syscall_arch.go.tmp syscall_arch.go
629 $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \
630 $(CPPFLAGS) $(OSCFLAGS) -O
632 gen-sysinfo.go: s-gen-sysinfo; @true
633 s-gen-sysinfo: $(srcdir)/sysinfo.c config.h
634 $(CC) $(SYSINFO_FLAGS) -fdump-go-spec=tmp-gen-sysinfo.go -std=gnu99 -S -o sysinfo.s $(srcdir)/sysinfo.c
636 $(SHELL) $(srcdir)/mvifdiff.sh tmp-gen-sysinfo.go gen-sysinfo.go
639 errno.i: s-errno; @true
641 echo '#include <errno.h>' | $(CC) $(SYSINFO_FLAGS) -x c - -E -dM > tmp-errno.i
642 $(SHELL) $(srcdir)/mvifdiff.sh tmp-errno.i errno.i
645 sysinfo.go: s-sysinfo; @true
646 s-sysinfo: $(srcdir)/mksysinfo.sh gen-sysinfo.go errno.i
647 $(SHELL) $(srcdir)/mksysinfo.sh
648 $(SHELL) $(srcdir)/mvifdiff.sh tmp-sysinfo.go sysinfo.go
651 # The epoll struct has an embedded union and is packed on x86_64,
652 # which is too complicated for mksysinfo.sh. We find the offset of
653 # the only field we care about in configure.ac, and generate the
655 epoll.go: s-epoll; @true
658 echo 'package syscall' > epoll.go.tmp
659 echo 'type EpollEvent struct {' >> epoll.go.tmp
660 echo ' Events uint32' >> epoll.go.tmp
661 case "$(SIZEOF_STRUCT_EPOLL_EVENT),$(STRUCT_EPOLL_EVENT_FD_OFFSET)" in \
662 0,0) echo 1>&2 "*** struct epoll_event data.fd offset unknown"; \
664 8,4) echo ' Fd int32' >> epoll.go.tmp; ;; \
665 12,4) echo ' Fd int32' >> epoll.go.tmp; \
666 echo ' Pad [4]byte' >> epoll.go.tmp; ;; \
667 12,8) echo ' Pad [4]byte' >> epoll.go.tmp; \
668 echo ' Fd int32' >> epoll.go.tmp; ;; \
669 16,8) echo ' Pad [4]byte' >> epoll.go.tmp; \
670 echo ' Fd int32' >> epoll.go.tmp; \
671 echo ' Pad2 [4]byte' >> epoll.go.tmp; ;; \
672 *) echo 1>&2 "*** struct epoll_event unsupported"; \
675 echo '}' >> epoll.go.tmp
676 $(SHELL) $(srcdir)/mvifdiff.sh epoll.go.tmp epoll.go
680 syscall_lib_clone_lo = syscall/clone_linux.lo
682 syscall_lib_clone_lo =
719 database/sql/driver \
750 go/internal/gccgoimporter \
751 go/internal/gcimporter \
757 golang_org/x/net/http2/hpack \
758 golang_org/x/net/lex/httplex \
768 image/color/palette \
771 image/internal/imageutil \
777 internal/singleflight \
778 internal/syscall/unix \
791 mime/quotedprintable \
802 net/internal/socktest \
822 runtime/internal/atomic \
823 runtime/internal/sys \
837 text/template/parse \
844 $(addsuffix .lo,$(PACKAGES)) \
846 reflect/makefunc_ffi_c.lo \
848 $(syscall_lib_clone_lo) \
852 $(golang_org_x_net_route_lo) \
853 log/syslog/syslog_c.lo \
854 $(os_lib_inotify_lo) \
855 runtime/internal/atomic_c.lo \
859 -version-info $(libtool_VERSION) $(PTHREAD_CFLAGS) $(AM_LDFLAGS)
862 $(libgo_go_objs) ../libbacktrace/libbacktrace.la \
863 $(LIBATOMIC) $(LIBFFI) $(PTHREAD_LIBS) $(MATH_LIBS) $(NET_LIBS)
865 libgo_la_SOURCES = $(runtime_files)
866 libgo_la_LDFLAGS = $(libgo_ldflags)
867 libgo_la_LIBADD = $(libgo_libadd)
869 libgo_llgo_la_SOURCES = $(runtime_files)
870 libgo_llgo_la_LDFLAGS = $(libgo_ldflags)
871 libgo_llgo_la_LIBADD = $(libgo_libadd)
873 libgobegin_a_SOURCES = \
876 libgobegin_llgo_a_SOURCES = \
879 # Use -fPIC for libgobegin so that it can be put in a PIE.
880 libgobegin_a_CFLAGS = $(AM_CFLAGS) -fPIC
881 libgobegin_llgo_a_CFLAGS = $(AM_CFLAGS) -fPIC
883 libgolibbegin_a_SOURCES = \
886 libgolibbegin_a_CFLAGS = $(AM_CFLAGS) -fPIC
888 # Make sure runtime.inc is built before compiling any .c file.
889 $(libgo_la_OBJECTS): runtime.inc
890 $(libgo_llgo_la_OBJECTS): runtime.inc
891 $(libgobegin_a_OBJECTS): runtime.inc
892 $(libgobegin_llgo_a_OBJECTS): runtime.inc
893 $(libgolibbegin_a_OBJECTS): runtime.inc
895 LTLDFLAGS = $(shell $(SHELL) $(top_srcdir)/../libtool-ldflags $(LDFLAGS))
898 AM_GOCFLAGS = $(STRINGOPS_FLAG) $(GO_SPLIT_STACK)
899 GOCOMPILE = $(GOC) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_GOCFLAGS) $(GOCFLAGS)
901 LTGOCOMPILE = $(LIBTOOL) --tag GO --mode=compile $(GOC) $(INCLUDES) \
902 $(AM_GOCFLAGS) $(GOCFLAGS)
904 GOLINK = $(LIBTOOL) --tag GO --mode-link $(GOC) \
905 $(OPT_LDFLAGS) $(SECTION_LDFLAGS) $(AM_GOCFLAGS) $(LTLDFLAGS) -o $@
907 # Build the dependencies for a Go package.
910 dir=`echo $@ | sed -e 's/.lo.dep$$//'`; \
911 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,,$@)))`; \
912 $(SHELL) $(srcdir)/godeps.sh `echo $@ | sed -e 's/.dep$$//'` $$files > $@.tmp; \
913 if ! cmp $@.tmp $@ >/dev/null 2>/dev/null; then \
914 rm -f `echo $@ | sed -e 's/\.dep$$//'`; \
918 # Build the .go files for a package, generating a .lo file.
921 files=`echo $^ | sed -e 's/[^ ]*\.gox//g' -e 's/[^ ]*\.dep//'`; \
922 $(LTGOCOMPILE) -I . -c -fgo-pkgpath=`echo $@ | sed -e 's/.lo$$//'` $($(subst -,_,$(subst .,_,$(subst /,_,$@)))_GOCFLAGS) -o $@ $$files
924 # How to build a .gox file from a .lo file.
926 f=`echo $< | sed -e 's/.lo$$/.o/'`; \
927 $(OBJCOPY) -j .go_export $$f $@.tmp; \
928 $(SHELL) $(srcdir)/mvifdiff.sh $@.tmp `echo $@ | sed -e 's/s-gox/gox/'`
935 GC="$(GOC) $(GOCFLAGS) $($(subst /,_,$@)_GOCFLAGS) -L `${PWD_COMMAND}` -L `${PWD_COMMAND}`/.libs"; \
937 GOLIBS="$(MATH_LIBS) $(NET_LIBS) $(LIBS)"; \
939 RUNTESTFLAGS="$(RUNTESTFLAGS)"; \
940 export RUNTESTFLAGS; \
943 libgccdir=`${GOC} -print-libgcc-file-name | sed -e 's|/[^/]*$$||'`; \
944 LD_LIBRARY_PATH="`${PWD_COMMAND}`/.libs:$${libgccdir}:${LD_LIBRARY_PATH}"; \
945 LD_LIBRARY_PATH=`echo $${LD_LIBRARY_PATH} | sed 's,::*,:,g;s,^:*,,;s,:*$$,,'`; \
946 export LD_LIBRARY_PATH; \
948 rm -f $@-testsum $@-testlog; \
949 files=`$(SHELL) $(srcdir)/match.sh --goarch=$(GOARCH) --goos=$(GOOS) --srcdir=$(srcdir)/go/$(@D) --extrafiles="$(extra_go_files_$(subst /,_,$(@D)))" $(matchargs_$(subst /,_,$(@D)))`; \
950 if test "$(USE_DEJAGNU)" = "yes"; then \
951 $(SHELL) $(srcdir)/testsuite/gotest --goarch=$(GOARCH) --goos=$(GOOS) --dejagnu=yes --basedir=$(srcdir) --srcdir=$(srcdir)/go/$(@D) --pkgpath="$(@D)" --pkgfiles="$$files" --testname="$(@D)" $(GOTESTFLAGS); \
952 elif test "$(GOBENCH)" != ""; then \
953 $(SHELL) $(srcdir)/testsuite/gotest --goarch=$(GOARCH) --goos=$(GOOS) --basedir=$(srcdir) --srcdir=$(srcdir)/go/$(@D) --pkgpath="$(@D)" --pkgfiles="$$files" --bench="$(GOBENCH)" $(GOTESTFLAGS); \
955 if $(SHELL) $(srcdir)/testsuite/gotest --goarch=$(GOARCH) --goos=$(GOOS) --basedir=$(srcdir) --srcdir=$(srcdir)/go/$(@D) --pkgpath="$(@D)" --pkgfiles="$$files" $(GOTESTFLAGS) >>$@-testlog 2>&1; then \
956 echo "PASS: $(@D)" >> $@-testlog; \
957 echo "PASS: $(@D)"; \
958 echo "PASS: $(@D)" > $@-testsum; \
960 echo "FAIL: $(@D)" >> $@-testlog; \
962 echo "FAIL: $(@D)" > $@-testsum; \
967 # Build all packages before checking any.
969 $(toolexeclibgo_DATA) \
970 $(toolexeclibgoarchive_DATA) \
971 $(toolexeclibgocompress_DATA) \
972 $(toolexeclibgocontainer_DATA) \
973 $(toolexeclibgocrypto_DATA) \
974 $(toolexeclibgodebug_DATA) \
975 $(toolexeclibgoencoding_DATA) \
976 $(toolexeclibgoexp_DATA) \
977 $(toolexeclibgogo_DATA) \
978 $(toolexeclibgohash_DATA) \
979 $(toolexeclibgoimage_DATA) \
980 $(toolexeclibgoindex_DATA) \
981 $(toolexeclibgoio_DATA) \
982 $(toolexeclibgolog_DATA) \
983 $(toolexeclibgomath_DATA) \
984 $(toolexeclibgomime_DATA) \
985 $(toolexeclibgonet_DATA) \
986 $(toolexeclibgonethttp_DATA) \
987 $(toolexeclibgoos_DATA) \
988 $(toolexeclibgopath_DATA) \
989 $(toolexeclibgorpc_DATA) \
990 $(toolexeclibgoruntime_DATA) \
991 $(toolexeclibgosync_DATA) \
992 $(toolexeclibgotesting_DATA) \
993 $(toolexeclibgotext_DATA) \
994 $(toolexeclibgotexttemplate_DATA) \
995 $(toolexeclibgounicode_DATA)
998 CHECK_DEPS += libgo-llgo.la libgobegin-llgo.a
1000 CHECK_DEPS += libgo.la libgobegin.a
1003 # PACKAGE_template defines the rules for each package.
1004 # For example, for the package bufio, it produces:
1006 # @go_include@ bufio.lo.dep
1007 # bufio.lo.dep: $(srcdir)/go/bufio/*.go
1011 # bufio/check: $(CHECK_DEPS)
1013 # .PHONY: bufio/check
1015 # This is invoked with $(1) set to a package, which is a directory name,
1016 # such as "bufio" or "archive/tar".
1017 define PACKAGE_template
1018 @go_include@ $(1).lo.dep
1019 $(1).lo.dep: $(srcdir)/go/$(1)/*.go
1023 $(1)/check: $$(CHECK_DEPS)
1026 $(1).gox: $(1).s-gox; @true
1032 # This line expands PACKAGE_template once for each package name listed
1034 $(foreach package,$(PACKAGES),$(eval $(call PACKAGE_template,$(package))))
1036 # Pass -ffp-contract=off, or 386-specific options, when building the
1037 # math package. MATH_FLAG is defined in configure.ac.
1038 math_lo_GOCFLAGS = $(MATH_FLAG)
1040 # Add the generated file runtime_sysinfo.go to the runtime package.
1041 extra_go_files_runtime = runtime_sysinfo.go
1042 runtime.lo.dep: $(extra_go_files_runtime)
1044 # Add generated files to the syscall package.
1045 extra_go_files_syscall = \
1049 $(syscall_epoll_file)
1050 syscall.lo.dep: $(extra_go_files_syscall)
1052 # Pass -fgo-compiling-runtime when compiling the runtime package.
1053 runtime_lo_GOCFLAGS = -fgo-c-header=runtime.inc.tmp -fgo-compiling-runtime
1054 runtime_check_GOCFLAGS = -fgo-compiling-runtime
1055 runtime_internal_atomic_lo_GOCFLAGS = -fgo-compiling-runtime
1056 runtime_internal_atomic_lo_check_GOCFLAGS = -fgo-compiling-runtime
1057 runtime_internal_sys_lo_GOCFLAGS = -fgo-compiling-runtime
1058 runtime_internal_sys_lo_check_GOCFLAGS = -fgo-compiling-runtime
1060 # At least for now, we need -static-libgo for this test, because
1061 # otherwise we can't get the line numbers.
1062 # Also use -fno-inline to get better results from the memory profiler.
1063 runtime_pprof_check_GOCFLAGS = -static-libgo -fno-inline
1065 extra_go_files_runtime_internal_sys = version.go
1066 runtime/internal/sys.lo.dep: $(extra_go_files_runtime_internal_sys)
1068 # FIXME: The following C files may as well move to the runtime
1069 # directory and be treated like other C files.
1071 # Use C code to speed up {bytes,strings}.IndexByte and friends.
1072 bytes/index.lo: go/bytes/indexbyte.c runtime.inc
1074 $(LTCOMPILE) -c -o $@ $(srcdir)/go/bytes/indexbyte.c
1075 strings/index.lo: go/strings/indexbyte.c runtime.inc
1077 $(LTCOMPILE) -c -o $@ $(srcdir)/go/strings/indexbyte.c
1079 # Use a C function with a fixed number of arguments to call a C
1081 log/syslog/syslog_c.lo: go/log/syslog/syslog_c.c runtime.inc
1082 @$(MKDIR_P) log/syslog
1083 $(LTCOMPILE) -c -o $@ $(srcdir)/go/log/syslog/syslog_c.c
1085 # The interface to libffi from the reflect package is written in C.
1086 reflect/makefunc_ffi_c.lo: go/reflect/makefunc_ffi_c.c runtime.inc
1088 $(LTCOMPILE) -c -o $@ $(srcdir)/go/reflect/makefunc_ffi_c.c
1090 # The atomic functions are written in C.
1091 runtime/internal/atomic_c.lo: go/runtime/internal/atomic/atomic.c runtime.inc
1092 @$(MKDIR_P) runtime/internal
1093 $(LTCOMPILE) -c -o $@ $(srcdir)/go/runtime/internal/atomic/atomic.c
1094 sync/atomic_c.lo: go/sync/atomic/atomic.c runtime.inc
1096 $(LTCOMPILE) -c -o $@ $(srcdir)/go/sync/atomic/atomic.c
1098 # A few syscall functions are written in C.
1099 syscall/clone_linux.lo: go/syscall/clone_linux.c runtime.inc
1101 $(LTCOMPILE) -c -o $@ $(srcdir)/go/syscall/clone_linux.c
1102 syscall/errno.lo: go/syscall/errno.c runtime.inc
1104 $(LTCOMPILE) -c -o $@ $(srcdir)/go/syscall/errno.c
1105 syscall/signame.lo: go/syscall/signame.c runtime.inc
1107 $(LTCOMPILE) -c -o $@ $(srcdir)/go/syscall/signame.c
1108 syscall/wait.lo: go/syscall/wait.c runtime.inc
1110 $(LTCOMPILE) -c -o $@ $(srcdir)/go/syscall/wait.c
1112 # Solaris 12 changed the type of fields in struct stat.
1113 # Use a build tag, based on a configure check, to cope.
1115 if HAVE_STAT_TIMESPEC
1116 matchargs_os = --tag=solaristag
1126 # Build golang_org/x/net/route only on BSD systems.
1128 $(eval $(call PACKAGE_template,golang_org/x/net/route)
1130 golang_org_x_net_route_lo = \
1131 golang_org/x/net/route/route.lo
1132 golang_org_x_net_route_check = \
1133 golang_org/x/net/route/check
1166 compress/bzip2/check \
1167 compress/flate/check \
1168 compress/gzip/check \
1169 compress/lzw/check \
1170 compress/zlib/check \
1171 container/heap/check \
1172 container/list/check \
1173 container/ring/check \
1175 crypto/cipher/check \
1178 crypto/ecdsa/check \
1179 crypto/elliptic/check \
1186 crypto/sha256/check \
1187 crypto/sha512/check \
1188 crypto/subtle/check \
1191 database/sql/check \
1192 database/sql/driver/check \
1197 debug/plan9obj/check \
1198 encoding/ascii85/check \
1199 encoding/asn1/check \
1200 encoding/base32/check \
1201 encoding/base64/check \
1202 encoding/binary/check \
1203 encoding/csv/check \
1204 encoding/gob/check \
1205 encoding/hex/check \
1206 encoding/json/check \
1207 encoding/pem/check \
1208 encoding/xml/check \
1210 exp/terminal/check \
1211 html/template/check \
1217 go/internal/gcimporter/check \
1218 go/internal/gccgoimporter/check \
1224 golang_org/x/net/http2/hpack/check \
1225 golang_org/x/net/lex/httplex/check \
1226 $(golang_org_x_net_route_check) \
1227 hash/adler32/check \
1235 index/suffixarray/check \
1236 internal/singleflight/check \
1237 internal/trace/check \
1243 mime/multipart/check \
1244 mime/quotedprintable/check \
1246 net/http/cgi/check \
1247 net/http/cookiejar/check \
1248 net/http/fcgi/check \
1249 net/http/httptest/check \
1250 net/http/httptrace/check \
1251 net/http/httputil/check \
1252 net/http/internal/check \
1253 net/internal/socktest/check \
1257 net/textproto/check \
1259 net/rpc/jsonrpc/check \
1261 old/template/check \
1265 path/filepath/check \
1266 regexp/syntax/check \
1267 runtime/debug/check \
1268 runtime/pprof/check \
1269 runtime/internal/atomic/check \
1270 runtime/internal/sys/check \
1272 text/scanner/check \
1273 text/tabwriter/check \
1274 text/template/check \
1275 text/template/parse/check \
1276 testing/quick/check \
1277 unicode/utf16/check \
1281 check-recursive: check-head
1284 @echo "Test Run By $${USER} on `date`" > libgo.head
1285 @echo "Native configuration is $(host_triplet)" >> libgo.head
1287 @echo " === libgo tests ===" >> libgo.head
1290 check-tail: check-recursive check-multi
1291 @if test "$(USE_DEJAGNU)" = "yes"; then \
1294 lib=`${PWD_COMMAND} | sed -e 's,^.*/\([^/][^/]*\)$$,\1,'`; \
1295 for dir in . $(MULTIDIRS); do \
1296 mv ../$${dir}/$${lib}/libgo.sum ../$${dir}/$${lib}/libgo.sum.sep; \
1297 mv ../$${dir}/$${lib}/libgo.log ../$${dir}/$${lib}/libgo.log.sep; \
1299 mv libgo.head libgo.sum; \
1300 cp libgo.sum libgo.log; \
1301 echo "Schedule of variations:" >> libgo.sum; \
1302 for dir in . $(MULTIDIRS); do \
1303 multidir=../$${dir}/$${lib}; \
1304 multivar=`cat $${multidir}/libgo.var`; \
1305 echo " $${multivar}" >> libgo.sum; \
1307 echo >> libgo.sum; \
1308 pass=0; fail=0; untested=0; \
1309 for dir in . $(MULTIDIRS); do \
1310 multidir=../$${dir}/$${lib}; \
1311 multivar=`cat $${multidir}/libgo.var`; \
1312 echo "Running target $${multivar}" >> libgo.sum; \
1313 echo "Running $(srcdir)/libgo.exp ..." >> libgo.sum; \
1314 cat $${multidir}/libgo.sum.sep >> libgo.sum; \
1315 cat $${multidir}/libgo.log.sep >> libgo.log; \
1316 if test -n "${MULTIDIRS}"; then \
1317 echo " === libgo Summary for $${multivar} ===" >> libgo.sum; \
1318 echo >> libgo.sum; \
1320 p=`grep -c PASS $${multidir}/libgo.sum.sep`; \
1321 pass=`expr $$pass + $$p`; \
1322 if test "$$p" -ne "0" && test -n "${MULTIDIRS}"; then \
1323 echo "# of expected passes $$p" >> libgo.sum; \
1325 p=`grep -c FAIL $${multidir}/libgo.sum.sep`; \
1326 fail=`expr $$fail + $$p`; \
1327 if test "$$p" -ne "0" && test -n "${MULTIDIRS}"; then \
1328 echo "# of unexpected failures $$p" >> libgo.sum; \
1330 p=`grep -c UNTESTED $${multidir}/libgo.sum.sep`; \
1331 untested=`expr $$untested + $$p`; \
1332 if test "$$p" -ne "0" && test -n "${MULTIDIRS}"; then \
1333 echo "# of untested testcases $$p" >> libgo.sum; \
1336 echo >> libgo.sum; \
1337 echo " === libgo Summary ===" >> libgo.sum; \
1338 echo >> libgo.sum; \
1339 if test "$$pass" -ne "0"; then \
1340 echo "# of expected passes $$pass" >> libgo.sum; \
1342 if test "$$fail" -ne "0"; then \
1343 echo "# of unexpected failures $$fail" >> libgo.sum; \
1345 if test "$$untested" -ne "0"; then \
1346 echo "# of untested testcases $$untested" >> libgo.sum; \
1348 echo `echo $(GOC) | sed -e 's/ .*//'` `$(GOC) -v 2>&1 | grep " version" | sed -n -e 's/.* \(version.*$$\)/\1/p'` >> libgo.sum; \
1349 echo >> libgo.log; \
1350 echo "runtest completed at `date`" >> libgo.log; \
1351 if test "$$fail" -ne "0"; then \
1359 @rm -f libgo.sum libgo.log libgo.tail
1361 [ -z "$(MULTIFLAGS)" ] || multivar="$${multivar}/$(MULTIFLAGS)"; \
1362 echo "$${multivar}" > libgo.var
1363 @for f in $(TEST_PACKAGES); do \
1364 rm -f $$f-testsum $$f-testlog; \
1366 -@$(MAKE) -k $(TEST_PACKAGES)
1367 @for f in $(TEST_PACKAGES); do \
1368 if test -f $$f-testsum; then \
1369 cat $$f-testsum >> libgo.sum; \
1371 if test -f $$f-testlog; then \
1372 cat $$f-testlog >> libgo.log; \
1377 $(MULTIDO) $(AM_MAKEFLAGS) DO=check-am multi-do # $(MAKE)
1380 -@$(MAKE) -k $(TEST_PACKAGES) GOBENCH=.
1382 MOSTLYCLEAN_FILES = libgo.head libgo.sum.sep libgo.log.sep
1385 find . -name '*.lo' -print | xargs $(LIBTOOL) --mode=clean rm -f
1386 find . -name '*.$(OBJEXT)' -print | xargs rm -f
1387 find . -name '*-testsum' -print | xargs rm -f
1388 find . -name '*-testlog' -print | xargs rm -f
1390 CLEANFILES = *.go *.gox goc2c *.c s-version libgo.sum libgo.log
1393 find . -name '*.la' -print | xargs $(LIBTOOL) --mode=clean rm -f
1394 find . -name '*.a' -print | xargs rm -f