1# Makefile.am -- Go library Makefile. 2 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. 6 7# Process this file with autoreconf to produce Makefile.in. 8 9# Go support. 10SUFFIXES = .c .go .gox .o .obj .lo .a 11 12if LIBGO_IS_RTEMS 13subdirs = testsuite 14endif 15 16if LIBGO_IS_DARWIN 17GO_EXPORT_SECTION_NAME = __GNU_GO.__go_export 18else 19GO_EXPORT_SECTION_NAME = .go_export 20endif 21 22SUBDIRS = ${subdirs} 23 24gcc_version := $(shell $(GOC) -dumpversion) 25 26MAINT_CHARSET = latin1 27 28mkinstalldirs = $(SHELL) $(toplevel_srcdir)/mkinstalldirs 29PWD_COMMAND = $${PWDCMD-pwd} 30STAMP = echo timestamp > 31 32toolexecdir = $(glibgo_toolexecdir) 33toolexeclibdir = $(glibgo_toolexeclibdir) 34toolexeclibgodir = $(nover_glibgo_toolexeclibdir)/go/$(gcc_version)/$(target_alias) 35libexecsubdir = $(libexecdir)/gcc/$(target_alias)/$(gcc_version) 36 37LIBFFI = @LIBFFI@ 38LIBFFIINCS = @LIBFFIINCS@ 39 40LIBATOMIC = @LIBATOMIC@ 41 42WARN_CFLAGS = $(WARN_FLAGS) $(WERROR) 43 44# -I/-D flags to pass when compiling. 45AM_CPPFLAGS = -I $(srcdir)/runtime $(LIBFFIINCS) $(PTHREAD_CFLAGS) 46 47ACLOCAL_AMFLAGS = -I ./config -I ../config 48 49AM_CFLAGS = -fexceptions -fnon-call-exceptions \ 50 $(SPLIT_STACK) $(WARN_CFLAGS) \ 51 $(STRINGOPS_FLAG) $(HWCAP_CFLAGS) $(OSCFLAGS) \ 52 -I $(srcdir)/../libgcc -I $(srcdir)/../libbacktrace \ 53 -I $(MULTIBUILDTOP)../../gcc/include 54 55AM_LDFLAGS = 56 57if USING_SPLIT_STACK 58AM_LDFLAGS += -XCClinker $(SPLIT_STACK) 59endif 60 61if LIBGO_IS_AIX 62# Using an import file for libgo avoid requiring to use the -brtl flag 63# when builing a go program 64AM_LDFLAGS += -Wl,-bbigtoc -Wl,-bI:$(srcdir)/libgo.imp 65EXTRA_libgo_la_DEPENDENCIES = libgo.imp 66endif 67 68# Multilib support. 69MAKEOVERRIDES= 70 71# Work around what appears to be a GNU make handling MAKEFLAGS 72# values defined in terms of make variables, as is the case for CC and 73# friends when we are called from the top level Makefile. 74AM_MAKEFLAGS = \ 75 "AR_FLAGS=$(AR_FLAGS)" \ 76 "CC_FOR_BUILD=$(CC_FOR_BUILD)" \ 77 "CC_FOR_TARGET=$(CC_FOR_TARGET)" \ 78 "CFLAGS=$(CFLAGS)" \ 79 "CXXFLAGS=$(CXXFLAGS)" \ 80 "CFLAGS_FOR_BUILD=$(CFLAGS_FOR_BUILD)" \ 81 "CFLAGS_FOR_TARGET=$(CFLAGS_FOR_TARGET)" \ 82 "GOC_FOR_TARGET=$(GOC_FOR_TARGET)" \ 83 "GOC=$(GOC)" \ 84 "GOCFLAGS=$(GOCFLAGS)" \ 85 "INSTALL=$(INSTALL)" \ 86 "INSTALL_DATA=$(INSTALL_DATA)" \ 87 "INSTALL_PROGRAM=$(INSTALL_PROGRAM)" \ 88 "INSTALL_SCRIPT=$(INSTALL_SCRIPT)" \ 89 "LDFLAGS=$(LDFLAGS)" \ 90 "LIBCFLAGS=$(LIBCFLAGS)" \ 91 "LIBCFLAGS_FOR_TARGET=$(LIBCFLAGS_FOR_TARGET)" \ 92 "MAKE=$(MAKE)" \ 93 "MAKEINFO=$(MAKEINFO) $(MAKEINFOFLAGS)" \ 94 "PICFLAG=$(PICFLAG)" \ 95 "PICFLAG_FOR_TARGET=$(PICFLAG_FOR_TARGET)" \ 96 "SHELL=$(SHELL)" \ 97 "RUNTESTFLAGS=$(RUNTESTFLAGS)" \ 98 "exec_prefix=$(exec_prefix)" \ 99 "infodir=$(infodir)" \ 100 "libdir=$(libdir)" \ 101 "includedir=$(includedir)" \ 102 "prefix=$(prefix)" \ 103 "tooldir=$(tooldir)" \ 104 "gxx_include_dir=$(gxx_include_dir)" \ 105 "AR=$(AR)" \ 106 "AS=$(AS)" \ 107 "LD=$(LD)" \ 108 "RANLIB=$(RANLIB)" \ 109 "NM=$(NM)" \ 110 "NM_FOR_BUILD=$(NM_FOR_BUILD)" \ 111 "NM_FOR_TARGET=$(NM_FOR_TARGET)" \ 112 "DESTDIR=$(DESTDIR)" \ 113 "WERROR=$(WERROR)" 114 115# Subdir rules rely on $(FLAGS_TO_PASS) 116FLAGS_TO_PASS = $(AM_MAKEFLAGS) 117 118if GOC_IS_LLGO 119toolexeclib_LTLIBRARIES = libgo-llgo.la 120toolexeclib_LIBRARIES = libgobegin-llgo.a 121else 122toolexeclib_LTLIBRARIES = libgo.la 123toolexeclib_LIBRARIES = libgobegin.a libgolibbegin.a 124endif 125 126noinst_LIBRARIES = libgotool.a 127 128toolexeclibgo_DATA = \ 129 bufio.gox \ 130 bytes.gox \ 131 context.gox \ 132 crypto.gox \ 133 embed.gox \ 134 encoding.gox \ 135 errors.gox \ 136 expvar.gox \ 137 flag.gox \ 138 fmt.gox \ 139 hash.gox \ 140 html.gox \ 141 image.gox \ 142 io.gox \ 143 log.gox \ 144 math.gox \ 145 mime.gox \ 146 net.gox \ 147 os.gox \ 148 path.gox \ 149 reflect.gox \ 150 regexp.gox \ 151 runtime.gox \ 152 sort.gox \ 153 strconv.gox \ 154 strings.gox \ 155 sync.gox \ 156 syscall.gox \ 157 testing.gox \ 158 time.gox \ 159 unicode.gox 160 161toolexeclibgoarchivedir = $(toolexeclibgodir)/archive 162 163toolexeclibgoarchive_DATA = \ 164 archive/tar.gox \ 165 archive/zip.gox 166 167toolexeclibgocompressdir = $(toolexeclibgodir)/compress 168 169toolexeclibgocompress_DATA = \ 170 compress/bzip2.gox \ 171 compress/flate.gox \ 172 compress/gzip.gox \ 173 compress/lzw.gox \ 174 compress/zlib.gox 175 176toolexeclibgocontainerdir = $(toolexeclibgodir)/container 177 178toolexeclibgocontainer_DATA = \ 179 container/heap.gox \ 180 container/list.gox \ 181 container/ring.gox 182 183toolexeclibgocryptodir = $(toolexeclibgodir)/crypto 184 185toolexeclibgocrypto_DATA = \ 186 crypto/aes.gox \ 187 crypto/cipher.gox \ 188 crypto/des.gox \ 189 crypto/dsa.gox \ 190 crypto/ecdsa.gox \ 191 crypto/ed25519.gox \ 192 crypto/elliptic.gox \ 193 crypto/hmac.gox \ 194 crypto/md5.gox \ 195 crypto/rand.gox \ 196 crypto/rc4.gox \ 197 crypto/rsa.gox \ 198 crypto/sha1.gox \ 199 crypto/sha256.gox \ 200 crypto/sha512.gox \ 201 crypto/subtle.gox \ 202 crypto/tls.gox \ 203 crypto/x509.gox 204 205toolexeclibgocryptox509dir = $(toolexeclibgocryptodir)/x509 206 207toolexeclibgocryptox509_DATA = \ 208 crypto/x509/pkix.gox 209 210toolexeclibgodatabasedir = $(toolexeclibgodir)/database 211 212toolexeclibgodatabase_DATA = \ 213 database/sql.gox 214 215toolexeclibgodatabasesqldir = $(toolexeclibgodatabasedir)/sql 216 217toolexeclibgodatabasesql_DATA = \ 218 database/sql/driver.gox 219 220toolexeclibgodebugdir = $(toolexeclibgodir)/debug 221 222toolexeclibgodebug_DATA = \ 223 debug/dwarf.gox \ 224 debug/elf.gox \ 225 debug/gosym.gox \ 226 debug/macho.gox \ 227 debug/pe.gox \ 228 debug/plan9obj.gox 229 230toolexeclibgoencodingdir = $(toolexeclibgodir)/encoding 231 232toolexeclibgoencoding_DATA = \ 233 encoding/ascii85.gox \ 234 encoding/asn1.gox \ 235 encoding/base32.gox \ 236 encoding/base64.gox \ 237 encoding/binary.gox \ 238 encoding/csv.gox \ 239 encoding/gob.gox \ 240 encoding/hex.gox \ 241 encoding/json.gox \ 242 encoding/pem.gox \ 243 encoding/xml.gox 244 245toolexeclibgogodir = $(toolexeclibgodir)/go 246 247toolexeclibgogo_DATA = \ 248 go/ast.gox \ 249 go/build.gox \ 250 go/constant.gox \ 251 go/doc.gox \ 252 go/format.gox \ 253 go/importer.gox \ 254 go/parser.gox \ 255 go/printer.gox \ 256 go/scanner.gox \ 257 go/token.gox \ 258 go/types.gox 259 260toolexeclibgogobuilddir = $(toolexeclibgogodir)/build 261 262toolexeclibgogobuild_DATA = \ 263 go/build/constraint.gox 264 265toolexeclibgohashdir = $(toolexeclibgodir)/hash 266 267toolexeclibgohash_DATA = \ 268 hash/adler32.gox \ 269 hash/crc32.gox \ 270 hash/crc64.gox \ 271 hash/fnv.gox \ 272 hash/maphash.gox 273 274toolexeclibgohtmldir = $(toolexeclibgodir)/html 275 276toolexeclibgohtml_DATA = \ 277 html/template.gox 278 279toolexeclibgoimagedir = $(toolexeclibgodir)/image 280 281toolexeclibgoimage_DATA = \ 282 image/color.gox \ 283 image/draw.gox \ 284 image/gif.gox \ 285 image/jpeg.gox \ 286 image/png.gox 287 288toolexeclibgoimagecolordir = $(toolexeclibgoimagedir)/color 289 290toolexeclibgoimagecolor_DATA = \ 291 image/color/palette.gox 292 293toolexeclibgoindexdir = $(toolexeclibgodir)/index 294 295toolexeclibgoindex_DATA = \ 296 index/suffixarray.gox 297 298toolexeclibgoiodir = $(toolexeclibgodir)/io 299 300toolexeclibgoio_DATA = \ 301 io/fs.gox \ 302 io/ioutil.gox 303 304toolexeclibgologdir = $(toolexeclibgodir)/log 305 306toolexeclibgolog_DATA = \ 307 log/syslog.gox 308 309toolexeclibgomathdir = $(toolexeclibgodir)/math 310 311toolexeclibgomath_DATA = \ 312 math/big.gox \ 313 math/bits.gox \ 314 math/cmplx.gox \ 315 math/rand.gox 316 317toolexeclibgomimedir = $(toolexeclibgodir)/mime 318 319toolexeclibgomime_DATA = \ 320 mime/multipart.gox \ 321 mime/quotedprintable.gox 322 323toolexeclibgonetdir = $(toolexeclibgodir)/net 324 325toolexeclibgonet_DATA = \ 326 net/http.gox \ 327 net/mail.gox \ 328 net/rpc.gox \ 329 net/smtp.gox \ 330 net/textproto.gox \ 331 net/url.gox 332 333toolexeclibgonethttpdir = $(toolexeclibgonetdir)/http 334 335toolexeclibgonethttp_DATA = \ 336 net/http/cgi.gox \ 337 net/http/cookiejar.gox \ 338 net/http/fcgi.gox \ 339 net/http/httptest.gox \ 340 net/http/httptrace.gox \ 341 net/http/httputil.gox \ 342 net/http/pprof.gox 343 344toolexeclibgonetrpcdir = $(toolexeclibgonetdir)/rpc 345 346toolexeclibgonetrpc_DATA = \ 347 net/rpc/jsonrpc.gox 348 349toolexeclibgoosdir = $(toolexeclibgodir)/os 350 351toolexeclibgoos_DATA = \ 352 os/exec.gox \ 353 os/signal.gox \ 354 os/user.gox 355 356toolexeclibgopathdir = $(toolexeclibgodir)/path 357 358toolexeclibgopath_DATA = \ 359 path/filepath.gox 360 361toolexeclibgoregexpdir = $(toolexeclibgodir)/regexp 362 363toolexeclibgoregexp_DATA = \ 364 regexp/syntax.gox 365 366toolexeclibgoruntimedir = $(toolexeclibgodir)/runtime 367 368toolexeclibgoruntime_DATA = \ 369 runtime/cgo.gox \ 370 runtime/debug.gox \ 371 runtime/metrics.gox \ 372 runtime/pprof.gox \ 373 runtime/trace.gox 374 375toolexeclibgosyncdir = $(toolexeclibgodir)/sync 376 377toolexeclibgosync_DATA = \ 378 sync/atomic.gox 379 380toolexeclibgotestingdir = $(toolexeclibgodir)/testing 381 382toolexeclibgotesting_DATA = \ 383 testing/fstest.gox \ 384 testing/iotest.gox \ 385 testing/quick.gox 386 387toolexeclibgotestinginternaldir = $(toolexeclibgotestingdir)/internal 388 389toolexeclibgotestinginternal_DATA = \ 390 testing/internal/testdeps.gox 391 392toolexeclibgotextdir = $(toolexeclibgodir)/text 393 394toolexeclibgotext_DATA = \ 395 text/scanner.gox \ 396 text/tabwriter.gox \ 397 text/template.gox 398 399toolexeclibgotexttemplatedir = $(toolexeclibgotextdir)/template 400 401toolexeclibgotexttemplate_DATA = \ 402 text/template/parse.gox 403 404toolexeclibgotimedir = $(toolexeclibgodir)/time 405 406toolexeclibgotime_DATA = \ 407 time/tzdata.gox 408 409toolexeclibgounicodedir = $(toolexeclibgodir)/unicode 410 411toolexeclibgounicode_DATA = \ 412 unicode/utf16.gox \ 413 unicode/utf8.gox 414 415# Some internal packages are needed to bootstrap the gc toolchain. 416toolexeclibgointernaldir = $(toolexeclibgodir)/internal 417toolexeclibgointernal_DATA = \ 418 internal/reflectlite.gox \ 419 internal/unsafeheader.gox 420 421# Some packages are only needed for tests, so unlike the other 422# internal packages nothing will explicitly depend on them. 423# Force them to be built. 424noinst_DATA = \ 425 golang.org/x/net/nettest.gox \ 426 internal/cfg.gox \ 427 internal/obscuretestdata.gox \ 428 internal/profile.gox \ 429 internal/testenv.gox \ 430 internal/trace.gox \ 431 net/internal/socktest.gox \ 432 os/signal/internal/pty.gox \ 433 reflect/internal/example1.gox \ 434 reflect/internal/example2.gox 435 436if LIBGO_IS_RTEMS 437rtems_task_variable_add_file = runtime/rtems-task-variable-add.c 438else 439rtems_task_variable_add_file = 440endif 441 442runtime_context_asm_file = 443if LIBGO_IS_X86 444if LIBGO_IS_LINUX 445runtime_context_asm_file += runtime/go-context.S 446endif 447endif 448 449runtime_files = \ 450 runtime/aeshash.c \ 451 runtime/go-assert.c \ 452 runtime/go-caller.c \ 453 runtime/go-callers.c \ 454 runtime/go-cgo.c \ 455 runtime/go-construct-map.c \ 456 runtime/go-ffi.c \ 457 runtime/go-fieldtrack.c \ 458 runtime/go-matherr.c \ 459 runtime/go-memclr.c \ 460 runtime/go-memmove.c \ 461 runtime/go-memequal.c \ 462 runtime/go-nanotime.c \ 463 runtime/go-now.c \ 464 runtime/go-nosys.c \ 465 runtime/go-reflect-call.c \ 466 runtime/go-setenv.c \ 467 runtime/go-signal.c \ 468 runtime/go-unsafe-pointer.c \ 469 runtime/go-unsetenv.c \ 470 runtime/go-unwind.c \ 471 runtime/go-varargs.c \ 472 runtime/env_posix.c \ 473 runtime/panic.c \ 474 runtime/print.c \ 475 runtime/proc.c \ 476 runtime/runtime_c.c \ 477 runtime/stack.c \ 478 runtime/yield.c \ 479 $(runtime_context_asm_file) \ 480 $(rtems_task_variable_add_file) 481 482version.go: s-version; @true 483s-version: Makefile 484 rm -f version.go.tmp 485 echo "package sys" > version.go.tmp 486 echo 'const GOARCH = "'$(GOARCH)'"' >> version.go.tmp 487 echo 'const GOOS = "'$(GOOS)'"' >> version.go.tmp 488 echo 'const GccgoToolDir = "$(libexecsubdir)"' >> version.go.tmp 489 echo 'const StackGuardMultiplierDefault = 1' >> version.go.tmp 490 echo >> version.go.tmp 491 echo "const (" >> version.go.tmp 492 echo " UNKNOWN ArchFamilyType = iota" >> version.go.tmp 493 for a in $(ALLGOARCHFAMILY); do \ 494 echo " $${a}" >> version.go.tmp; \ 495 done 496 echo ")" >> version.go.tmp 497 echo >> version.go.tmp 498 for a in $(ALLGOARCH); do \ 499 f=`echo $${a} | sed -e 's/\(.\).*/\1/' -e 'y/abcdefghijklmnopqrstuvwxyz/ABCDEFGHIJKLMNOPQRSTUVWXYZ/'`; \ 500 n="$${f}`echo $${a} | sed -e 's/.//'`"; \ 501 if test "$${a}" = "$(GOARCH)"; then \ 502 echo "const Goarch$${n} = 1" >> version.go.tmp; \ 503 else \ 504 echo "const Goarch$${n} = 0" >> version.go.tmp; \ 505 fi; \ 506 done 507 echo >> version.go.tmp 508 echo "const (" >> version.go.tmp 509 echo " _ArchFamily = `$(SHELL) $(srcdir)/goarch.sh $(GOARCH) family`" >> version.go.tmp 510 echo " _BigEndian = `$(SHELL) $(srcdir)/goarch.sh $(GOARCH) bigendian`" >> version.go.tmp 511 echo " _DefaultPhysPageSize = `$(SHELL) $(srcdir)/goarch.sh $(GOARCH) defaultphyspagesize`" >> version.go.tmp 512 echo " _Int64Align = `$(SHELL) $(srcdir)/goarch.sh $(GOARCH) int64align`" >> version.go.tmp 513 echo " _MinFrameSize = `$(SHELL) $(srcdir)/goarch.sh $(GOARCH) minframesize`" >> version.go.tmp 514 echo " _PCQuantum = `$(SHELL) $(srcdir)/goarch.sh $(GOARCH) pcquantum`" >> version.go.tmp 515 echo " _StackAlign = `$(SHELL) $(srcdir)/goarch.sh $(GOARCH) stackalign`" >> 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; \ 523 else \ 524 echo "const Goos$${n} = 0" >> version.go.tmp; \ 525 fi; \ 526 done 527 echo >> version.go.tmp 528 $(SHELL) $(srcdir)/mvifdiff.sh version.go.tmp version.go 529 $(STAMP) $@ 530 531cpugen.go: s-cpu; @true 532s-cpu: Makefile 533 rm -f cpugen.go.tmp 534 echo "package cpu" > cpugen.go.tmp 535 echo "const CacheLinePadSize = `$(SHELL) $(srcdir)/goarch.sh $(GOARCH) cachelinesize`" >> cpugen.go.tmp 536 echo "const FunctionDescriptors = $(FUNCTION_DESCRIPTORS)" >> cpugen.go.tmp 537 $(SHELL) $(srcdir)/mvifdiff.sh cpugen.go.tmp cpugen.go 538 $(STAMP) $@ 539 540gcpugen.go: s-gcpu; @true 541s-gcpu: Makefile 542 rm -f gcpugen.go.tmp 543 echo "package cpu" > gcpugen.go.tmp 544 echo "const cacheLineSize = `$(SHELL) $(srcdir)/goarch.sh $(GOARCH) cachelinesize`" >> gcpugen.go.tmp 545 $(SHELL) $(srcdir)/mvifdiff.sh gcpugen.go.tmp gcpugen.go 546 $(STAMP) $@ 547 548goroot.go: s-goroot; @true 549s-goroot: Makefile 550 rm -f goroot.go.tmp 551 echo "package runtime" > goroot.go.tmp 552 echo 'var defaultGOROOT = `$(prefix)`' >> goroot.go.tmp 553 $(SHELL) $(srcdir)/mvifdiff.sh goroot.go.tmp goroot.go 554 $(STAMP) $@ 555 556buildcfg.go: s-buildcfg; @true 557s-buildcfg: Makefile 558 rm -f buildcfg.go.tmp 559 echo "package buildcfg" > buildcfg.go.tmp 560 echo "import \"runtime\"" >> buildcfg.go.tmp 561 echo 'func defaultGOROOTValue() string { return `$(prefix)` }' >> buildcfg.go.tmp 562 echo 'const defaultGO386 = `sse2`' >> buildcfg.go.tmp 563 echo 'const defaultGOARM = `5`' >> buildcfg.go.tmp 564 echo 'const defaultGOMIPS = `hardfloat`' >> buildcfg.go.tmp 565 echo 'const defaultGOMIPS64 = `hardfloat`' >> buildcfg.go.tmp 566 echo 'const defaultGOPPC64 = `power8`' >> buildcfg.go.tmp 567 echo 'const defaultGOEXPERIMENT = `fieldtrack`' >> buildcfg.go.tmp 568 echo 'const defaultGO_EXTLINK_ENABLED = ``' >> buildcfg.go.tmp 569 echo 'const defaultGO_LDSO = ``' >> buildcfg.go.tmp 570 echo 'const version = `'`cat $(srcdir)/VERSION | sed 1q`' '`$(GOC) --version | sed 1q`'`' >> buildcfg.go.tmp 571 echo 'const defaultGOOS = runtime.GOOS' >> buildcfg.go.tmp 572 echo 'const defaultGOARCH = runtime.GOARCH' >> buildcfg.go.tmp 573 $(SHELL) $(srcdir)/mvifdiff.sh buildcfg.go.tmp buildcfg.go 574 $(STAMP) $@ 575 576objabi.go: s-objabi; @true 577s-objabi: Makefile 578 rm -f objabi.go.tmp 579 echo "package objabi" > objabi.go.tmp 580 echo 'const stackGuardMultiplierDefault = 1' >> objabi.go.tmp 581 $(SHELL) $(srcdir)/mvifdiff.sh objabi.go.tmp objabi.go 582 $(STAMP) $@ 583 584gccgosizes.go: s-gccgosizes; @true 585s-gccgosizes: Makefile goarch.sh 586 rm -f gccgosizes.go.tmp 587 echo "package types" > gccgosizes.go.tmp 588 echo >> gccgosizes.go.tmp 589 echo "var gccgoArchSizes = map[string]*StdSizes{" >> gccgosizes.go.tmp 590 for a in $(ALLGOARCH); do \ 591 ptrsize=`$(SHELL) $(srcdir)/goarch.sh $$a ptrsize`; \ 592 maxalign=`$(SHELL) $(srcdir)/goarch.sh $$a maxalign`; \ 593 echo " \"$$a\": {$${ptrsize}, $${maxalign}}," >> gccgosizes.go.tmp; \ 594 done 595 echo "}" >> gccgosizes.go.tmp 596 $(SHELL) $(srcdir)/mvifdiff.sh gccgosizes.go.tmp gccgosizes.go 597 $(STAMP) $@ 598 599os_linknames.go: s-os_linknames; @true 600s-os_linknames: os-list gen-sysinfo.go $(srcdir)/mklinknames.awk $(srcdir)/go/os/*.go 601 rm -f os_linknames.go.tmp 602 $(AWK) -f $(srcdir)/mklinknames.awk -v package=os `cat os-list` > os_linknames.go.tmp 603 $(SHELL) $(srcdir)/mvifdiff.sh os_linknames.go.tmp os_linknames.go 604 $(STAMP) $@ 605 606os-list: s-os-list; @true 607s-os-list: Makefile $(srcdir)/go/os/*.go 608 rm -f os-list.tmp 609 $(SHELL) $(srcdir)/match.sh --goarch=$(GOARCH) --goos=$(GOOS) --srcdir=$(srcdir)/go/os > os-list.tmp 610 $(SHELL) $(srcdir)/mvifdiff.sh os-list.tmp os-list 611 $(STAMP) $@ 612 613os_user_linknames.go: s-os_user_linknames; @true 614s-os_user_linknames: os-user-list gen-sysinfo.go $(srcdir)/mklinknames.awk $(srcdir)/go/os/user/*.go 615 rm -f os_user_linknames.go.tmp 616 $(AWK) -f $(srcdir)/mklinknames.awk -v package=user `cat os-user-list` > os_user_linknames.go.tmp 617 $(SHELL) $(srcdir)/mvifdiff.sh os_user_linknames.go.tmp os_user_linknames.go 618 $(STAMP) $@ 619 620os-user-list: s-os-user-list; @true 621s-os-user-list: Makefile $(srcdir)/go/os/user/*.go 622 rm -f os-user-list.tmp 623 $(SHELL) $(srcdir)/match.sh --goarch=$(GOARCH) --goos=$(GOOS) --srcdir=$(srcdir)/go/os/user > os-user-list.tmp 624 $(SHELL) $(srcdir)/mvifdiff.sh os-user-list.tmp os-user-list 625 $(STAMP) $@ 626 627runtime_linknames.go: s-runtime_linknames; @true 628s-runtime_linknames: runtime-list gen-sysinfo.go $(srcdir)/mklinknames.awk $(srcdir)/go/runtime/*.go 629 rm -f runtime_linknames.go.tmp 630 $(AWK) -f $(srcdir)/mklinknames.awk -v package=runtime `cat runtime-list` > runtime_linknames.go.tmp 631 $(SHELL) $(srcdir)/mvifdiff.sh runtime_linknames.go.tmp runtime_linknames.go 632 $(STAMP) $@ 633 634runtime-list: s-runtime-list; @true 635s-runtime-list: Makefile $(srcdir)/go/runtime/*.go 636 rm -f runtime-list.tmp 637 $(SHELL) $(srcdir)/match.sh --goarch=$(GOARCH) --goos=$(GOOS) --srcdir=$(srcdir)/go/runtime > runtime-list.tmp 638 $(SHELL) $(srcdir)/mvifdiff.sh runtime-list.tmp runtime-list 639 $(STAMP) $@ 640 641runtime_sysinfo.go: s-runtime_sysinfo; @true 642s-runtime_sysinfo: $(srcdir)/mkrsysinfo.sh gen-sysinfo.go 643 GOARCH=$(GOARCH) GOOS=$(GOOS) $(SHELL) $(srcdir)/mkrsysinfo.sh 644 $(SHELL) $(srcdir)/mvifdiff.sh tmp-runtime_sysinfo.go runtime_sysinfo.go 645 $(STAMP) $@ 646 647sigtab.go: s-sigtab; @true 648s-sigtab: $(srcdir)/mksigtab.sh gen-sysinfo.go 649 GOOS=$(GOOS) $(SHELL) $(srcdir)/mksigtab.sh > tmp-sigtab.go 650 $(SHELL) $(srcdir)/mvifdiff.sh tmp-sigtab.go sigtab.go 651 $(STAMP) $@ 652 653GCCGO_INSTALL_NAME := $(shell echo gccgo|sed '$(program_transform_name)') 654GCC_INSTALL_NAME := $(shell echo gcc|sed '$(program_transform_name)') 655GXX_INSTALL_NAME := $(shell echo g++|sed '$(program_transform_name)') 656 657zdefaultcc.go: s-zdefaultcc; @true 658s-zdefaultcc: Makefile 659 echo 'package cfg' > zdefaultcc.go.tmp 660 echo >> zdefaultcc.go.tmp 661 echo 'func DefaultGCCGO(goos, goarch string) string { return "$(bindir)/$(GCCGO_INSTALL_NAME)" }' >> zdefaultcc.go.tmp 662 echo 'func DefaultCC(goos, goarch string) string { return "$(GCC_INSTALL_NAME)" }' >> zdefaultcc.go.tmp 663 echo 'func DefaultCXX(goos, goarch string) string { return "$(GXX_INSTALL_NAME)" }' >> zdefaultcc.go.tmp 664 echo 'const DefaultPkgConfig = "pkg-config"' >> zdefaultcc.go.tmp 665 echo 'var OSArchSupportsCgo = map[string]bool{}' >> zdefaultcc.go.tmp 666 $(SHELL) $(srcdir)/../move-if-change zdefaultcc.go.tmp zdefaultcc.go 667 $(STAMP) $@ 668 669# Post-process runtime.inc.raw (raw output of -fgo-c-header option when 670# compiling runtime) to prune out certain types that should not be 671# exported back to C. See comments in mkruntimeinc.sh for more details. 672runtime.inc: s-runtime-inc; @true 673s-runtime-inc: runtime.lo mkruntimeinc.sh Makefile 674 $(SHELL) $(srcdir)/mkruntimeinc.sh 675 $(SHELL) $(srcdir)/mvifdiff.sh tmp-runtime.inc runtime.inc 676 $(STAMP) $@ 677 678noinst_DATA += zdefaultcc.go 679 680# Generate the list of go std packages that were included in libgo 681zstdpkglist.go: s-zstdpkglist; @true 682s-zstdpkglist: Makefile libgo-packages.txt 683 rm -f zstdpkglist.go.tmp 684 echo 'package goroot' > zstdpkglist.go.tmp 685 echo "" >> zstdpkglist.go.tmp 686 echo 'var stdpkg = map[string]bool{' >> zstdpkglist.go.tmp 687 echo $(libgo_go_objs) 'unsafe.lo' | sed 's|[a-z0-9_./]*_c\.lo||g' | sed 's|golang\.org/[a-z0-9_./]*\.lo||g' | sed 's|\([a-z0-9_./]*\)\.lo|"\1": true,|g' >> zstdpkglist.go.tmp 688 echo '}' >> zstdpkglist.go.tmp 689 $(SHELL) $(srcdir)/mvifdiff.sh zstdpkglist.go.tmp zstdpkglist.go 690 $(STAMP) $@ 691 692if LIBGO_IS_LINUX 693syscall_epoll_file = epoll.go 694else 695syscall_epoll_file = 696endif 697 698libcalls.go: s-libcalls; @true 699s-libcalls: libcalls-list go/syscall/mksyscall.awk $(srcdir)/go/syscall/*.go 700 rm -f libcalls.go.tmp 701 $(AWK) -f $(srcdir)/go/syscall/mksyscall.awk `cat libcalls-list` > libcalls.go.tmp 702 $(SHELL) $(srcdir)/mvifdiff.sh libcalls.go.tmp libcalls.go 703 $(STAMP) $@ 704 705libcalls-list: s-libcalls-list; @true 706s-libcalls-list: Makefile $(srcdir)/go/syscall/*.go 707 rm -f libcalls-list.tmp 708 $(SHELL) $(srcdir)/match.sh --goarch=$(GOARCH) --goos=$(GOOS) --srcdir=$(srcdir)/go/syscall $(matchargs_syscall) > libcalls-list.tmp 709 $(SHELL) $(srcdir)/mvifdiff.sh libcalls-list.tmp libcalls-list 710 $(STAMP) $@ 711 712syscall_arch.go: s-syscall_arch; @true 713s-syscall_arch: Makefile 714 rm -f syscall_arch.go.tmp 715 echo "package syscall" > syscall_arch.go.tmp 716 echo 'const ARCH = "'$(GOARCH)'"' >> syscall_arch.go.tmp 717 echo 'const OS = "'$(GOOS)'"' >> syscall_arch.go.tmp 718 $(SHELL) $(srcdir)/mvifdiff.sh syscall_arch.go.tmp syscall_arch.go 719 $(STAMP) $@ 720 721syscall_linknames.go: s-syscall_linknames; @true 722s-syscall_linknames: libcalls.go gen-sysinfo.go $(srcdir)/mklinknames.awk 723 rm -f syscall_linknames.go.tmp 724 $(AWK) -v package=syscall -f $(srcdir)/mklinknames.awk libcalls.go > syscall_linknames.go.tmp 725 $(SHELL) $(srcdir)/mvifdiff.sh syscall_linknames.go.tmp syscall_linknames.go 726 $(STAMP) $@ 727 728SYSINFO_FLAGS = \ 729 $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \ 730 $(CPPFLAGS) $(OSCFLAGS) -O 731 732gen-sysinfo.go: s-gen-sysinfo; @true 733s-gen-sysinfo: $(srcdir)/sysinfo.c config.h 734 $(CC) $(SYSINFO_FLAGS) -fdump-go-spec=tmp-gen-sysinfo.go -std=gnu99 -S -o sysinfo.s $(srcdir)/sysinfo.c 735 rm -f sysinfo.s 736 $(SHELL) $(srcdir)/mvifdiff.sh tmp-gen-sysinfo.go gen-sysinfo.go 737 $(STAMP) $@ 738 739errno.i: s-errno; @true 740s-errno: 741 echo '#include <errno.h>' | $(CC) $(SYSINFO_FLAGS) -x c - -E -dM > tmp-errno.i 742 $(SHELL) $(srcdir)/mvifdiff.sh tmp-errno.i errno.i 743 $(STAMP) $@ 744 745sysinfo.go: s-sysinfo; @true 746s-sysinfo: $(srcdir)/mksysinfo.sh gen-sysinfo.go errno.i 747 GOARCH=$(GOARCH) GOOS=$(GOOS) $(SHELL) $(srcdir)/mksysinfo.sh 748 $(SHELL) $(srcdir)/mvifdiff.sh tmp-sysinfo.go sysinfo.go 749 $(STAMP) $@ 750 751# The epoll struct has an embedded union and is packed on x86_64, 752# which is too complicated for mksysinfo.sh. We find the offset of 753# the only field we care about in configure.ac, and generate the 754# struct here. 755epoll.go: s-epoll; @true 756s-epoll: Makefile 757 rm -f epoll.go.tmp 758 echo 'package syscall' > epoll.go.tmp 759 echo 'type EpollEvent struct {' >> epoll.go.tmp 760 echo ' Events uint32' >> epoll.go.tmp 761 case "$(SIZEOF_STRUCT_EPOLL_EVENT),$(STRUCT_EPOLL_EVENT_FD_OFFSET)" in \ 762 0,0) echo 1>&2 "*** struct epoll_event data.fd offset unknown"; \ 763 exit 1; ;; \ 764 8,4) echo ' Fd int32' >> epoll.go.tmp; ;; \ 765 12,4) echo ' Fd int32' >> epoll.go.tmp; \ 766 echo ' Pad [4]byte' >> epoll.go.tmp; ;; \ 767 12,8) echo ' Pad [4]byte' >> epoll.go.tmp; \ 768 echo ' Fd int32' >> epoll.go.tmp; ;; \ 769 16,8) echo ' Pad [4]byte' >> epoll.go.tmp; \ 770 echo ' Fd int32' >> epoll.go.tmp; \ 771 echo ' Pad2 [4]byte' >> epoll.go.tmp; ;; \ 772 *) echo 1>&2 "*** struct epoll_event unsupported"; \ 773 exit 1; ;; \ 774 esac 775 echo '}' >> epoll.go.tmp 776 $(SHELL) $(srcdir)/mvifdiff.sh epoll.go.tmp epoll.go 777 $(STAMP) $@ 778 779if LIBGO_IS_LINUX 780syscall_lib_clone_lo = syscall/clone_linux.lo 781else 782syscall_lib_clone_lo = 783endif 784 785if LIBGO_IS_X86 786golangorg_x_sys_cpu_gccgo_x86_lo = golang.org/x/sys/cpu_gccgo_x86.lo 787else 788golangorg_x_sys_cpu_gccgo_x86_lo = 789endif 790 791PACKAGES = $(shell cat $(srcdir)/libgo-packages.txt) 792 793libgo_go_objs = \ 794 $(addsuffix .lo,$(PACKAGES)) \ 795 internal/bytealg/bytealg.lo \ 796 reflect/makefunc_ffi_c.lo \ 797 $(syscall_lib_clone_lo) \ 798 syscall/errno.lo \ 799 syscall/signame.lo \ 800 syscall/wait.lo \ 801 os/dir_gccgo_c.lo \ 802 $(golangorg_x_net_lif_lo) \ 803 $(golangorg_x_net_route_lo) \ 804 log/syslog/syslog_c.lo \ 805 $(os_lib_inotify_lo) \ 806 runtime/internal/atomic_c.lo \ 807 sync/atomic_c.lo \ 808 internal/cpu/cpu_gccgo.lo \ 809 $(golangorg_x_sys_cpu_gccgo_x86_lo) 810 811libgo_ldflags = \ 812 -version-info $(libtool_VERSION) $(PTHREAD_CFLAGS) $(AM_LDFLAGS) 813 814libgo_libadd = \ 815 $(libgo_go_objs) ../libbacktrace/libbacktrace.la \ 816 $(LIBATOMIC) $(LIBFFI) $(PTHREAD_LIBS) $(MATH_LIBS) $(NET_LIBS) 817 818libgo_la_SOURCES = $(runtime_files) 819libgo_la_LDFLAGS = $(libgo_ldflags) 820libgo_la_LIBADD = $(libgo_libadd) 821 822libgo_llgo_la_SOURCES = $(runtime_files) 823libgo_llgo_la_LDFLAGS = $(libgo_ldflags) 824libgo_llgo_la_LIBADD = $(libgo_libadd) 825 826libgobegin_a_SOURCES = \ 827 runtime/go-main.c 828 829libgobegin_llgo_a_SOURCES = \ 830 runtime/go-main.c 831 832# Use -fPIC for libgobegin so that it can be put in a PIE. 833libgobegin_a_CFLAGS = $(AM_CFLAGS) -fPIC 834libgobegin_llgo_a_CFLAGS = $(AM_CFLAGS) -fPIC 835 836libgolibbegin_a_SOURCES = \ 837 runtime/go-libmain.c 838 839libgolibbegin_a_CFLAGS = $(AM_CFLAGS) -fPIC 840 841GOTOOL_PACKAGES = $(shell cat $(srcdir)/gotool-packages.txt) 842 843libgotool_a_SOURCES = 844libgotool_a_DEPENDENCIES = $(addsuffix .lo,$(GOTOOL_PACKAGES)) 845libgotool_a_LIBADD = $(addsuffix .o,$(GOTOOL_PACKAGES)) 846 847define STATIC_template 848$(subst -,_,$(subst .,_,$(subst /,_,$(1))))_GOCFLAGS = -static 849endef 850 851$(foreach package,$(GOTOOL_PACKAGES),$(eval $(call STATIC_template,$(package).lo))) 852 853# Make sure runtime.inc is built before compiling any .c file. 854$(libgo_la_OBJECTS): runtime.inc 855$(libgo_llgo_la_OBJECTS): runtime.inc 856$(libgobegin_a_OBJECTS): runtime.inc 857$(libgobegin_llgo_a_OBJECTS): runtime.inc 858$(libgolibbegin_a_OBJECTS): runtime.inc 859 860LTLDFLAGS = $(shell $(SHELL) $(top_srcdir)/../libtool-ldflags $(LDFLAGS)) 861 862GOCFLAGS = $(CFLAGS) 863AM_GOCFLAGS = $(STRINGOPS_FLAG) $(GO_SPLIT_STACK) 864GOCOMPILE = $(GOC) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_GOCFLAGS) $(GOCFLAGS) 865 866LTGOCOMPILE = $(LIBTOOL) --tag GO --mode=compile $(GOC) $(INCLUDES) \ 867 $(AM_GOCFLAGS) $(GOCFLAGS) 868 869GOLINK = $(LIBTOOL) --tag GO --mode-link $(GOC) \ 870 $(OPT_LDFLAGS) $(SECTION_LDFLAGS) $(AM_GOCFLAGS) $(LTLDFLAGS) -o $@ 871 872# Build the dependencies for a Go package. 873BUILDDEPS = \ 874 $(MKDIR_P) $(@D); \ 875 dir=`echo $@ | sed -e 's/.lo.dep$$//'`; \ 876 files=`$(SHELL) $(srcdir)/match.sh --goarch=$(GOARCH) --goos=$(GOOS) --srcdir=$(srcdir)/go/$$dir --extrafiles="$(extra_go_files_$(subst .,_,$(subst /,_,$(subst .lo.dep,,$@))))" $(matchargs_$(subst /,_,$(subst .lo.dep,,$@)))`; \ 877 $(SHELL) $(srcdir)/godeps.sh `echo $@ | sed -e 's/.dep$$//'` $$files > $@.tmp; \ 878 if ! cmp $@.tmp $@ >/dev/null 2>/dev/null; then \ 879 rm -f `echo $@ | sed -e 's/\.dep$$//'`; \ 880 fi; \ 881 mv -f $@.tmp $@ 882 883# Build the .go files for a package, generating a .lo file. 884BUILDPACKAGE = \ 885 $(MKDIR_P) $(@D); \ 886 files=`echo $^ | sed -e 's/[^ ]*\.gox//g' -e 's/[^ ]*\.dep//'`; \ 887 $(LTGOCOMPILE) -I . -c -fgo-pkgpath=`echo $@ | sed -e 's/.lo$$//'` $($(subst -,_,$(subst .,_,$(subst /,_,$@)))_GOCFLAGS) -o $@ $$files 888 889# How to build a .gox file from a .lo file. 890# Matching .o file can either be in the same directory as the .lo (non-PIC 891# object) or in the .libs directory (PIC object). 892BUILDGOX = \ 893 f="$(basename $<).o"; \ 894 if test ! -f $$f; then \ 895 f="$(basename $(<D)/.libs/$(<F)).o"; \ 896 fi; \ 897 $(OBJCOPY) -j $(GO_EXPORT_SECTION_NAME) $$f $@.tmp; \ 898 $(SHELL) $(srcdir)/mvifdiff.sh $@.tmp `echo $@ | sed -e 's/s-gox/gox/'` 899 900GOTESTFLAGS = 901GOBENCH = 902 903# Check a package. 904CHECK = \ 905 GC="$(GOC) $(GOCFLAGS) $($(subst /,_,$@)_GOCFLAGS) -L `${PWD_COMMAND}` -L `${PWD_COMMAND}`/.libs"; \ 906 export GC; \ 907 GOLIBS="$(extra_check_libs_$(subst .,_,$(subst /,_,$(@D)))) $(PTHREAD_LIBS) $(MATH_LIBS) $(NET_LIBS) $(LIBS)"; \ 908 export GOLIBS; \ 909 RUNTESTFLAGS="$(RUNTESTFLAGS)"; \ 910 export RUNTESTFLAGS; \ 911 MAKE="$(MAKE)"; \ 912 export MAKE; \ 913 NM="$(NM)"; \ 914 export NM; \ 915 libgccdir=`${GOC} ${GOCFLAGS} -print-libgcc-file-name | sed -e 's|/[^/]*$$||'`; \ 916 LD_LIBRARY_PATH="`${PWD_COMMAND}`/.libs:$${libgccdir}:${LD_LIBRARY_PATH}"; \ 917 LD_LIBRARY_PATH=`echo $${LD_LIBRARY_PATH} | sed 's,::*,:,g;s,^:*,,;s,:*$$,,'`; \ 918 export LD_LIBRARY_PATH; \ 919 $(MKDIR_P) $(@D); \ 920 rm -f $@-testsum $@-testlog; \ 921 files=`$(SHELL) $(srcdir)/match.sh --goarch=$(GOARCH) --goos=$(GOOS) --srcdir=$(srcdir)/go/$(@D) --extrafiles="$(extra_go_files_$(subst .,_,$(subst /,_,$(@D))))" $(matchargs_$(subst /,_,$(@D)))`; \ 922 if test "$(USE_DEJAGNU)" = "yes"; then \ 923 $(SHELL) $(srcdir)/testsuite/gotest --goarch=$(GOARCH) --goos=$(GOOS) --dejagnu=yes --basedir=$(srcdir) --srcdir=$(srcdir)/go/$(@D) --pkgpath="$(@D)" --pkgfiles="$$files" --testname="$(@D)" $(GOTESTFLAGS); \ 924 elif test "$(GOBENCH)" != ""; then \ 925 $(SHELL) $(srcdir)/testsuite/gotest --goarch=$(GOARCH) --goos=$(GOOS) --basedir=$(srcdir) --srcdir=$(srcdir)/go/$(@D) --pkgpath="$(@D)" --pkgfiles="$$files" --bench="$(GOBENCH)" $(GOTESTFLAGS); \ 926 else \ 927 if $(SHELL) $(srcdir)/testsuite/gotest --goarch=$(GOARCH) --goos=$(GOOS) --basedir=$(srcdir) --srcdir=$(srcdir)/go/$(@D) --pkgpath="$(@D)" --pkgfiles="$$files" $(GOTESTFLAGS) >>$@-testlog 2>&1; then \ 928 echo "PASS: $(@D)" >> $@-testlog; \ 929 echo "PASS: $(@D)"; \ 930 echo "PASS: $(@D)" > $@-testsum; \ 931 else \ 932 echo "FAIL: $(@D)" >> $@-testlog; \ 933 cat $@-testlog; \ 934 echo "FAIL: $(@D)" > $@-testsum; \ 935 exit 1; \ 936 fi; \ 937 fi 938 939# Build all packages before checking any. 940CHECK_DEPS = \ 941 $(toolexeclibgo_DATA) \ 942 $(toolexeclibgoarchive_DATA) \ 943 $(toolexeclibgocompress_DATA) \ 944 $(toolexeclibgocontainer_DATA) \ 945 $(toolexeclibgocrypto_DATA) \ 946 $(toolexeclibgodebug_DATA) \ 947 $(toolexeclibgoencoding_DATA) \ 948 $(toolexeclibgogo_DATA) \ 949 $(toolexeclibgohash_DATA) \ 950 $(toolexeclibgoimage_DATA) \ 951 $(toolexeclibgoindex_DATA) \ 952 $(toolexeclibgoio_DATA) \ 953 $(toolexeclibgolog_DATA) \ 954 $(toolexeclibgomath_DATA) \ 955 $(toolexeclibgomime_DATA) \ 956 $(toolexeclibgonet_DATA) \ 957 $(toolexeclibgonethttp_DATA) \ 958 $(toolexeclibgoos_DATA) \ 959 $(toolexeclibgopath_DATA) \ 960 $(toolexeclibgorpc_DATA) \ 961 $(toolexeclibgoruntime_DATA) \ 962 $(toolexeclibgosync_DATA) \ 963 $(toolexeclibgotesting_DATA) \ 964 $(toolexeclibgotext_DATA) \ 965 $(toolexeclibgotexttemplate_DATA) \ 966 $(toolexeclibgounicode_DATA) \ 967 $(noinst_DATA) \ 968 $(noinst_LIBRARIES) 969 970if GOC_IS_LLGO 971CHECK_DEPS += libgo-llgo.la libgobegin-llgo.a 972else 973CHECK_DEPS += libgo.la libgobegin.a 974endif 975 976# PACKAGE_template defines the rules for each package. 977# For example, for the package bufio, it produces: 978# 979# @go_include@ bufio.lo.dep 980# bufio.lo.dep: $(srcdir)/go/bufio/*.go 981# $(BUILDDEPS) 982# bufio.lo: 983# $(BUILDPACKAGE) 984# bufio/check: $(CHECK_DEPS) 985# @$(CHECK) 986# .PHONY: bufio/check 987# 988# This is invoked with $(1) set to a package, which is a directory name, 989# such as "bufio" or "archive/tar". 990define PACKAGE_template 991@go_include@ $(1).lo.dep 992$(1).lo.dep: $(srcdir)/go/$(1)/*.go 993 $$(BUILDDEPS) 994$(1).lo: 995 $$(BUILDPACKAGE) 996$(1)/check: $$(CHECK_DEPS) 997 @$$(CHECK) 998.PHONY: $(1)/check 999$(1).gox: $(1).s-gox; @true 1000$(1).s-gox: $(1).lo 1001 $$(BUILDGOX) 1002 $$(STAMP) $$@ 1003endef 1004 1005# This line expands PACKAGE_template once for each package name listed 1006# in $(PACKAGES). 1007$(foreach package,$(PACKAGES),$(eval $(call PACKAGE_template,$(package)))) 1008$(foreach package,$(GOTOOL_PACKAGES),$(eval $(call PACKAGE_template,$(package)))) 1009 1010# Pass -ffp-contract=off, or 386-specific options, when building the 1011# math package. MATH_FLAG is defined in configure.ac. 1012math_lo_GOCFLAGS = $(MATH_FLAG) 1013math_check_GOCFLAGS = $(MATH_FLAG) 1014 1015# Add generated files to the runtime package. 1016extra_go_files_runtime = \ 1017 runtime_linknames.go runtime_sysinfo.go sigtab.go goroot.go 1018runtime.lo.dep: $(extra_go_files_runtime) 1019 1020# Add generated files to the syscall package. 1021extra_go_files_syscall = \ 1022 libcalls.go \ 1023 sysinfo.go \ 1024 syscall_arch.go \ 1025 syscall_linknames.go \ 1026 $(syscall_epoll_file) 1027syscall.lo.dep: $(extra_go_files_syscall) 1028 1029# Pass -fgo-compiling-runtime when compiling the runtime package. 1030runtime_lo_GOCFLAGS = -fgo-c-header=runtime.inc.raw -fgo-compiling-runtime 1031runtime_check_GOCFLAGS = -fgo-compiling-runtime 1032runtime_internal_atomic_lo_GOCFLAGS = -fgo-compiling-runtime 1033runtime_internal_atomic_lo_check_GOCFLAGS = -fgo-compiling-runtime 1034runtime_internal_sys_lo_GOCFLAGS = -fgo-compiling-runtime 1035runtime_internal_sys_lo_check_GOCFLAGS = -fgo-compiling-runtime 1036 1037# If libffi is supported (the normal case) use the ffi build tag for 1038# the runtime package. 1039if USE_LIBFFI 1040matchargs_runtime = --tag=libffi 1041else 1042matchargs_runtime = 1043endif 1044 1045# At least for now, we need -static-libgo for this test, because 1046# otherwise we can't get the line numbers. 1047# Also use -fno-inline to get better results from the memory profiler. 1048runtime_pprof_check_GOCFLAGS = -static-libgo -fno-inline 1049 1050if LIBGO_IS_AIX 1051# reflect tests must be done with -static-libgo. Otherwize, 1052# there will be a duplication of the canonicalization map. 1053reflect_check_GOCFLAGS = -static-libgo -Wl,-bbigtoc 1054endif 1055 1056if HAVE_STATIC_LINK 1057# Use -static for the syscall tests if possible, because otherwise when 1058# running as root the re-execs ignore LD_LIBRARY_PATH. 1059syscall_check_GOCFLAGS = -static 1060endif 1061 1062extra_go_files_runtime_internal_sys = version.go 1063runtime/internal/sys.lo.dep: $(extra_go_files_runtime_internal_sys) 1064 1065extra_go_files_internal_cpu = cpugen.go 1066internal/cpu.lo.dep: $(extra_go_files_internal_cpu) 1067 1068extra_go_files_golang_org_x_sys_cpu = gcpugen.go 1069golang.org/x/sys/cpu.lo.dep: $(extra_go_files_golang_org_x_sys_cpu) 1070 1071extra_go_files_internal_buildcfg = buildcfg.go 1072cmd/internal/buildcfg.lo.dep: $(extra_go_files_internal_buildcfg) 1073 1074extra_go_files_internal_goroot = zstdpkglist.go 1075internal/goroot.lo.dep: $(extra_go_files_internal_goroot) 1076 1077extra_go_files_go_types = gccgosizes.go 1078go/types.lo.dep: $(extra_go_files_go_types) 1079 1080extra_go_files_cmd_internal_objabi = objabi.go 1081cmd/internal/objabi.lo.dep: $(extra_go_files_cmd_internal_objabi) 1082 1083extra_go_files_cmd_go_internal_cfg = zdefaultcc.go 1084cmd/go/internal/cfg.lo.dep: $(extra_go_files_cmd_go_internal_cfg) 1085 1086extra_go_files_os = os_linknames.go 1087os.lo.dep: $(extra_go_files_os) 1088 1089extra_go_files_os_user = os_user_linknames.go 1090os/user.lo.dep: $(extra_go_files_os_user) 1091 1092extra_check_libs_cmd_go_internal_cache = $(abs_builddir)/libgotool.a 1093extra_check_libs_cmd_go_internal_fsys = $(abs_builddir)/libgotool.a 1094extra_check_libs_cmd_go_internal_generate = $(abs_builddir)/libgotool.a 1095extra_check_libs_cmd_go_internal_get = $(abs_builddir)/libgotool.a 1096extra_check_libs_cmd_go_internal_load = $(abs_builddir)/libgotool.a 1097extra_check_libs_cmd_go_internal_lockedfile = $(abs_builddir)/libgotool.a 1098extra_check_libs_cmd_go_internal_imports = $(abs_builddir)/libgotool.a 1099extra_check_libs_cmd_go_internal_modconv = $(abs_builddir)/libgotool.a 1100extra_check_libs_cmd_go_internal_modfetch = $(abs_builddir)/libgotool.a 1101extra_check_libs_cmd_go_internal_modfetch_codehost = $(abs_builddir)/libgotool.a 1102extra_check_libs_cmd_go_internal_modfile = $(abs_builddir)/libgotool.a 1103extra_check_libs_cmd_go_internal_modload = $(abs_builddir)/libgotool.a 1104extra_check_libs_cmd_go_internal_module = $(abs_builddir)/libgotool.a 1105extra_check_libs_cmd_go_internal_mvs = $(abs_builddir)/libgotool.a 1106extra_check_libs_cmd_go_internal_search = $(abs_builddir)/libgotool.a 1107extra_check_libs_cmd_go_internal_str = $(abs_builddir)/libgotool.a 1108extra_check_libs_cmd_go_internal_test = $(abs_builddir)/libgotool.a 1109extra_check_libs_cmd_go_internal_vcs = $(abs_builddir)/libgotool.a 1110extra_check_libs_cmd_go_internal_web2 = $(abs_builddir)/libgotool.a 1111extra_check_libs_cmd_go_internal_work = $(abs_builddir)/libgotool.a 1112 1113extra_check_libs_cmd_internal_buildid = $(abs_builddir)/libgotool.a 1114 1115extra_check_libs_cmd_vet_internal_cfg = $(abs_builddir)/libgotool.a 1116 1117# FIXME: The following C files may as well move to the runtime 1118# directory and be treated like other C files. 1119 1120# Use C code to speed up internal/bytealg.IndexByte and friends. 1121internal/bytealg/bytealg.lo: go/internal/bytealg/bytealg.c runtime.inc 1122 @$(MKDIR_P) internal/bytealg 1123 $(LTCOMPILE) -c -o $@ $(srcdir)/go/internal/bytealg/bytealg.c 1124 1125# Use a C function with a fixed number of arguments to call a C 1126# varargs function. 1127log/syslog/syslog_c.lo: go/log/syslog/syslog_c.c runtime.inc 1128 @$(MKDIR_P) log/syslog 1129 $(LTCOMPILE) -c -o $@ $(srcdir)/go/log/syslog/syslog_c.c 1130 1131# The interface to libffi from the reflect package is written in C. 1132reflect/makefunc_ffi_c.lo: go/reflect/makefunc_ffi_c.c runtime.inc 1133 @$(MKDIR_P) reflect 1134 $(LTCOMPILE) -c -o $@ $(srcdir)/go/reflect/makefunc_ffi_c.c 1135 1136# The atomic functions are written in C. 1137runtime/internal/atomic_c.lo: go/runtime/internal/atomic/atomic.c runtime.inc 1138 @$(MKDIR_P) runtime/internal 1139 $(LTCOMPILE) -c -o $@ $(srcdir)/go/runtime/internal/atomic/atomic.c 1140sync/atomic_c.lo: go/sync/atomic/atomic.c runtime.inc 1141 @$(MKDIR_P) sync 1142 $(LTCOMPILE) -c -o $@ $(srcdir)/go/sync/atomic/atomic.c 1143 1144# A few syscall functions are written in C. 1145syscall/clone_linux.lo: go/syscall/clone_linux.c runtime.inc 1146 @$(MKDIR_P) syscall 1147 $(LTCOMPILE) -c -o $@ $(srcdir)/go/syscall/clone_linux.c 1148syscall/errno.lo: go/syscall/errno.c runtime.inc 1149 @$(MKDIR_P) syscall 1150 $(LTCOMPILE) -c -o $@ $(srcdir)/go/syscall/errno.c 1151syscall/signame.lo: go/syscall/signame.c runtime.inc 1152 @$(MKDIR_P) syscall 1153 $(LTCOMPILE) -c -o $@ $(srcdir)/go/syscall/signame.c 1154syscall/wait.lo: go/syscall/wait.c runtime.inc 1155 @$(MKDIR_P) syscall 1156 $(LTCOMPILE) -c -o $@ $(srcdir)/go/syscall/wait.c 1157 1158# An os function is written in C. 1159os/dir_gccgo_c.lo: go/os/dir_gccgo_c.c runtime.inc 1160 @$(MKDIR_P) os 1161 $(LTCOMPILE) -c -o $@ $(srcdir)/go/os/dir_gccgo_c.c 1162 1163# internal/cpu needs some C code. 1164internal/cpu/cpu_gccgo.lo: go/internal/cpu/cpu_gccgo.c runtime.inc 1165 @$(MKDIR_P) internal/cpu 1166 $(LTCOMPILE) -c -o $@ $(srcdir)/go/internal/cpu/cpu_gccgo.c 1167 1168# Similarly, golang.org/x/sys/cpu needs some C code. 1169golang.org/x/sys/cpu_gccgo_x86.lo: go/golang.org/x/sys/cpu/cpu_gccgo_x86.c runtime.inc 1170 @$(MKDIR_P) golang.org/x/sys 1171 $(LTCOMPILE) -c -o $@ $(srcdir)/go/golang.org/x/sys/cpu/cpu_gccgo_x86.c 1172 1173# Solaris 11.4 changed the type of fields in struct stat. 1174# Use a build tag, based on a configure check, to cope. 1175if LIBGO_IS_SOLARIS 1176if HAVE_STAT_TIMESPEC 1177matchargs_os = --tag=solaristag 1178else 1179matchargs_os = 1180endif 1181else 1182matchargs_os = 1183endif 1184 1185if LIBGO_IS_BSD 1186 1187# Build golang.org/x/net/route only on BSD systems. 1188 1189$(eval $(call PACKAGE_template,golang.org/x/net/route)) 1190 1191golangorg_x_net_route_lo = \ 1192 golang.org/x/net/route.lo 1193 1194endif 1195 1196if LIBGO_IS_SOLARIS 1197 1198# Build golang.org/x/net/lif only on Solaris systems. 1199 1200$(eval $(call PACKAGE_template,golang.org/x/net/lif)) 1201 1202golangorg_x_net_lif_lo = \ 1203 golang.org/x/net/lif.lo 1204 1205endif 1206 1207TEST_PACKAGES = $(addsuffix /check,$(shell cat $(srcdir)/check-packages.txt)) 1208 1209check: check-tail 1210check-recursive: check-head 1211 1212check-head: 1213 @echo "Test Run By $${USER} on `date`" > libgo.head 1214 @echo "Native configuration is $(host_triplet)" >> libgo.head 1215 @echo >> libgo.head 1216 @echo " === libgo tests ===" >> libgo.head 1217 @echo >> libgo.head 1218 1219check-tail: check-recursive check-multi 1220 @if test "$(USE_DEJAGNU)" = "yes"; then \ 1221 exit 0; \ 1222 fi; \ 1223 lib=`${PWD_COMMAND} | sed -e 's,^.*/\([^/][^/]*\)$$,\1,'`; \ 1224 for dir in . $(MULTIDIRS); do \ 1225 mv ../$${dir}/$${lib}/libgo.sum ../$${dir}/$${lib}/libgo.sum.sep; \ 1226 mv ../$${dir}/$${lib}/libgo.log ../$${dir}/$${lib}/libgo.log.sep; \ 1227 done; \ 1228 mv libgo.head libgo.sum; \ 1229 cp libgo.sum libgo.log; \ 1230 echo "Schedule of variations:" >> libgo.sum; \ 1231 for dir in . $(MULTIDIRS); do \ 1232 multidir=../$${dir}/$${lib}; \ 1233 multivar=`cat $${multidir}/libgo.var`; \ 1234 echo " $${multivar}" >> libgo.sum; \ 1235 done; \ 1236 echo >> libgo.sum; \ 1237 pass=0; fail=0; untested=0; \ 1238 for dir in . $(MULTIDIRS); do \ 1239 multidir=../$${dir}/$${lib}; \ 1240 multivar=`cat $${multidir}/libgo.var`; \ 1241 echo "Running target $${multivar}" >> libgo.sum; \ 1242 echo "Running $(srcdir)/libgo.exp ..." >> libgo.sum; \ 1243 cat $${multidir}/libgo.sum.sep >> libgo.sum; \ 1244 cat $${multidir}/libgo.log.sep >> libgo.log; \ 1245 if test -n "${MULTIDIRS}"; then \ 1246 echo " === libgo Summary for $${multivar} ===" >> libgo.sum; \ 1247 echo >> libgo.sum; \ 1248 fi; \ 1249 p=`grep -c PASS $${multidir}/libgo.sum.sep`; \ 1250 pass=`expr $$pass + $$p`; \ 1251 if test "$$p" -ne "0" && test -n "${MULTIDIRS}"; then \ 1252 echo "# of expected passes $$p" >> libgo.sum; \ 1253 fi; \ 1254 p=`grep -c FAIL $${multidir}/libgo.sum.sep`; \ 1255 fail=`expr $$fail + $$p`; \ 1256 if test "$$p" -ne "0" && test -n "${MULTIDIRS}"; then \ 1257 echo "# of unexpected failures $$p" >> libgo.sum; \ 1258 fi; \ 1259 p=`grep -c UNTESTED $${multidir}/libgo.sum.sep`; \ 1260 untested=`expr $$untested + $$p`; \ 1261 if test "$$p" -ne "0" && test -n "${MULTIDIRS}"; then \ 1262 echo "# of untested testcases $$p" >> libgo.sum; \ 1263 fi; \ 1264 done; \ 1265 echo >> libgo.sum; \ 1266 echo " === libgo Summary ===" >> libgo.sum; \ 1267 echo >> libgo.sum; \ 1268 if test "$$pass" -ne "0"; then \ 1269 echo "# of expected passes $$pass" >> libgo.sum; \ 1270 fi; \ 1271 if test "$$fail" -ne "0"; then \ 1272 echo "# of unexpected failures $$fail" >> libgo.sum; \ 1273 fi; \ 1274 if test "$$untested" -ne "0"; then \ 1275 echo "# of untested testcases $$untested" >> libgo.sum; \ 1276 fi; \ 1277 echo `echo $(GOC) | sed -e 's/ .*//'` `$(GOC) -v 2>&1 | grep " version" | sed -n -e 's/.* \(version.*$$\)/\1/p'` >> libgo.sum; \ 1278 echo >> libgo.log; \ 1279 echo "runtest completed at `date`" >> libgo.log; \ 1280 if test "$$fail" -ne "0"; then \ 1281 status=1; \ 1282 else \ 1283 status=0; \ 1284 fi; \ 1285 exit $$status 1286 1287check-am: 1288 @rm -f libgo.sum libgo.log libgo.tail 1289 @multivar="unix"; \ 1290 [ -z "$(MULTIFLAGS)" ] || multivar="$${multivar}/$(MULTIFLAGS)"; \ 1291 echo "$${multivar}" > libgo.var 1292 @for f in $(TEST_PACKAGES); do \ 1293 rm -f $$f-testsum $$f-testlog; \ 1294 done 1295 -@$(MAKE) $(AM_MAKEFLAGS) -k $(TEST_PACKAGES) 1296 @for f in $(TEST_PACKAGES); do \ 1297 if test -f $$f-testsum; then \ 1298 cat $$f-testsum >> libgo.sum; \ 1299 fi; \ 1300 if test -f $$f-testlog; then \ 1301 cat $$f-testlog >> libgo.log; \ 1302 fi; \ 1303 done 1304 1305check-multi: 1306 $(MULTIDO) $(AM_MAKEFLAGS) DO=check-am multi-do # $(MAKE) 1307 1308bench: 1309 -@$(MAKE) $(AM_MAKEFLAGS) -k $(TEST_PACKAGES) GOBENCH=. 1310 1311MOSTLYCLEANFILES = \ 1312 s-runtime_sysinfo s-sigtab s-runtime-inc s-zstdpkglist \ 1313 s-libcalls s-libcalls-list s-syscall_arch s-gen-sysinfo s-sysinfo \ 1314 s-errno s-epoll \ 1315 libgo.head libgo.sum.sep libgo.log.sep libgo.var \ 1316 libcalls-list \ 1317 runtime.inc runtime.inc.tmp2 runtime.inc.tmp3 runtime.inc.raw 1318 1319mostlyclean-local: 1320 find . -name '*.lo' -print | xargs $(LIBTOOL) --mode=clean rm -f 1321 find . -name '*.$(OBJEXT)' -print | xargs rm -f 1322 find . -name '*-testsum' -print | xargs rm -f 1323 find . -name '*-testlog' -print | xargs rm -f 1324 1325CLEANFILES = *.go *.c s-* libgo.sum libgo.log runtime.inc 1326 1327clean-local: 1328 find . -name '*.la' -print | xargs $(LIBTOOL) --mode=clean rm -f 1329 find . -name '*.a' -print | xargs rm -f 1330 find . -name '*.gox' -print | xargs rm -f 1331 find . -name '*.s-gox' -print | xargs rm -f 1332 1333distclean-local: 1334 find . -name '*.lo.dep' -print | xargs rm -f 1335 1336include $(top_srcdir)/../multilib.am 1337 1338if LIBGO_IS_AIX 1339ALL_LOCAL_DEPS = add-aix-fat-library 1340else 1341ALL_LOCAL_DEPS = 1342endif 1343all-local: $(ALL_LOCAL_DEPS) 1344 1345MAJOR=$(firstword $(subst :, ,$(libtool_VERSION))) 1346 1347# If we want to use "AR -r" when creating AIX FAT archives, 1348# AR must be stripped of all its -X flags. 1349# Otherwize, if AR was defined with -X32_64, the replace option would 1350# erase the default .so when adding the extra one. There is no 1351# order priority within -X flags. 1352add-aix-fat-library: all-multi 1353 @if test "$(MULTIBUILDTOP)" = ""; then \ 1354 arx=`echo $(AR) | sed -e 's/-X[^ ]*//g'`; \ 1355 $${arx} -X$(AIX_EXTRA_ARCH) rc .libs/$(PACKAGE).a ../ppc$(AIX_EXTRA_ARCH)/$(PACKAGE)/.libs/$(PACKAGE).so.$(MAJOR); \ 1356 $${arx} -X$(AIX_EXTRA_ARCH) rc ../pthread/$(PACKAGE)/.libs/$(PACKAGE).a ../pthread/ppc$(AIX_EXTRA_ARCH)/$(PACKAGE)/.libs/$(PACKAGE).so.$(MAJOR); \ 1357 $${arx} -X$(AIX_EXTRA_ARCH) rc libgobegin.a ../ppc$(AIX_EXTRA_ARCH)/$(PACKAGE)/$(libgobegin_a_OBJECTS); \ 1358 $${arx} -X$(AIX_EXTRA_ARCH) rc ../pthread/$(PACKAGE)/libgobegin.a ../pthread/ppc$(AIX_EXTRA_ARCH)/$(PACKAGE)/$(libgobegin_a_OBJECTS); \ 1359 $${arx} -X$(AIX_EXTRA_ARCH) rc libgolibbegin.a ../ppc$(AIX_EXTRA_ARCH)/$(PACKAGE)/$(libgolibbegin_a_OBJECTS); \ 1360 $${arx} -X$(AIX_EXTRA_ARCH) rc ../pthread/$(PACKAGE)/libgolibbegin.a ../pthread/ppc$(AIX_EXTRA_ARCH)/$(PACKAGE)/$(libgolibbegin_a_OBJECTS); \ 1361 fi 1362