LEFT | RIGHT |
1 # Copyright 2010 The Go Authors. All rights reserved. | 1 # Copyright 2010 The Go Authors. All rights reserved. |
2 # Use of this source code is governed by a BSD-style | 2 # Use of this source code is governed by a BSD-style |
3 # license that can be found in the LICENSE file. | 3 # license that can be found in the LICENSE file. |
4 | 4 |
5 include ../../../Make.inc | 5 include ../../../Make.inc |
6 | 6 |
7 ENABLED:=1 | 7 ENABLED:=1 |
8 | 8 |
9 ifeq ($(GOARCH),arm) | 9 ifeq ($(GOARCH),arm) |
10 ENABLED:=0 | 10 ENABLED:=0 |
11 endif | 11 endif |
12 | 12 |
13 TARG=runtime/cgo | 13 TARG=runtime/cgo |
14 | 14 |
15 GOFILES=\ | 15 GOFILES=\ |
16 cgo.go\ | 16 cgo.go\ |
17 | 17 |
18 ifeq ($(ENABLED),1) | 18 ifeq ($(ENABLED),1) |
19 | 19 |
20 # Unwarranted chumminess with Make.pkg's cgo rules. | 20 # Unwarranted chumminess with Make.pkg's cgo rules. |
21 # Do not try this at home. | 21 # Do not try this at home. |
22 CGO_OFILES=\ | 22 CGO_OFILES=\ |
23 $(GOARCH).o\ | 23 $(GOARCH).o\ |
24 $(GOOS)_$(GOARCH).o\ | 24 $(GOOS)_$(GOARCH).o\ |
25 util.o\ | 25 util.o\ |
26 | 26 |
27 OFILES=\ | 27 OFILES=\ |
28 iscgo.$O\ | 28 iscgo.$O\ |
| 29 callbacks.$O\ |
29 _cgo_import.$O\ | 30 _cgo_import.$O\ |
30 $(CGO_OFILES)\ | 31 $(CGO_OFILES)\ |
31 | 32 |
32 ifeq ($(GOOS),windows) | 33 ifeq ($(GOOS),windows) |
33 CGO_LDFLAGS=-lm -mthreads | 34 CGO_LDFLAGS=-lm -mthreads |
34 else | 35 else |
35 CGO_LDFLAGS=-lpthread | 36 CGO_LDFLAGS=-lpthread |
36 endif | 37 endif |
37 | 38 |
38 ifeq ($(GOOS),freebsd) | 39 ifeq ($(GOOS),freebsd) |
39 OFILES+=\ | 40 OFILES+=\ |
40 freebsd.$O\ | 41 freebsd.$O\ |
41 | 42 |
42 endif | 43 endif |
43 | 44 |
44 endif | 45 endif |
45 | 46 |
46 include ../../../Make.pkg | 47 include ../../../Make.pkg |
47 | 48 |
48 ifeq ($(ENABLED),1) | 49 ifeq ($(ENABLED),1) |
49 _cgo_defun.c: | 50 _cgo_defun.c: |
50 echo >$@ | 51 echo >$@ |
51 | 52 |
52 _cgo_main.c: | 53 _cgo_main.c: |
53 echo 'int main() { return 0; }' >$@ | 54 echo 'int main() { return 0; }' >$@ |
54 echo 'void *crosscall2;' >>$@ | |
55 endif | 55 endif |
56 | 56 |
57 $(GOARCH).o: $(GOARCH).S | 57 $(GOARCH).o: $(GOARCH).S |
58 $(HOST_CC) $(_CGO_CFLAGS_$(GOARCH)) -g -O2 -fPIC -o $@ -c $^ | 58 $(HOST_CC) $(_CGO_CFLAGS_$(GOARCH)) -g -O2 -fPIC -o $@ -c $^ |
59 | 59 |
60 $(GOOS)_$(GOARCH).o: $(GOOS)_$(GOARCH).c | 60 $(GOOS)_$(GOARCH).o: $(GOOS)_$(GOARCH).c |
61 $(HOST_CC) $(_CGO_CFLAGS_$(GOARCH)) -g -O2 -fPIC -o $@ -c $^ | 61 $(HOST_CC) $(_CGO_CFLAGS_$(GOARCH)) -g -O2 -fPIC -o $@ -c $^ |
62 | 62 |
63 %.o: %.c | 63 %.o: %.c |
64 $(HOST_CC) $(_CGO_CFLAGS_$(GOARCH)) -g -O2 -fPIC -o $@ -c $^ | 64 $(HOST_CC) $(_CGO_CFLAGS_$(GOARCH)) -g -O2 -fPIC -o $@ -c $^ |
LEFT | RIGHT |