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