1 # 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
5 ifeq ($(GOOS),windows)
6 TARG:=$(TARG).exe
7 endif
8
9 ifeq ($(TARGDIR),)
10 TARGDIR:=$(QUOTED_GOBIN)
11 endif
12
13 all: $(TARG)
14
15 include $(QUOTED_GOROOT)/src/Make.common
16
17 PREREQ+=$(patsubst %,%.make,$(DEPS))
18
19 $(TARG): _go_.$O
20 $(LD) $(LDIMPORTS) -o $@ _go_.$O
21
22 _go_.$O: $(GOFILES) $(PREREQ)
23 $(GC) $(GCIMPORTS) -o $@ $(GOFILES)
24
25 install: $(TARGDIR)/$(TARG)
26
27 $(TARGDIR)/$(TARG): $(TARG)
28 mkdir -p $(TARGDIR) && cp -f $(TARG) $(TARGDIR)
29
30 CLEANFILES+=$(TARG) _test _testmain.go test.out build.out
31
32 nuke: clean
33 rm -f $(TARGDIR)/$(TARG)
34
35 # for gotest
36 testpackage: _test/main.a
37
38 testpackage-clean:
39 rm -f _test/main.a _gotest_.$O
40
41 _test/main.a: _gotest_.$O
42 @mkdir -p _test
43 rm -f $@
44 gopack grc $@ _gotest_.$O
45
46 _gotest_.$O: $(GOFILES) $(GOTESTFILES)
47 $(GC) $(GCIMPORTS) -o $@ $(GOFILES) $(GOTESTFILES)
48
49 importpath:
50 echo main