blob: 03f960cb86c9e1d381f2d9c6a719f04c1e160701 [file] [log] [blame]
Russ Coxd06a79e2009-05-12 16:15:52 -07001# Copyright 2009 The Go Authors. All rights reserved.
2# Use of this source code is governed by a BSD-style
3# license that can be found in the LICENSE file.
4
Russ Coxda392d92010-08-18 10:08:49 -04005include ../../Make.inc
Russ Cox090efde2009-08-13 14:41:10 -07006
7TARG=runtime
8
Russ Coxb7f05802009-06-06 22:04:50 -07009# Set SIZE to 32 or 64.
10SIZE_386=32
11SIZE_amd64=64
12SIZE_arm=32
13SIZE=$(SIZE_$(GOARCH))
Russ Coxd06a79e2009-05-12 16:15:52 -070014
Alex Brainmanf81d4712010-04-29 23:45:14 -070015CFLAGS_windows=-D__WINDOWS__
Ian Lance Taylor1fab0cd2010-11-18 12:34:47 -080016CFLAGS=-I$(GOOS) -I$(GOARCH) -I$(GOOS)/$(GOARCH) -wF $(CFLAGS_$(GOARCH)) $(CFLAGS_$(GOOS))
Russ Coxd06a79e2009-05-12 16:15:52 -070017
Russ Cox090efde2009-08-13 14:41:10 -070018GOFILES=\
Russ Coxe63ae242010-06-21 20:53:49 -070019 debug.go\
Russ Cox63e878a2010-03-31 15:55:10 -070020 error.go\
Russ Cox090efde2009-08-13 14:41:10 -070021 extern.go\
Russ Cox591c74a2011-03-11 15:09:21 -050022 mem.go\
Russ Coxe63ae242010-06-21 20:53:49 -070023 sig.go\
Russ Cox7c2b1592010-10-25 17:55:50 -070024 softfloat64.go\
Russ Cox090efde2009-08-13 14:41:10 -070025 type.go\
Russ Cox0c3a93c2010-03-16 23:10:33 -070026 version.go\
Russ Coxbc874ec2011-02-02 15:35:54 -050027 version_$(GOOS).go\
28 version_$(GOARCH).go\
Luuk van Dijk85cae872010-11-30 18:21:26 +010029 runtime_defs.go\
Russ Coxb7f05802009-06-06 22:04:50 -070030
Russ Coxbc874ec2011-02-02 15:35:54 -050031CLEANFILES+=version.go version_*.go
32
Alex Brainmanf81d4712010-04-29 23:45:14 -070033OFILES_windows=\
Alex Brainmane0079582010-03-09 15:09:09 -080034 syscall.$O\
35
Russ Coxb7f05802009-06-06 22:04:50 -070036# 386-specific object files
37OFILES_386=\
38 vlop.$O\
39 vlrt.$O\
40
Kai Backman52891952009-06-10 11:53:07 -070041# arm-specific object files
42OFILES_arm=\
Kai Backmanbe639b92009-06-23 11:54:23 -070043 memset.$O\
Kai Backmand85bb812009-12-17 16:08:42 -080044 softfloat.$O\
Kai Backman52891952009-06-10 11:53:07 -070045 vlop.$O\
46 vlrt.$O\
47
Russ Coxb7f05802009-06-06 22:04:50 -070048OFILES=\
Russ Coxb7f05802009-06-06 22:04:50 -070049 asm.$O\
Dmitriy Vyukov997c00f2011-06-28 15:09:53 -040050 atomic.$O\
Russ Coxfdc4b4a2009-08-24 17:30:00 -070051 cgocall.$O\
Russ Coxb7f05802009-06-06 22:04:50 -070052 chan.$O\
53 closure.$O\
Russ Coxc19b3732011-03-23 11:43:37 -040054 cpuprof.$O\
Russ Coxb7f05802009-06-06 22:04:50 -070055 float.$O\
Ken Thompsonf229c8b2010-03-09 12:49:24 -080056 complex.$O\
Russ Coxb7f05802009-06-06 22:04:50 -070057 hashmap.$O\
58 iface.$O\
59 malloc.$O\
Russ Coxb7f05802009-06-06 22:04:50 -070060 mcache.$O\
61 mcentral.$O\
62 mem.$O\
Russ Coxed0beea2009-11-17 22:16:55 -080063 memmove.$O\
Russ Cox33e396a2010-02-03 16:31:34 -080064 mfinal.$O\
Russ Coxb7f05802009-06-06 22:04:50 -070065 mfixalloc.$O\
66 mgc0.$O\
67 mheap.$O\
Russ Cox596c16e2010-03-23 20:48:23 -070068 mprof.$O\
Russ Coxb7f05802009-06-06 22:04:50 -070069 msize.$O\
70 print.$O\
71 proc.$O\
72 rune.$O\
73 runtime.$O\
Russ Cox12518e42010-01-13 17:50:02 -080074 runtime1.$O\
Russ Coxb7f05802009-06-06 22:04:50 -070075 rt0.$O\
76 sema.$O\
Russ Coxb7f05802009-06-06 22:04:50 -070077 signal.$O\
David Symondsb5866492009-12-15 18:21:29 -080078 sigqueue.$O\
Rob Pike87f22082009-08-25 15:54:25 -070079 slice.$O\
Russ Coxb7f05802009-06-06 22:04:50 -070080 string.$O\
81 symtab.$O\
82 sys.$O\
83 thread.$O\
84 traceback.$O\
85 $(OFILES_$(GOARCH))\
Russ Cox12518e42010-01-13 17:50:02 -080086 $(OFILES_$(GOOS))\
Russ Coxb7f05802009-06-06 22:04:50 -070087
88HFILES=\
Russ Coxfdc4b4a2009-08-24 17:30:00 -070089 cgocall.h\
Russ Coxb7f05802009-06-06 22:04:50 -070090 runtime.h\
91 hashmap.h\
92 malloc.h\
Russ Cox820dc9f2011-02-24 13:46:44 -080093 stack.h\
Russ Cox7343e032009-06-17 15:12:16 -070094 $(GOARCH)/asm.h\
Russ Coxb7f05802009-06-06 22:04:50 -070095 $(GOOS)/os.h\
David Symondsb5866492009-12-15 18:21:29 -080096 $(GOOS)/signals.h\
Russ Coxb7f05802009-06-06 22:04:50 -070097 $(GOOS)/$(GOARCH)/defs.h\
98
Russ Cox12518e42010-01-13 17:50:02 -080099GOFILES+=$(GOFILES_$(GOOS))
100
Ian Lance Taylor7c99dcb2010-02-24 17:00:25 -0800101# For use by cgo.
102INSTALLFILES=$(pkgdir)/runtime.h $(pkgdir)/cgocall.h
103
Russ Cox1cecac82010-01-24 23:33:59 -0800104# special, out of the way compiler flag that means "add runtime metadata to output"
105GC+= -+
106
Sergio Luis O. B. Correia6fc82072009-11-23 17:32:51 -0800107include ../../Make.pkg
Russ Coxab7a8d42009-06-18 13:33:28 -0700108
Ian Lance Taylor7c99dcb2010-02-24 17:00:25 -0800109$(pkgdir)/%.h: %.h
110 @test -d $(QUOTED_GOROOT)/pkg && mkdir -p $(pkgdir)
Christopher Nielsen31ccf192011-02-03 00:42:03 -0500111 cp $< "$@"
Ian Lance Taylor7c99dcb2010-02-24 17:00:25 -0800112
Russ Cox090efde2009-08-13 14:41:10 -0700113clean: clean-local
Russ Coxa0bcaf42009-06-25 20:24:55 -0700114
Russ Cox090efde2009-08-13 14:41:10 -0700115clean-local:
Luuk van Dijk7400be82011-01-31 12:27:28 +0100116 rm -f goc2c mkversion version.go */asm.h runtime.acid.* runtime_defs.go $$(ls *.goc | sed 's/goc$$/c/')
Russ Coxa0bcaf42009-06-25 20:24:55 -0700117
Russ Cox32e979c2009-10-28 14:03:16 -0700118$(GOARCH)/asm.h: mkasmh.sh runtime.acid.$(GOARCH)
Russ Cox133a1582009-10-03 10:37:12 -0700119 ./mkasmh.sh >$@.x
Russ Cox090efde2009-08-13 14:41:10 -0700120 mv -f $@.x $@
Russ Coxb7f05802009-06-06 22:04:50 -0700121
Russ Cox20c50cf2010-04-20 17:03:25 -0700122goc2c: goc2c.c
Russ Cox22610212011-05-31 14:24:21 -0400123 quietgcc -o $@ $<
Russ Coxb7f05802009-06-06 22:04:50 -0700124
Russ Cox0c3a93c2010-03-16 23:10:33 -0700125mkversion: mkversion.c
Russ Cox22610212011-05-31 14:24:21 -0400126 quietgcc -o $@ -I "$(GOROOT)/include" $< "$(GOROOT)/lib/lib9.a"
Russ Cox0c3a93c2010-03-16 23:10:33 -0700127
128version.go: mkversion
Russ Coxd3ac5452011-02-18 11:35:43 -0500129 GOROOT="$(GOROOT_FINAL)" ./mkversion >version.go
Russ Cox0c3a93c2010-03-16 23:10:33 -0700130
Russ Coxbc874ec2011-02-02 15:35:54 -0500131version_$(GOARCH).go:
132 (echo 'package runtime'; echo 'const theGoarch = "$(GOARCH)"') >$@
133
134version_$(GOOS).go:
135 (echo 'package runtime'; echo 'const theGoos = "$(GOOS)"') >$@
136
Russ Cox20c50cf2010-04-20 17:03:25 -0700137%.c: %.goc goc2c
Christopher Nielsen31ccf192011-02-03 00:42:03 -0500138 ./goc2c "`pwd`/$<" > $@.tmp
Russ Cox090efde2009-08-13 14:41:10 -0700139 mv -f $@.tmp $@
Russ Coxd06a79e2009-05-12 16:15:52 -0700140
Russ Cox820dc9f2011-02-24 13:46:44 -0800141%.$O: $(GOARCH)/%.c $(HFILES)
Christian Himpel5c603db2010-08-30 15:40:56 -0400142 $(CC) $(CFLAGS) $<
Russ Coxd06a79e2009-05-12 16:15:52 -0700143
Russ Cox820dc9f2011-02-24 13:46:44 -0800144%.$O: $(GOOS)/%.c $(HFILES)
Christian Himpel5c603db2010-08-30 15:40:56 -0400145 $(CC) $(CFLAGS) $<
Russ Coxd06a79e2009-05-12 16:15:52 -0700146
Russ Cox820dc9f2011-02-24 13:46:44 -0800147%.$O: $(GOOS)/$(GOARCH)/%.c $(HFILES)
Christian Himpel5c603db2010-08-30 15:40:56 -0400148 $(CC) $(CFLAGS) $<
Russ Coxd06a79e2009-05-12 16:15:52 -0700149
Russ Cox090efde2009-08-13 14:41:10 -0700150%.$O: $(GOARCH)/%.s $(GOARCH)/asm.h
Christian Himpel5c603db2010-08-30 15:40:56 -0400151 $(AS) $<
Russ Coxd06a79e2009-05-12 16:15:52 -0700152
Russ Cox090efde2009-08-13 14:41:10 -0700153%.$O: $(GOOS)/$(GOARCH)/%.s $(GOARCH)/asm.h
Christian Himpel5c603db2010-08-30 15:40:56 -0400154 $(AS) $<
Russ Coxd06a79e2009-05-12 16:15:52 -0700155
Rob Pike8a20cfc2009-10-22 11:52:35 -0700156# for discovering offsets inside structs when debugging
Russ Cox32e979c2009-10-28 14:03:16 -0700157runtime.acid.$(GOARCH): runtime.h proc.c
Christian Himpel5c603db2010-08-30 15:40:56 -0400158 $(CC) $(CFLAGS) -a proc.c >$@
Russ Cox2b7d1472010-03-23 17:01:17 -0700159
160# 386 traceback is really amd64 traceback
161ifeq ($(GOARCH),386)
Russ Cox2b7d1472010-03-23 17:01:17 -0700162traceback.$O: amd64/traceback.c
Christian Himpel5c603db2010-08-30 15:40:56 -0400163 $(CC) $(CFLAGS) $<
Russ Coxc6138ef2010-04-22 17:52:22 -0700164endif
Luuk van Dijk7400be82011-01-31 12:27:28 +0100165
166runtime_defs.go: proc.c iface.c hashmap.c chan.c
167 CC="$(CC)" CFLAGS="$(CFLAGS)" ./mkgodefs.sh $^ > $@.x
168 mv -f $@.x $@