blob: d663edbffcf0d70aca67666de53a92a148825785 [file] [log] [blame]
Russ Coxbdcf1f82009-08-27 11:17:14 -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
Alex Brainmanaa4639f2010-07-26 09:55:25 +10005ifeq ($(GOOS),windows)
6TARG:=$(TARG).exe
7endif
8
Andrew Gerrandca8a0552011-04-27 11:00:34 +10009ifeq ($(TARGDIR),)
10TARGDIR:=$(QUOTED_GOBIN)
11endif
12
Rob Pikef9d6af92010-03-19 16:33:27 -070013all: $(TARG)
Russ Coxbdcf1f82009-08-27 11:17:14 -070014
Rob Pike14abacf2010-03-19 15:14:46 -070015include $(QUOTED_GOROOT)/src/Make.common
16
17PREREQ+=$(patsubst %,%.make,$(DEPS))
Sergio Luis O. B. Correia6fc82072009-11-23 17:32:51 -080018
Eric Clarkfcc0c002010-10-11 22:39:37 -040019$(TARG): _go_.$O
Andrew Gerrandca8a0552011-04-27 11:00:34 +100020 $(LD) $(LDIMPORTS) -o $@ _go_.$O
Russ Coxbdcf1f82009-08-27 11:17:14 -070021
Rob Pike14abacf2010-03-19 15:14:46 -070022_go_.$O: $(GOFILES) $(PREREQ)
Russ Cox389d55f2011-10-18 14:55:10 -040023 $(GC) $(GCFLAGS) $(GCIMPORTS) -o $@ $(GOFILES)
Russ Coxbdcf1f82009-08-27 11:17:14 -070024
Andrew Gerrandca8a0552011-04-27 11:00:34 +100025install: $(TARGDIR)/$(TARG)
Russ Coxbdcf1f82009-08-27 11:17:14 -070026
Andrew Gerrandca8a0552011-04-27 11:00:34 +100027$(TARGDIR)/$(TARG): $(TARG)
Gustavo Niemeyer2c92fe02011-05-03 09:53:04 -030028 mkdir -p $(TARGDIR) && cp -f $(TARG) $(TARGDIR)
Russ Coxbdcf1f82009-08-27 11:17:14 -070029
Anthony Martinfbb4be32011-05-11 22:53:42 -040030CLEANFILES+=$(TARG) _test _testmain.go test.out build.out
Russ Coxbdcf1f82009-08-27 11:17:14 -070031
Rob Pike14abacf2010-03-19 15:14:46 -070032nuke: clean
Andrew Gerrandca8a0552011-04-27 11:00:34 +100033 rm -f $(TARGDIR)/$(TARG)
Russ Cox9d3db4b2011-02-03 14:54:01 -050034
35# for gotest
36testpackage: _test/main.a
37
38testpackage-clean:
39 rm -f _test/main.a _gotest_.$O
40
Russ Cox9d3db4b2011-02-03 14:54:01 -050041_test/main.a: _gotest_.$O
42 @mkdir -p _test
43 rm -f $@
44 gopack grc $@ _gotest_.$O
45
46_gotest_.$O: $(GOFILES) $(GOTESTFILES)
Russ Cox389d55f2011-10-18 14:55:10 -040047 $(GC) $(GCFLAGS) $(GCIMPORTS) -o $@ $(GOFILES) $(GOTESTFILES)
Russ Cox9d3db4b2011-02-03 14:54:01 -050048
49importpath:
50 echo main