OLD | NEW |
1 # Copyright 2009 The Go Authors. All rights reserved. | 1 # Copyright 2009 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 all: libcgo.so | 5 all: libcgo.so |
6 | 6 |
7 install: $(GOROOT)/pkg/$(GOOS)_$(GOARCH)/libcgo.so | 7 install: $(GOROOT)/pkg/$(GOOS)_$(GOARCH)/libcgo.so |
8 | 8 |
9 OFILES=\ | 9 OFILES=\ |
10 $(GOOS)_$(GOARCH).o\ | 10 $(GOOS)_$(GOARCH).o\ |
11 $(GOARCH).o\ | 11 $(GOARCH).o\ |
12 util.o\ | 12 util.o\ |
13 | 13 |
14 CFLAGS_386=-m32 | 14 CFLAGS_386=-m32 |
15 CFLAGS_amd64=-m64 | 15 CFLAGS_amd64=-m64 |
16 | 16 |
17 LDFLAGS_linux=-shared -lpthread -lm | 17 LDFLAGS_linux=-shared -lpthread -lm |
18 LDFLAGS_darwin=-dynamiclib -Wl,-undefined,dynamic_lookup /usr/lib/libpthread.dyl
ib | 18 LDFLAGS_darwin=-dynamiclib -Wl,-undefined,dynamic_lookup /usr/lib/libpthread.dyl
ib |
| 19 LDFLAGS_freebsd=-pthread -shared -lm |
19 | 20 |
20 %.o: %.c | 21 %.o: %.c |
21 gcc $(CFLAGS_$(GOARCH)) -O2 -fPIC -o $@ -c $*.c | 22 gcc $(CFLAGS_$(GOARCH)) -O2 -fPIC -o $@ -c $*.c |
22 | 23 |
23 %.o: %.S | 24 %.o: %.S |
24 gcc $(CFLAGS_$(GOARCH)) -O2 -fPIC -o $@ -c $*.S | 25 gcc $(CFLAGS_$(GOARCH)) -O2 -fPIC -o $@ -c $*.S |
25 | 26 |
26 libcgo.so: $(OFILES) | 27 libcgo.so: $(OFILES) |
27 gcc $(CFLAGS_$(GOARCH)) -o libcgo.so $(OFILES) $(LDFLAGS_$(GOOS)) | 28 gcc $(CFLAGS_$(GOARCH)) -o libcgo.so $(OFILES) $(LDFLAGS_$(GOOS)) |
28 | 29 |
29 $(GOROOT)/pkg/$(GOOS)_$(GOARCH)/libcgo.so: libcgo.so | 30 $(GOROOT)/pkg/$(GOOS)_$(GOARCH)/libcgo.so: libcgo.so |
30 cp libcgo.so $@ | 31 cp libcgo.so $@ |
31 | 32 |
32 clean: | 33 clean: |
33 rm -f *.o *.so | 34 rm -f *.o *.so |
34 | 35 |
OLD | NEW |