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