Fix libgfortran build on hppa*-hp-hpux[01]*
[official-gcc.git] / libgo / Makefile.am
blob92fedcf6eb8dc3bf81ab25c6a4e1fc1c3228e69c
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/cgo.gox \
370         runtime/debug.gox \
371         runtime/metrics.gox \
372         runtime/pprof.gox \
373         runtime/trace.gox
375 toolexeclibgosyncdir = $(toolexeclibgodir)/sync
377 toolexeclibgosync_DATA = \
378         sync/atomic.gox
380 toolexeclibgotestingdir = $(toolexeclibgodir)/testing
382 toolexeclibgotesting_DATA = \
383         testing/fstest.gox \
384         testing/iotest.gox \
385         testing/quick.gox
387 toolexeclibgotestinginternaldir = $(toolexeclibgotestingdir)/internal
389 toolexeclibgotestinginternal_DATA = \
390         testing/internal/testdeps.gox
392 toolexeclibgotextdir = $(toolexeclibgodir)/text
394 toolexeclibgotext_DATA = \
395         text/scanner.gox \
396         text/tabwriter.gox \
397         text/template.gox
399 toolexeclibgotexttemplatedir = $(toolexeclibgotextdir)/template
401 toolexeclibgotexttemplate_DATA = \
402         text/template/parse.gox
404 toolexeclibgotimedir = $(toolexeclibgodir)/time
406 toolexeclibgotime_DATA = \
407         time/tzdata.gox
409 toolexeclibgounicodedir = $(toolexeclibgodir)/unicode
411 toolexeclibgounicode_DATA = \
412         unicode/utf16.gox \
413         unicode/utf8.gox
415 # Some internal packages are needed to bootstrap the gc toolchain.
416 toolexeclibgointernaldir = $(toolexeclibgodir)/internal
417 toolexeclibgointernal_DATA = \
418         internal/reflectlite.gox \
419         internal/unsafeheader.gox
421 # Some packages are only needed for tests, so unlike the other
422 # internal packages nothing will explicitly depend on them.
423 # Force them to be built.
424 noinst_DATA = \
425         golang.org/x/net/nettest.gox \
426         internal/cfg.gox \
427         internal/obscuretestdata.gox \
428         internal/profile.gox \
429         internal/testenv.gox \
430         internal/trace.gox \
431         net/internal/socktest.gox \
432         os/signal/internal/pty.gox \
433         reflect/internal/example1.gox \
434         reflect/internal/example2.gox
436 if LIBGO_IS_RTEMS
437 rtems_task_variable_add_file = runtime/rtems-task-variable-add.c
438 else
439 rtems_task_variable_add_file =
440 endif
442 runtime_context_asm_file =
443 if LIBGO_IS_X86
444 if LIBGO_IS_LINUX
445 runtime_context_asm_file += runtime/go-context.S
446 endif
447 endif
449 runtime_files = \
450         runtime/aeshash.c \
451         runtime/go-assert.c \
452         runtime/go-caller.c \
453         runtime/go-callers.c \
454         runtime/go-cgo.c \
455         runtime/go-construct-map.c \
456         runtime/go-ffi.c \
457         runtime/go-fieldtrack.c \
458         runtime/go-matherr.c \
459         runtime/go-memclr.c \
460         runtime/go-memmove.c \
461         runtime/go-memequal.c \
462         runtime/go-nanotime.c \
463         runtime/go-now.c \
464         runtime/go-nosys.c \
465         runtime/go-reflect-call.c \
466         runtime/go-setenv.c \
467         runtime/go-signal.c \
468         runtime/go-unsafe-pointer.c \
469         runtime/go-unsetenv.c \
470         runtime/go-unwind.c \
471         runtime/go-varargs.c \
472         runtime/env_posix.c \
473         runtime/panic.c \
474         runtime/print.c \
475         runtime/proc.c \
476         runtime/runtime_c.c \
477         runtime/stack.c \
478         runtime/yield.c \
479         $(runtime_context_asm_file) \
480         $(rtems_task_variable_add_file)
482 version.go: s-version; @true
483 s-version: Makefile
484         rm -f version.go.tmp
485         echo "package sys" > version.go.tmp
486         echo 'const GOARCH = "'$(GOARCH)'"' >> version.go.tmp
487         echo 'const GOOS = "'$(GOOS)'"' >> version.go.tmp
488         echo 'const GccgoToolDir = "$(libexecsubdir)"' >> version.go.tmp
489         echo 'const StackGuardMultiplierDefault = 1' >> 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 "  _DefaultPhysPageSize = `$(SHELL) $(srcdir)/goarch.sh $(GOARCH) defaultphyspagesize`" >> version.go.tmp
512         echo "  _Int64Align = `$(SHELL) $(srcdir)/goarch.sh $(GOARCH) int64align`" >> version.go.tmp
513         echo "  _MinFrameSize = `$(SHELL) $(srcdir)/goarch.sh $(GOARCH) minframesize`" >> version.go.tmp
514         echo "  _PCQuantum = `$(SHELL) $(srcdir)/goarch.sh $(GOARCH) pcquantum`" >> version.go.tmp
515         echo "  _StackAlign = `$(SHELL) $(srcdir)/goarch.sh $(GOARCH) stackalign`" >> 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         $(SHELL) $(srcdir)/mvifdiff.sh version.go.tmp version.go
529         $(STAMP) $@
531 cpugen.go: s-cpu; @true
532 s-cpu: Makefile
533         rm -f cpugen.go.tmp
534         echo "package cpu" > cpugen.go.tmp
535         echo "const CacheLinePadSize = `$(SHELL) $(srcdir)/goarch.sh $(GOARCH) cachelinesize`" >> cpugen.go.tmp
536         echo "const FunctionDescriptors = $(FUNCTION_DESCRIPTORS)" >> cpugen.go.tmp
537         $(SHELL) $(srcdir)/mvifdiff.sh cpugen.go.tmp cpugen.go
538         $(STAMP) $@
540 gcpugen.go: s-gcpu; @true
541 s-gcpu: Makefile
542         rm -f gcpugen.go.tmp
543         echo "package cpu" > gcpugen.go.tmp
544         echo "const cacheLineSize = `$(SHELL) $(srcdir)/goarch.sh $(GOARCH) cachelinesize`" >> gcpugen.go.tmp
545         $(SHELL) $(srcdir)/mvifdiff.sh gcpugen.go.tmp gcpugen.go
546         $(STAMP) $@
548 buildcfg.go: s-buildcfg; @true
549 s-buildcfg: Makefile
550         rm -f buildcfg.go.tmp
551         echo "package buildcfg" > buildcfg.go.tmp
552         echo "import \"runtime\"" >> buildcfg.go.tmp
553         echo 'func defaultGOROOTValue() string { return `$(prefix)` }' >> buildcfg.go.tmp
554         echo 'const defaultGO386 = `sse2`' >> buildcfg.go.tmp
555         echo 'const defaultGOARM = `5`' >> buildcfg.go.tmp
556         echo 'const defaultGOMIPS = `hardfloat`' >> buildcfg.go.tmp
557         echo 'const defaultGOMIPS64 = `hardfloat`' >> buildcfg.go.tmp
558         echo 'const defaultGOPPC64 = `power8`' >> buildcfg.go.tmp
559         echo 'const defaultGOEXPERIMENT = `fieldtrack`' >> buildcfg.go.tmp
560         echo 'const defaultGO_EXTLINK_ENABLED = ``' >> buildcfg.go.tmp
561         echo 'const defaultGO_LDSO = ``' >> buildcfg.go.tmp
562         echo 'const version = `'`cat $(srcdir)/VERSION | sed 1q`' '`$(GOC) --version | sed 1q`'`' >> buildcfg.go.tmp
563         echo 'const defaultGOOS = runtime.GOOS' >> buildcfg.go.tmp
564         echo 'const defaultGOARCH = runtime.GOARCH' >> buildcfg.go.tmp
565         $(SHELL) $(srcdir)/mvifdiff.sh buildcfg.go.tmp buildcfg.go
566         $(STAMP) $@
568 objabi.go: s-objabi; @true
569 s-objabi: Makefile
570         rm -f objabi.go.tmp
571         echo "package objabi" > objabi.go.tmp
572         echo 'const stackGuardMultiplierDefault = 1' >> objabi.go.tmp
573         $(SHELL) $(srcdir)/mvifdiff.sh objabi.go.tmp objabi.go
574         $(STAMP) $@
576 gccgosizes.go: s-gccgosizes; @true
577 s-gccgosizes: Makefile goarch.sh
578         rm -f gccgosizes.go.tmp
579         echo "package types" > gccgosizes.go.tmp
580         echo >> gccgosizes.go.tmp
581         echo "var gccgoArchSizes = map[string]*StdSizes{" >> gccgosizes.go.tmp
582         for a in $(ALLGOARCH); do \
583           ptrsize=`$(SHELL) $(srcdir)/goarch.sh $$a ptrsize`; \
584           maxalign=`$(SHELL) $(srcdir)/goarch.sh $$a maxalign`; \
585           echo "        \"$$a\": {$${ptrsize}, $${maxalign}}," >> gccgosizes.go.tmp; \
586         done
587         echo "}" >> gccgosizes.go.tmp
588         $(SHELL) $(srcdir)/mvifdiff.sh gccgosizes.go.tmp gccgosizes.go
589         $(STAMP) $@
591 os_linknames.go: s-os_linknames; @true
592 s-os_linknames: os-list gen-sysinfo.go $(srcdir)/mklinknames.awk $(srcdir)/go/os/*.go
593         rm -f os_linknames.go.tmp
594         $(AWK) -f $(srcdir)/mklinknames.awk -v package=os `cat os-list` > os_linknames.go.tmp
595         $(SHELL) $(srcdir)/mvifdiff.sh os_linknames.go.tmp os_linknames.go
596         $(STAMP) $@
598 os-list: s-os-list; @true
599 s-os-list: Makefile $(srcdir)/go/os/*.go
600         rm -f os-list.tmp
601         $(SHELL) $(srcdir)/match.sh --goarch=$(GOARCH) --goos=$(GOOS) --srcdir=$(srcdir)/go/os > os-list.tmp
602         $(SHELL) $(srcdir)/mvifdiff.sh os-list.tmp os-list
603         $(STAMP) $@
605 os_user_linknames.go: s-os_user_linknames; @true
606 s-os_user_linknames: os-user-list gen-sysinfo.go $(srcdir)/mklinknames.awk $(srcdir)/go/os/user/*.go
607         rm -f os_user_linknames.go.tmp
608         $(AWK) -f $(srcdir)/mklinknames.awk -v package=user `cat os-user-list` > os_user_linknames.go.tmp
609         $(SHELL) $(srcdir)/mvifdiff.sh os_user_linknames.go.tmp os_user_linknames.go
610         $(STAMP) $@
612 os-user-list: s-os-user-list; @true
613 s-os-user-list: Makefile $(srcdir)/go/os/user/*.go
614         rm -f os-user-list.tmp
615         $(SHELL) $(srcdir)/match.sh --goarch=$(GOARCH) --goos=$(GOOS) --srcdir=$(srcdir)/go/os/user > os-user-list.tmp
616         $(SHELL) $(srcdir)/mvifdiff.sh os-user-list.tmp os-user-list
617         $(STAMP) $@
619 runtime_linknames.go: s-runtime_linknames; @true
620 s-runtime_linknames: runtime-list gen-sysinfo.go $(srcdir)/mklinknames.awk $(srcdir)/go/runtime/*.go
621         rm -f runtime_linknames.go.tmp
622         $(AWK) -f $(srcdir)/mklinknames.awk -v package=runtime `cat runtime-list` > runtime_linknames.go.tmp
623         $(SHELL) $(srcdir)/mvifdiff.sh runtime_linknames.go.tmp runtime_linknames.go
624         $(STAMP) $@
626 runtime-list: s-runtime-list; @true
627 s-runtime-list: Makefile $(srcdir)/go/runtime/*.go
628         rm -f runtime-list.tmp
629         $(SHELL) $(srcdir)/match.sh --goarch=$(GOARCH) --goos=$(GOOS) --srcdir=$(srcdir)/go/runtime > runtime-list.tmp
630         $(SHELL) $(srcdir)/mvifdiff.sh runtime-list.tmp runtime-list
631         $(STAMP) $@
633 runtime_sysinfo.go: s-runtime_sysinfo; @true
634 s-runtime_sysinfo: $(srcdir)/mkrsysinfo.sh gen-sysinfo.go
635         GOARCH=$(GOARCH) GOOS=$(GOOS) $(SHELL) $(srcdir)/mkrsysinfo.sh
636         $(SHELL) $(srcdir)/mvifdiff.sh tmp-runtime_sysinfo.go runtime_sysinfo.go
637         $(STAMP) $@
639 sigtab.go: s-sigtab; @true
640 s-sigtab: $(srcdir)/mksigtab.sh gen-sysinfo.go
641         GOOS=$(GOOS) $(SHELL) $(srcdir)/mksigtab.sh > tmp-sigtab.go
642         $(SHELL) $(srcdir)/mvifdiff.sh tmp-sigtab.go sigtab.go
643         $(STAMP) $@
645 GCCGO_INSTALL_NAME := $(shell echo gccgo|sed '$(program_transform_name)')
646 GCC_INSTALL_NAME := $(shell echo gcc|sed '$(program_transform_name)')
647 GXX_INSTALL_NAME := $(shell echo g++|sed '$(program_transform_name)')
649 zdefaultcc.go: s-zdefaultcc; @true
650 s-zdefaultcc: Makefile
651         echo 'package cfg' > zdefaultcc.go.tmp
652         echo >> zdefaultcc.go.tmp
653         echo 'func DefaultGCCGO(goos, goarch string) string { return "$(bindir)/$(GCCGO_INSTALL_NAME)" }' >> zdefaultcc.go.tmp
654         echo 'func DefaultCC(goos, goarch string) string { return "$(GCC_INSTALL_NAME)" }' >> zdefaultcc.go.tmp
655         echo 'func DefaultCXX(goos, goarch string) string { return "$(GXX_INSTALL_NAME)" }' >> zdefaultcc.go.tmp
656         echo 'const DefaultPkgConfig = "pkg-config"' >> zdefaultcc.go.tmp
657         echo 'var OSArchSupportsCgo = map[string]bool{}' >> zdefaultcc.go.tmp
658         $(SHELL) $(srcdir)/../move-if-change zdefaultcc.go.tmp zdefaultcc.go
659         $(STAMP) $@ 
661 # Post-process runtime.inc.raw (raw output of -fgo-c-header option when
662 # compiling runtime) to prune out certain types that should not be
663 # exported back to C. See comments in mkruntimeinc.sh for more details.
664 runtime.inc: s-runtime-inc; @true
665 s-runtime-inc: runtime.lo mkruntimeinc.sh Makefile
666         $(SHELL) $(srcdir)/mkruntimeinc.sh
667         $(SHELL) $(srcdir)/mvifdiff.sh tmp-runtime.inc runtime.inc
668         $(STAMP) $@
670 noinst_DATA += zdefaultcc.go
672 # Generate the list of go std packages that were included in libgo
673 zstdpkglist.go: s-zstdpkglist; @true
674 s-zstdpkglist: Makefile libgo-packages.txt
675         rm -f zstdpkglist.go.tmp
676         echo 'package goroot' > zstdpkglist.go.tmp
677         echo "" >> zstdpkglist.go.tmp
678         echo 'var stdpkg = map[string]bool{' >> zstdpkglist.go.tmp
679         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
680         echo '}' >> zstdpkglist.go.tmp
681         $(SHELL) $(srcdir)/mvifdiff.sh zstdpkglist.go.tmp zstdpkglist.go
682         $(STAMP) $@
684 if LIBGO_IS_LINUX
685 syscall_epoll_file = epoll.go
686 else
687 syscall_epoll_file =
688 endif
690 libcalls.go: s-libcalls; @true
691 s-libcalls: libcalls-list go/syscall/mksyscall.awk $(srcdir)/go/syscall/*.go
692         rm -f libcalls.go.tmp
693         $(AWK) -f $(srcdir)/go/syscall/mksyscall.awk `cat libcalls-list` > libcalls.go.tmp
694         $(SHELL) $(srcdir)/mvifdiff.sh libcalls.go.tmp libcalls.go
695         $(STAMP) $@
697 libcalls-list: s-libcalls-list; @true
698 s-libcalls-list: Makefile $(srcdir)/go/syscall/*.go
699         rm -f libcalls-list.tmp
700         $(SHELL) $(srcdir)/match.sh --goarch=$(GOARCH) --goos=$(GOOS) --srcdir=$(srcdir)/go/syscall $(matchargs_syscall) > libcalls-list.tmp
701         $(SHELL) $(srcdir)/mvifdiff.sh libcalls-list.tmp libcalls-list
702         $(STAMP) $@
704 syscall_arch.go: s-syscall_arch; @true
705 s-syscall_arch: Makefile
706         rm -f syscall_arch.go.tmp
707         echo "package syscall" > syscall_arch.go.tmp
708         echo 'const ARCH = "'$(GOARCH)'"' >> syscall_arch.go.tmp
709         echo 'const OS = "'$(GOOS)'"' >> syscall_arch.go.tmp
710         $(SHELL) $(srcdir)/mvifdiff.sh syscall_arch.go.tmp syscall_arch.go
711         $(STAMP) $@
713 syscall_linknames.go: s-syscall_linknames; @true
714 s-syscall_linknames: libcalls.go gen-sysinfo.go $(srcdir)/mklinknames.awk
715         rm -f syscall_linknames.go.tmp
716         $(AWK) -v package=syscall -f $(srcdir)/mklinknames.awk libcalls.go > syscall_linknames.go.tmp
717         $(SHELL) $(srcdir)/mvifdiff.sh syscall_linknames.go.tmp syscall_linknames.go
718         $(STAMP) $@
720 SYSINFO_FLAGS = \
721         $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \
722         $(CPPFLAGS) $(OSCFLAGS) -O
724 gen-sysinfo.go: s-gen-sysinfo; @true
725 s-gen-sysinfo: $(srcdir)/sysinfo.c config.h
726         $(CC) $(SYSINFO_FLAGS) -fdump-go-spec=tmp-gen-sysinfo.go -std=gnu99 -S -o sysinfo.s $(srcdir)/sysinfo.c
727         rm -f sysinfo.s
728         $(SHELL) $(srcdir)/mvifdiff.sh tmp-gen-sysinfo.go gen-sysinfo.go
729         $(STAMP) $@
731 errno.i: s-errno; @true
732 s-errno:
733         echo '#include <errno.h>' | $(CC) $(SYSINFO_FLAGS) -x c - -E -dM > tmp-errno.i
734         $(SHELL) $(srcdir)/mvifdiff.sh tmp-errno.i errno.i
735         $(STAMP) $@
737 sysinfo.go: s-sysinfo; @true
738 s-sysinfo: $(srcdir)/mksysinfo.sh gen-sysinfo.go errno.i
739         GOARCH=$(GOARCH) GOOS=$(GOOS) $(SHELL) $(srcdir)/mksysinfo.sh
740         $(SHELL) $(srcdir)/mvifdiff.sh tmp-sysinfo.go sysinfo.go
741         $(STAMP) $@
743 # The epoll struct has an embedded union and is packed on x86_64,
744 # which is too complicated for mksysinfo.sh.  We find the offset of
745 # the only field we care about in configure.ac, and generate the
746 # struct here.
747 epoll.go: s-epoll; @true
748 s-epoll: Makefile
749         rm -f epoll.go.tmp
750         echo 'package syscall' > epoll.go.tmp
751         echo 'type EpollEvent struct {' >> epoll.go.tmp
752         echo '  Events uint32' >> epoll.go.tmp
753         case "$(SIZEOF_STRUCT_EPOLL_EVENT),$(STRUCT_EPOLL_EVENT_FD_OFFSET)" in \
754         0,0) echo 1>&2 "*** struct epoll_event data.fd offset unknown"; \
755            exit 1; ;; \
756         8,4) echo '     Fd int32' >> epoll.go.tmp; ;; \
757         12,4) echo '    Fd int32' >> epoll.go.tmp; \
758            echo '       Pad [4]byte' >> epoll.go.tmp; ;; \
759         12,8) echo '    Pad [4]byte' >> epoll.go.tmp; \
760            echo '       Fd int32' >> epoll.go.tmp; ;; \
761         16,8) echo '    Pad [4]byte' >> epoll.go.tmp; \
762            echo '       Fd int32' >> epoll.go.tmp; \
763            echo '       Pad2 [4]byte' >> epoll.go.tmp; ;; \
764         *) echo 1>&2 "*** struct epoll_event unsupported"; \
765            exit 1; ;; \
766         esac
767         echo '}' >> epoll.go.tmp
768         $(SHELL) $(srcdir)/mvifdiff.sh epoll.go.tmp epoll.go
769         $(STAMP) $@
771 if LIBGO_IS_LINUX
772 syscall_lib_clone_lo = syscall/clone_linux.lo
773 else
774 syscall_lib_clone_lo =
775 endif
777 if LIBGO_IS_X86
778 golangorg_x_sys_cpu_gccgo_x86_lo = golang.org/x/sys/cpu_gccgo_x86.lo
779 else
780 golangorg_x_sys_cpu_gccgo_x86_lo =
781 endif
783 PACKAGES = $(shell cat $(srcdir)/libgo-packages.txt)
785 libgo_go_objs = \
786         $(addsuffix .lo,$(PACKAGES)) \
787         internal/bytealg/bytealg.lo \
788         reflect/makefunc_ffi_c.lo \
789         $(syscall_lib_clone_lo) \
790         syscall/errno.lo \
791         syscall/signame.lo \
792         syscall/wait.lo \
793         os/dir_gccgo_c.lo \
794         $(golangorg_x_net_lif_lo) \
795         $(golangorg_x_net_route_lo) \
796         log/syslog/syslog_c.lo \
797         $(os_lib_inotify_lo) \
798         runtime/internal/atomic_c.lo \
799         sync/atomic_c.lo \
800         internal/cpu/cpu_gccgo.lo \
801         $(golangorg_x_sys_cpu_gccgo_x86_lo)
803 libgo_ldflags = \
804         -version-info $(libtool_VERSION) $(PTHREAD_CFLAGS) $(AM_LDFLAGS)
806 libgo_libadd = \
807         $(libgo_go_objs) ../libbacktrace/libbacktrace.la \
808         $(LIBATOMIC) $(LIBFFI) $(PTHREAD_LIBS) $(MATH_LIBS) $(NET_LIBS)
810 libgo_la_SOURCES = $(runtime_files)
811 libgo_la_LDFLAGS = $(libgo_ldflags)
812 libgo_la_LIBADD = $(libgo_libadd)
814 libgo_llgo_la_SOURCES = $(runtime_files)
815 libgo_llgo_la_LDFLAGS = $(libgo_ldflags)
816 libgo_llgo_la_LIBADD = $(libgo_libadd)
818 libgobegin_a_SOURCES = \
819         runtime/go-main.c
821 libgobegin_llgo_a_SOURCES = \
822         runtime/go-main.c
824 # Use -fPIC for libgobegin so that it can be put in a PIE.
825 libgobegin_a_CFLAGS = $(AM_CFLAGS) -fPIC
826 libgobegin_llgo_a_CFLAGS = $(AM_CFLAGS) -fPIC
828 libgolibbegin_a_SOURCES = \
829         runtime/go-libmain.c
831 libgolibbegin_a_CFLAGS = $(AM_CFLAGS) -fPIC
833 GOTOOL_PACKAGES = $(shell cat $(srcdir)/gotool-packages.txt)
835 libgotool_a_SOURCES =
836 libgotool_a_DEPENDENCIES = $(addsuffix .lo,$(GOTOOL_PACKAGES))
837 libgotool_a_LIBADD = $(addsuffix .o,$(GOTOOL_PACKAGES))
839 define STATIC_template
840 $(subst -,_,$(subst .,_,$(subst /,_,$(1))))_GOCFLAGS = -static
841 endef
843 $(foreach package,$(GOTOOL_PACKAGES),$(eval $(call STATIC_template,$(package).lo)))
845 # Make sure runtime.inc is built before compiling any .c file.
846 $(libgo_la_OBJECTS): runtime.inc
847 $(libgo_llgo_la_OBJECTS): runtime.inc
848 $(libgobegin_a_OBJECTS): runtime.inc
849 $(libgobegin_llgo_a_OBJECTS): runtime.inc
850 $(libgolibbegin_a_OBJECTS): runtime.inc
852 LTLDFLAGS = $(shell $(SHELL) $(top_srcdir)/../libtool-ldflags $(LDFLAGS))
854 GOCFLAGS = $(CFLAGS)
855 AM_GOCFLAGS = $(STRINGOPS_FLAG) $(GO_SPLIT_STACK)
856 GOCOMPILE = $(GOC) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_GOCFLAGS) $(GOCFLAGS)
858 LTGOCOMPILE = $(LIBTOOL) --tag GO --mode=compile $(GOC) $(INCLUDES) \
859         $(AM_GOCFLAGS) $(GOCFLAGS)
861 GOLINK = $(LIBTOOL) --tag GO --mode-link $(GOC) \
862         $(OPT_LDFLAGS) $(SECTION_LDFLAGS) $(AM_GOCFLAGS) $(LTLDFLAGS) -o $@
864 # Build the dependencies for a Go package.
865 BUILDDEPS = \
866         $(MKDIR_P) $(@D); \
867         dir=`echo $@ | sed -e 's/.lo.dep$$//'`; \
868         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,,$@)))`; \
869         $(SHELL) $(srcdir)/godeps.sh `echo $@ | sed -e 's/.dep$$//'` $$files > $@.tmp; \
870         if ! cmp $@.tmp $@ >/dev/null 2>/dev/null; then \
871           rm -f `echo $@ | sed -e 's/\.dep$$//'`; \
872         fi; \
873         mv -f $@.tmp $@
875 # Build the .go files for a package, generating a .lo file.
876 BUILDPACKAGE = \
877         $(MKDIR_P) $(@D); \
878         files=`echo $^ | sed -e 's/[^ ]*\.gox//g' -e 's/[^ ]*\.dep//'`; \
879         $(LTGOCOMPILE) -I . -c -fgo-pkgpath=`echo $@ | sed -e 's/.lo$$//'` $($(subst -,_,$(subst .,_,$(subst /,_,$@)))_GOCFLAGS) -o $@ $$files
881 # How to build a .gox file from a .lo file.
882 # Matching .o file can either be in the same directory as the .lo (non-PIC
883 # object) or in the .libs directory (PIC object).
884 BUILDGOX = \
885         f="$(basename $<).o"; \
886         if test ! -f $$f; then \
887           f="$(basename $(<D)/.libs/$(<F)).o"; \
888         fi; \
889         $(OBJCOPY) -j $(GO_EXPORT_SECTION_NAME) $$f $@.tmp; \
890         $(SHELL) $(srcdir)/mvifdiff.sh $@.tmp `echo $@ | sed -e 's/s-gox/gox/'`
892 GOTESTFLAGS =
893 GOBENCH = 
895 # Check a package.
896 CHECK = \
897         GC="$(GOC) $(GOCFLAGS) $($(subst /,_,$@)_GOCFLAGS) -L `${PWD_COMMAND}` -L `${PWD_COMMAND}`/.libs"; \
898         export GC; \
899         GOLIBS="$(extra_check_libs_$(subst .,_,$(subst /,_,$(@D)))) $(PTHREAD_LIBS) $(MATH_LIBS) $(NET_LIBS) $(LIBS)"; \
900         export GOLIBS; \
901         RUNTESTFLAGS="$(RUNTESTFLAGS)"; \
902         export RUNTESTFLAGS; \
903         MAKE="$(MAKE)"; \
904         export MAKE; \
905         NM="$(NM)"; \
906         export NM; \
907         libgccdir=`${GOC} ${GOCFLAGS} -print-libgcc-file-name | sed -e 's|/[^/]*$$||'`; \
908         LD_LIBRARY_PATH="`${PWD_COMMAND}`/.libs:$${libgccdir}:${LD_LIBRARY_PATH}"; \
909         LD_LIBRARY_PATH=`echo $${LD_LIBRARY_PATH} | sed 's,::*,:,g;s,^:*,,;s,:*$$,,'`; \
910         export LD_LIBRARY_PATH; \
911         $(MKDIR_P) $(@D); \
912         rm -f $@-testsum $@-testlog; \
913         files=`$(SHELL) $(srcdir)/match.sh --goarch=$(GOARCH) --goos=$(GOOS) --srcdir=$(srcdir)/go/$(@D) --extrafiles="$(extra_go_files_$(subst .,_,$(subst /,_,$(@D))))" $(matchargs_$(subst /,_,$(@D)))`; \
914         if test "$(USE_DEJAGNU)" = "yes"; then \
915           $(SHELL) $(srcdir)/testsuite/gotest --goarch=$(GOARCH) --goos=$(GOOS) --dejagnu=yes --basedir=$(srcdir) --srcdir=$(srcdir)/go/$(@D) --pkgpath="$(@D)" --pkgfiles="$$files" --testname="$(@D)" $(GOTESTFLAGS); \
916         elif test "$(GOBENCH)" != ""; then \
917           $(SHELL) $(srcdir)/testsuite/gotest --goarch=$(GOARCH) --goos=$(GOOS) --basedir=$(srcdir) --srcdir=$(srcdir)/go/$(@D) --pkgpath="$(@D)" --pkgfiles="$$files" --bench="$(GOBENCH)" $(GOTESTFLAGS); \
918         else \
919           if $(SHELL) $(srcdir)/testsuite/gotest --goarch=$(GOARCH) --goos=$(GOOS) --basedir=$(srcdir) --srcdir=$(srcdir)/go/$(@D) --pkgpath="$(@D)" --pkgfiles="$$files" $(GOTESTFLAGS) >>$@-testlog 2>&1; then \
920             echo "PASS: $(@D)" >> $@-testlog; \
921             echo "PASS: $(@D)"; \
922             echo "PASS: $(@D)" > $@-testsum; \
923           else \
924             echo "FAIL: $(@D)" >> $@-testlog; \
925             cat $@-testlog; \
926             echo "FAIL: $(@D)" > $@-testsum; \
927             exit 1; \
928           fi; \
929         fi
931 # Build all packages before checking any.
932 CHECK_DEPS = \
933         $(toolexeclibgo_DATA) \
934         $(toolexeclibgoarchive_DATA) \
935         $(toolexeclibgocompress_DATA) \
936         $(toolexeclibgocontainer_DATA) \
937         $(toolexeclibgocrypto_DATA) \
938         $(toolexeclibgodebug_DATA) \
939         $(toolexeclibgoencoding_DATA) \
940         $(toolexeclibgogo_DATA) \
941         $(toolexeclibgohash_DATA) \
942         $(toolexeclibgoimage_DATA) \
943         $(toolexeclibgoindex_DATA) \
944         $(toolexeclibgoio_DATA) \
945         $(toolexeclibgolog_DATA) \
946         $(toolexeclibgomath_DATA) \
947         $(toolexeclibgomime_DATA) \
948         $(toolexeclibgonet_DATA) \
949         $(toolexeclibgonethttp_DATA) \
950         $(toolexeclibgoos_DATA) \
951         $(toolexeclibgopath_DATA) \
952         $(toolexeclibgorpc_DATA) \
953         $(toolexeclibgoruntime_DATA) \
954         $(toolexeclibgosync_DATA) \
955         $(toolexeclibgotesting_DATA) \
956         $(toolexeclibgotext_DATA) \
957         $(toolexeclibgotexttemplate_DATA) \
958         $(toolexeclibgounicode_DATA) \
959         $(noinst_DATA) \
960         $(noinst_LIBRARIES)
962 if GOC_IS_LLGO
963 CHECK_DEPS += libgo-llgo.la libgobegin-llgo.a
964 else
965 CHECK_DEPS += libgo.la libgobegin.a
966 endif
968 # PACKAGE_template defines the rules for each package.
969 # For example, for the package bufio, it produces:
971 # @go_include@ bufio.lo.dep
972 # bufio.lo.dep: $(srcdir)/go/bufio/*.go
973 #       $(BUILDDEPS)
974 # bufio.lo:
975 #       $(BUILDPACKAGE)
976 # bufio/check: $(CHECK_DEPS)
977 #       @$(CHECK)
978 # .PHONY: bufio/check
980 # This is invoked with $(1) set to a package, which is a directory name,
981 # such as "bufio" or "archive/tar".
982 define PACKAGE_template
983 @go_include@ $(1).lo.dep
984 $(1).lo.dep: $(srcdir)/go/$(1)/*.go
985         $$(BUILDDEPS)
986 $(1).lo:
987         $$(BUILDPACKAGE)
988 $(1)/check: $$(CHECK_DEPS)
989         @$$(CHECK)
990 .PHONY: $(1)/check
991 $(1).gox: $(1).s-gox; @true
992 $(1).s-gox: $(1).lo
993         $$(BUILDGOX)
994         $$(STAMP) $$@
995 endef
997 # This line expands PACKAGE_template once for each package name listed
998 # in $(PACKAGES).
999 $(foreach package,$(PACKAGES),$(eval $(call PACKAGE_template,$(package))))
1000 $(foreach package,$(GOTOOL_PACKAGES),$(eval $(call PACKAGE_template,$(package))))
1002 # Pass -ffp-contract=off, or 386-specific options, when building the
1003 # math package.  MATH_FLAG is defined in configure.ac.
1004 math_lo_GOCFLAGS = $(MATH_FLAG)
1005 math_check_GOCFLAGS = $(MATH_FLAG)
1007 # Add generated files to the runtime package.
1008 extra_go_files_runtime = runtime_linknames.go runtime_sysinfo.go sigtab.go
1009 runtime.lo.dep: $(extra_go_files_runtime)
1011 # Add generated files to the syscall package.
1012 extra_go_files_syscall = \
1013         libcalls.go \
1014         sysinfo.go \
1015         syscall_arch.go \
1016         syscall_linknames.go \
1017         $(syscall_epoll_file)
1018 syscall.lo.dep: $(extra_go_files_syscall)
1020 # Pass -fgo-compiling-runtime when compiling the runtime package.
1021 runtime_lo_GOCFLAGS = -fgo-c-header=runtime.inc.raw -fgo-compiling-runtime
1022 runtime_check_GOCFLAGS = -fgo-compiling-runtime
1023 runtime_internal_atomic_lo_GOCFLAGS = -fgo-compiling-runtime
1024 runtime_internal_atomic_lo_check_GOCFLAGS = -fgo-compiling-runtime
1025 runtime_internal_sys_lo_GOCFLAGS = -fgo-compiling-runtime
1026 runtime_internal_sys_lo_check_GOCFLAGS = -fgo-compiling-runtime
1028 # If libffi is supported (the normal case) use the ffi build tag for
1029 # the runtime package.
1030 if USE_LIBFFI
1031 matchargs_runtime = --tag=libffi
1032 else
1033 matchargs_runtime =
1034 endif
1036 # At least for now, we need -static-libgo for this test, because
1037 # otherwise we can't get the line numbers.
1038 # Also use -fno-inline to get better results from the memory profiler.
1039 runtime_pprof_check_GOCFLAGS = -static-libgo -fno-inline
1041 if LIBGO_IS_AIX
1042 # reflect tests must be done with -static-libgo. Otherwize,
1043 # there will be a duplication of the canonicalization map.
1044 reflect_check_GOCFLAGS = -static-libgo -Wl,-bbigtoc
1045 endif
1047 if HAVE_STATIC_LINK
1048 # Use -static for the syscall tests if possible, because otherwise when
1049 # running as root the re-execs ignore LD_LIBRARY_PATH.
1050 syscall_check_GOCFLAGS = -static
1051 endif
1053 extra_go_files_runtime_internal_sys = version.go
1054 runtime/internal/sys.lo.dep: $(extra_go_files_runtime_internal_sys)
1056 extra_go_files_internal_cpu = cpugen.go
1057 internal/cpu.lo.dep: $(extra_go_files_internal_cpu)
1059 extra_go_files_golang_org_x_sys_cpu = gcpugen.go
1060 golang.org/x/sys/cpu.lo.dep: $(extra_go_files_golang_org_x_sys_cpu)
1062 extra_go_files_internal_buildcfg = buildcfg.go
1063 cmd/internal/buildcfg.lo.dep: $(extra_go_files_internal_buildcfg)
1065 extra_go_files_internal_goroot = zstdpkglist.go
1066 internal/goroot.lo.dep: $(extra_go_files_internal_goroot)
1068 extra_go_files_go_types = gccgosizes.go
1069 go/types.lo.dep: $(extra_go_files_go_types)
1071 extra_go_files_cmd_internal_objabi = objabi.go
1072 cmd/internal/objabi.lo.dep: $(extra_go_files_cmd_internal_objabi)
1074 extra_go_files_cmd_go_internal_cfg = zdefaultcc.go
1075 cmd/go/internal/cfg.lo.dep: $(extra_go_files_cmd_go_internal_cfg)
1077 extra_go_files_os = os_linknames.go
1078 os.lo.dep: $(extra_go_files_os)
1080 extra_go_files_os_user = os_user_linknames.go
1081 os/user.lo.dep: $(extra_go_files_os_user)
1083 extra_check_libs_cmd_go_internal_cache = $(abs_builddir)/libgotool.a
1084 extra_check_libs_cmd_go_internal_fsys = $(abs_builddir)/libgotool.a
1085 extra_check_libs_cmd_go_internal_generate = $(abs_builddir)/libgotool.a
1086 extra_check_libs_cmd_go_internal_get = $(abs_builddir)/libgotool.a
1087 extra_check_libs_cmd_go_internal_load = $(abs_builddir)/libgotool.a
1088 extra_check_libs_cmd_go_internal_lockedfile = $(abs_builddir)/libgotool.a
1089 extra_check_libs_cmd_go_internal_imports = $(abs_builddir)/libgotool.a
1090 extra_check_libs_cmd_go_internal_modconv = $(abs_builddir)/libgotool.a
1091 extra_check_libs_cmd_go_internal_modfetch = $(abs_builddir)/libgotool.a
1092 extra_check_libs_cmd_go_internal_modfetch_codehost = $(abs_builddir)/libgotool.a
1093 extra_check_libs_cmd_go_internal_modfile = $(abs_builddir)/libgotool.a
1094 extra_check_libs_cmd_go_internal_modload = $(abs_builddir)/libgotool.a
1095 extra_check_libs_cmd_go_internal_module = $(abs_builddir)/libgotool.a
1096 extra_check_libs_cmd_go_internal_mvs = $(abs_builddir)/libgotool.a
1097 extra_check_libs_cmd_go_internal_search = $(abs_builddir)/libgotool.a
1098 extra_check_libs_cmd_go_internal_str = $(abs_builddir)/libgotool.a
1099 extra_check_libs_cmd_go_internal_test = $(abs_builddir)/libgotool.a
1100 extra_check_libs_cmd_go_internal_vcs = $(abs_builddir)/libgotool.a
1101 extra_check_libs_cmd_go_internal_web2 = $(abs_builddir)/libgotool.a
1102 extra_check_libs_cmd_go_internal_work = $(abs_builddir)/libgotool.a
1104 extra_check_libs_cmd_internal_buildid = $(abs_builddir)/libgotool.a
1106 extra_check_libs_cmd_vet_internal_cfg = $(abs_builddir)/libgotool.a
1108 # FIXME: The following C files may as well move to the runtime
1109 # directory and be treated like other C files.
1111 # Use C code to speed up internal/bytealg.IndexByte and friends.
1112 internal/bytealg/bytealg.lo: go/internal/bytealg/bytealg.c runtime.inc
1113         @$(MKDIR_P) internal/bytealg
1114         $(LTCOMPILE) -c -o $@ $(srcdir)/go/internal/bytealg/bytealg.c
1116 # Use a C function with a fixed number of arguments to call a C
1117 # varargs function.
1118 log/syslog/syslog_c.lo: go/log/syslog/syslog_c.c runtime.inc
1119         @$(MKDIR_P) log/syslog
1120         $(LTCOMPILE) -c -o $@ $(srcdir)/go/log/syslog/syslog_c.c
1122 # The interface to libffi from the reflect package is written in C.
1123 reflect/makefunc_ffi_c.lo: go/reflect/makefunc_ffi_c.c runtime.inc
1124         @$(MKDIR_P) reflect
1125         $(LTCOMPILE) -c -o $@ $(srcdir)/go/reflect/makefunc_ffi_c.c
1127 # The atomic functions are written in C.
1128 runtime/internal/atomic_c.lo: go/runtime/internal/atomic/atomic.c runtime.inc
1129         @$(MKDIR_P) runtime/internal
1130         $(LTCOMPILE) -c -o $@ $(srcdir)/go/runtime/internal/atomic/atomic.c
1131 sync/atomic_c.lo: go/sync/atomic/atomic.c runtime.inc
1132         @$(MKDIR_P) sync
1133         $(LTCOMPILE) -c -o $@ $(srcdir)/go/sync/atomic/atomic.c
1135 # A few syscall functions are written in C.
1136 syscall/clone_linux.lo: go/syscall/clone_linux.c runtime.inc
1137         @$(MKDIR_P) syscall
1138         $(LTCOMPILE) -c -o $@ $(srcdir)/go/syscall/clone_linux.c
1139 syscall/errno.lo: go/syscall/errno.c runtime.inc
1140         @$(MKDIR_P) syscall
1141         $(LTCOMPILE) -c -o $@ $(srcdir)/go/syscall/errno.c
1142 syscall/signame.lo: go/syscall/signame.c runtime.inc
1143         @$(MKDIR_P) syscall
1144         $(LTCOMPILE) -c -o $@ $(srcdir)/go/syscall/signame.c
1145 syscall/wait.lo: go/syscall/wait.c runtime.inc
1146         @$(MKDIR_P) syscall
1147         $(LTCOMPILE) -c -o $@ $(srcdir)/go/syscall/wait.c
1149 # An os function is written in C.
1150 os/dir_gccgo_c.lo: go/os/dir_gccgo_c.c runtime.inc
1151         @$(MKDIR_P) os
1152         $(LTCOMPILE) -c -o $@ $(srcdir)/go/os/dir_gccgo_c.c
1154 # internal/cpu needs some C code.
1155 internal/cpu/cpu_gccgo.lo: go/internal/cpu/cpu_gccgo.c runtime.inc
1156         @$(MKDIR_P) internal/cpu
1157         $(LTCOMPILE) -c -o $@ $(srcdir)/go/internal/cpu/cpu_gccgo.c
1159 # Similarly, golang.org/x/sys/cpu needs some C code.
1160 golang.org/x/sys/cpu_gccgo_x86.lo: go/golang.org/x/sys/cpu/cpu_gccgo_x86.c runtime.inc
1161         @$(MKDIR_P) golang.org/x/sys
1162         $(LTCOMPILE) -c -o $@ $(srcdir)/go/golang.org/x/sys/cpu/cpu_gccgo_x86.c
1164 # Solaris 11.4 changed the type of fields in struct stat.
1165 # Use a build tag, based on a configure check, to cope.
1166 if LIBGO_IS_SOLARIS
1167 if HAVE_STAT_TIMESPEC
1168 matchargs_os = --tag=solaristag
1169 else
1170 matchargs_os =
1171 endif
1172 else
1173 matchargs_os =
1174 endif
1176 if LIBGO_IS_BSD
1178 # Build golang.org/x/net/route only on BSD systems.
1180 $(eval $(call PACKAGE_template,golang.org/x/net/route))
1182 golangorg_x_net_route_lo = \
1183         golang.org/x/net/route.lo
1185 endif
1187 if LIBGO_IS_SOLARIS
1189 # Build golang.org/x/net/lif only on Solaris systems.
1191 $(eval $(call PACKAGE_template,golang.org/x/net/lif))
1193 golangorg_x_net_lif_lo = \
1194         golang.org/x/net/lif.lo
1196 endif
1198 TEST_PACKAGES = $(addsuffix /check,$(shell cat $(srcdir)/check-packages.txt))
1200 check: check-tail
1201 check-recursive: check-head
1203 check-head:
1204         @echo "Test Run By $${USER} on `date`" > libgo.head
1205         @echo "Native configuration is $(host_triplet)" >> libgo.head
1206         @echo >> libgo.head
1207         @echo "         === libgo tests ===" >> libgo.head
1208         @echo >> libgo.head
1210 check-tail: check-recursive check-multi
1211         @if test "$(USE_DEJAGNU)" = "yes"; then \
1212           exit 0; \
1213         fi; \
1214         lib=`${PWD_COMMAND} | sed -e 's,^.*/\([^/][^/]*\)$$,\1,'`; \
1215         for dir in . $(MULTIDIRS); do \
1216           mv ../$${dir}/$${lib}/libgo.sum ../$${dir}/$${lib}/libgo.sum.sep; \
1217           mv ../$${dir}/$${lib}/libgo.log ../$${dir}/$${lib}/libgo.log.sep; \
1218         done; \
1219         mv libgo.head libgo.sum; \
1220         cp libgo.sum libgo.log; \
1221         echo "Schedule of variations:" >> libgo.sum; \
1222         for dir in . $(MULTIDIRS); do \
1223           multidir=../$${dir}/$${lib}; \
1224           multivar=`cat $${multidir}/libgo.var`; \
1225           echo "    $${multivar}" >> libgo.sum; \
1226         done; \
1227         echo >> libgo.sum; \
1228         pass=0; fail=0; untested=0; \
1229         for dir in . $(MULTIDIRS); do \
1230           multidir=../$${dir}/$${lib}; \
1231           multivar=`cat $${multidir}/libgo.var`; \
1232           echo "Running target $${multivar}" >> libgo.sum; \
1233           echo "Running $(srcdir)/libgo.exp ..." >> libgo.sum; \
1234           cat $${multidir}/libgo.sum.sep >> libgo.sum; \
1235           cat $${multidir}/libgo.log.sep >> libgo.log; \
1236           if test -n "${MULTIDIRS}"; then \
1237             echo "              === libgo Summary for $${multivar} ===" >> libgo.sum; \
1238             echo >> libgo.sum; \
1239           fi; \
1240           p=`grep -c PASS $${multidir}/libgo.sum.sep`; \
1241           pass=`expr $$pass + $$p`; \
1242           if test "$$p" -ne "0" && test -n "${MULTIDIRS}"; then \
1243             echo "# of expected passes          $$p" >> libgo.sum; \
1244           fi; \
1245           p=`grep -c FAIL $${multidir}/libgo.sum.sep`; \
1246           fail=`expr $$fail + $$p`; \
1247           if test "$$p" -ne "0" && test -n "${MULTIDIRS}"; then \
1248             echo "# of unexpected failures      $$p" >> libgo.sum; \
1249           fi; \
1250           p=`grep -c UNTESTED $${multidir}/libgo.sum.sep`; \
1251           untested=`expr $$untested + $$p`; \
1252           if test "$$p" -ne "0" && test -n "${MULTIDIRS}"; then \
1253             echo "# of untested testcases               $$p" >> libgo.sum; \
1254           fi; \
1255         done; \
1256         echo >> libgo.sum; \
1257         echo "          === libgo Summary ===" >> libgo.sum; \
1258         echo >> libgo.sum; \
1259         if test "$$pass" -ne "0"; then \
1260           echo "# of expected passes            $$pass" >> libgo.sum; \
1261         fi; \
1262         if test "$$fail" -ne "0"; then \
1263           echo "# of unexpected failures        $$fail" >> libgo.sum; \
1264         fi; \
1265         if test "$$untested" -ne "0"; then \
1266           echo "# of untested testcases         $$untested" >> libgo.sum; \
1267         fi; \
1268         echo `echo $(GOC) | sed -e 's/ .*//'`  `$(GOC) -v 2>&1 | grep " version" | sed -n -e 's/.* \(version.*$$\)/\1/p'` >> libgo.sum; \
1269         echo >> libgo.log; \
1270         echo "runtest completed at `date`" >> libgo.log; \
1271         if test "$$fail" -ne "0"; then \
1272           status=1; \
1273         else \
1274           status=0; \
1275         fi; \
1276         exit $$status
1278 check-am:
1279         @rm -f libgo.sum libgo.log libgo.tail
1280         @multivar="unix"; \
1281         [ -z "$(MULTIFLAGS)" ] || multivar="$${multivar}/$(MULTIFLAGS)"; \
1282         echo "$${multivar}" > libgo.var
1283         @for f in $(TEST_PACKAGES); do \
1284            rm -f $$f-testsum $$f-testlog; \
1285          done
1286         -@$(MAKE) $(AM_MAKEFLAGS) -k $(TEST_PACKAGES)
1287         @for f in $(TEST_PACKAGES); do \
1288           if test -f $$f-testsum; then \
1289             cat $$f-testsum >> libgo.sum; \
1290           fi; \
1291           if test -f $$f-testlog; then \
1292             cat $$f-testlog >> libgo.log; \
1293           fi; \
1294         done
1296 check-multi:
1297         $(MULTIDO) $(AM_MAKEFLAGS) DO=check-am multi-do # $(MAKE)
1299 bench:
1300         -@$(MAKE) $(AM_MAKEFLAGS) -k $(TEST_PACKAGES) GOBENCH=.
1302 MOSTLYCLEANFILES = \
1303         s-runtime_sysinfo s-sigtab s-runtime-inc s-zstdpkglist \
1304         s-libcalls s-libcalls-list s-syscall_arch s-gen-sysinfo s-sysinfo \
1305         s-errno s-epoll \
1306         libgo.head libgo.sum.sep libgo.log.sep libgo.var \
1307         libcalls-list \
1308         runtime.inc runtime.inc.tmp2 runtime.inc.tmp3 runtime.inc.raw
1310 mostlyclean-local:
1311         find . -name '*.lo' -print | xargs $(LIBTOOL) --mode=clean rm -f
1312         find . -name '*.$(OBJEXT)' -print | xargs rm -f
1313         find . -name '*-testsum' -print | xargs rm -f
1314         find . -name '*-testlog' -print | xargs rm -f
1316 CLEANFILES = *.go *.c s-* libgo.sum libgo.log runtime.inc
1318 clean-local:
1319         find . -name '*.la' -print | xargs $(LIBTOOL) --mode=clean rm -f
1320         find . -name '*.a' -print | xargs rm -f
1321         find . -name '*.gox' -print | xargs rm -f
1322         find . -name '*.s-gox' -print | xargs rm -f
1324 distclean-local:
1325         find . -name '*.lo.dep' -print | xargs rm -f
1327 include $(top_srcdir)/../multilib.am
1329 if LIBGO_IS_AIX
1330 ALL_LOCAL_DEPS = add-aix-fat-library
1331 else
1332 ALL_LOCAL_DEPS =
1333 endif
1334 all-local: $(ALL_LOCAL_DEPS)
1336 MAJOR=$(firstword $(subst :, ,$(libtool_VERSION)))
1338 # If we want to use "AR -r" when creating AIX FAT archives,
1339 # AR must be stripped of all its -X flags.
1340 # Otherwize, if AR was defined with -X32_64, the replace option would
1341 # erase the default .so when adding the extra one. There is no
1342 # order priority within -X flags.
1343 add-aix-fat-library: all-multi
1344         @if test "$(MULTIBUILDTOP)" = ""; then \
1345           arx=`echo $(AR) | sed -e 's/-X[^ ]*//g'`; \
1346           $${arx} -X$(AIX_EXTRA_ARCH) rc .libs/$(PACKAGE).a ../ppc$(AIX_EXTRA_ARCH)/$(PACKAGE)/.libs/$(PACKAGE).so.$(MAJOR); \
1347           $${arx} -X$(AIX_EXTRA_ARCH) rc ../pthread/$(PACKAGE)/.libs/$(PACKAGE).a ../pthread/ppc$(AIX_EXTRA_ARCH)/$(PACKAGE)/.libs/$(PACKAGE).so.$(MAJOR); \
1348           $${arx} -X$(AIX_EXTRA_ARCH) rc libgobegin.a ../ppc$(AIX_EXTRA_ARCH)/$(PACKAGE)/$(libgobegin_a_OBJECTS); \
1349           $${arx} -X$(AIX_EXTRA_ARCH) rc ../pthread/$(PACKAGE)/libgobegin.a ../pthread/ppc$(AIX_EXTRA_ARCH)/$(PACKAGE)/$(libgobegin_a_OBJECTS); \
1350           $${arx} -X$(AIX_EXTRA_ARCH) rc libgolibbegin.a ../ppc$(AIX_EXTRA_ARCH)/$(PACKAGE)/$(libgolibbegin_a_OBJECTS); \
1351           $${arx} -X$(AIX_EXTRA_ARCH) rc ../pthread/$(PACKAGE)/libgolibbegin.a ../pthread/ppc$(AIX_EXTRA_ARCH)/$(PACKAGE)/$(libgolibbegin_a_OBJECTS); \
1352         fi