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