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