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