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