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