Makefile 2.95 KB
Newer Older
1 2 3 4
# Copyright 2009 The Go Authors. All rights reserved.
# Use of this source code is governed by a BSD-style
# license that can be found in the LICENSE file.

5
include ../../Make.$(GOARCH)
6 7 8

TARG=runtime

9 10 11 12 13 14 15 16
# Set SIZE to 32 or 64.
SIZE_386=32
SIZE_amd64=64
SIZE_arm=32
SIZE=$(SIZE_$(GOARCH))

# Setup CFLAGS.  Add -D_64BIT on 64-bit platforms (sorry).
CFLAGS_64=-D_64BIT
17 18 19
# TODO(kaib): fix register allocation to honor extern register so we
# can enable optimizations again.
CFLAGS_arm=-N
20
CFLAGS_windows=-D__WINDOWS__
Russ Cox's avatar
Russ Cox committed
21
CFLAGS=-I$(GOOS) -I$(GOARCH) -I$(GOOS)/$(GOARCH) -wF $(CFLAGS_$(SIZE)) $(CFLAGS_$(GOARCH)) $(CFLAGS_$(GOOS))
22

23
GOFILES=\
24
	debug.go\
25
	error.go\
26
	extern.go\
27
	sig.go\
28
	type.go\
Russ Cox's avatar
Russ Cox committed
29
	version.go\
30

31 32
GOFILES_tiny=\
	tiny/io.go\
33

34
OFILES_windows=\
35 36
	syscall.$O\

37 38 39 40 41
# 386-specific object files
OFILES_386=\
	vlop.$O\
	vlrt.$O\

42
GOARM?=6
43

44 45
# arm-specific object files
OFILES_arm=\
46
	cas$(GOARM).$O\
47
	memset.$O\
48
	softfloat.$O\
49 50 51
	vlop.$O\
	vlrt.$O\

52 53
OFILES=\
	asm.$O\
Russ Cox's avatar
Russ Cox committed
54
	cgocall.$O\
55 56 57
	chan.$O\
	closure.$O\
	float.$O\
58
	complex.$O\
59 60 61 62 63 64
	hashmap.$O\
	iface.$O\
	malloc.$O\
	mcache.$O\
	mcentral.$O\
	mem.$O\
Russ Cox's avatar
Russ Cox committed
65
	memmove.$O\
66
	mfinal.$O\
67 68 69 70
	mfixalloc.$O\
	mgc0.$O\
	mheap.$O\
	mheapmap$(SIZE).$O\
71
	mprof.$O\
72 73 74
	msize.$O\
	print.$O\
	proc.$O\
Russ Cox's avatar
Russ Cox committed
75
	reflect.$O\
76 77
	rune.$O\
	runtime.$O\
Russ Cox's avatar
Russ Cox committed
78
	runtime1.$O\
79 80 81
	rt0.$O\
	sema.$O\
	signal.$O\
David Symonds's avatar
David Symonds committed
82
	sigqueue.$O\
83
	slice.$O\
84 85 86 87 88 89
	string.$O\
	symtab.$O\
	sys.$O\
	thread.$O\
	traceback.$O\
	$(OFILES_$(GOARCH))\
Russ Cox's avatar
Russ Cox committed
90
	$(OFILES_$(GOOS))\
91 92

HFILES=\
Russ Cox's avatar
Russ Cox committed
93
	cgocall.h\
94 95 96
	runtime.h\
	hashmap.h\
	malloc.h\
97
	$(GOARCH)/asm.h\
98
	$(GOOS)/os.h\
David Symonds's avatar
David Symonds committed
99
	$(GOOS)/signals.h\
100 101
	$(GOOS)/$(GOARCH)/defs.h\

Russ Cox's avatar
Russ Cox committed
102 103
GOFILES+=$(GOFILES_$(GOOS))

104 105 106
# For use by cgo.
INSTALLFILES=$(pkgdir)/runtime.h $(pkgdir)/cgocall.h

107 108 109
# special, out of the way compiler flag that means "add runtime metadata to output"
GC+= -+

110
include ../../Make.pkg
111

112 113 114 115
$(pkgdir)/%.h: %.h
	@test -d $(QUOTED_GOROOT)/pkg && mkdir -p $(pkgdir)
	cp $< $@

116
clean: clean-local
117

118
clean-local:
119
	rm -f goc2c mkversion version.go */asm.h runtime.acid.*
120

121
$(GOARCH)/asm.h: mkasmh.sh runtime.acid.$(GOARCH)
Russ Cox's avatar
Russ Cox committed
122
	./mkasmh.sh >$@.x
123
	mv -f $@.x $@
124

125
goc2c: goc2c.c
126
	$(QUOTED_GOBIN)/quietgcc -o $@ $<
127

Russ Cox's avatar
Russ Cox committed
128 129 130 131
mkversion: mkversion.c
	$(QUOTED_GOBIN)/quietgcc -o $@ -I "$(GOROOT)/include" $< "$(GOROOT)/lib/lib9.a"

version.go: mkversion
132
	./mkversion >version.go
Russ Cox's avatar
Russ Cox committed
133

134
%.c:	%.goc goc2c
135
	./goc2c `pwd`/$< > $@.tmp
136
	mv -f $@.tmp $@
137

138
%.$O:	$(GOARCH)/%.c
139
	$(QUOTED_GOBIN)/$(CC) $(CFLAGS) $<
140

141
%.$O:	$(GOOS)/%.c
142
	$(QUOTED_GOBIN)/$(CC) $(CFLAGS) $<
143

144
%.$O:	$(GOOS)/$(GOARCH)/%.c
145
	$(QUOTED_GOBIN)/$(CC) $(CFLAGS) $<
146

147
%.$O:	$(GOARCH)/%.s $(GOARCH)/asm.h
148
	$(QUOTED_GOBIN)/$(AS) $<
149

150
%.$O:	$(GOOS)/$(GOARCH)/%.s $(GOARCH)/asm.h
151
	$(QUOTED_GOBIN)/$(AS) $<
152

Rob Pike's avatar
Rob Pike committed
153
# for discovering offsets inside structs when debugging
154
runtime.acid.$(GOARCH): runtime.h proc.c
Hector Chu's avatar
Hector Chu committed
155
	$(QUOTED_GOBIN)/$(CC) $(CFLAGS) -a proc.c >$@
Russ Cox's avatar
Russ Cox committed
156 157 158 159 160

# 386 traceback is really amd64 traceback
ifeq ($(GOARCH),386)
traceback.$O:	amd64/traceback.c
	$(QUOTED_GOBIN)/$(CC) $(CFLAGS) $<
161
endif
Russ Cox's avatar
Russ Cox committed
162

163 164 165 166
# NaCl closure is special.
ifeq ($(GOOS),nacl)
closure.$O: nacl/$(GOARCH)/closure.c
	$(QUOTED_GOBIN)/$(CC) $(CFLAGS) $<
Russ Cox's avatar
Russ Cox committed
167
endif