Russ Cox | bdcf1f8 | 2009-08-27 11:17:14 -0700 | [diff] [blame] | 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 | |
Alex Brainman | aa4639f | 2010-07-26 09:55:25 +1000 | [diff] [blame] | 5 | ifeq ($(GOOS),windows) |
| 6 | TARG:=$(TARG).exe |
| 7 | endif |
| 8 | |
Andrew Gerrand | ca8a055 | 2011-04-27 11:00:34 +1000 | [diff] [blame] | 9 | ifeq ($(TARGDIR),) |
| 10 | TARGDIR:=$(QUOTED_GOBIN) |
| 11 | endif |
| 12 | |
Rob Pike | f9d6af9 | 2010-03-19 16:33:27 -0700 | [diff] [blame] | 13 | all: $(TARG) |
Russ Cox | bdcf1f8 | 2009-08-27 11:17:14 -0700 | [diff] [blame] | 14 | |
Rob Pike | 14abacf | 2010-03-19 15:14:46 -0700 | [diff] [blame] | 15 | include $(QUOTED_GOROOT)/src/Make.common |
| 16 | |
| 17 | PREREQ+=$(patsubst %,%.make,$(DEPS)) |
Sergio Luis O. B. Correia | 6fc8207 | 2009-11-23 17:32:51 -0800 | [diff] [blame] | 18 | |
Eric Clark | fcc0c00 | 2010-10-11 22:39:37 -0400 | [diff] [blame] | 19 | $(TARG): _go_.$O |
Andrew Gerrand | ca8a055 | 2011-04-27 11:00:34 +1000 | [diff] [blame] | 20 | $(LD) $(LDIMPORTS) -o $@ _go_.$O |
Russ Cox | bdcf1f8 | 2009-08-27 11:17:14 -0700 | [diff] [blame] | 21 | |
Rob Pike | 14abacf | 2010-03-19 15:14:46 -0700 | [diff] [blame] | 22 | _go_.$O: $(GOFILES) $(PREREQ) |
Russ Cox | 389d55f | 2011-10-18 14:55:10 -0400 | [diff] [blame] | 23 | $(GC) $(GCFLAGS) $(GCIMPORTS) -o $@ $(GOFILES) |
Russ Cox | bdcf1f8 | 2009-08-27 11:17:14 -0700 | [diff] [blame] | 24 | |
Andrew Gerrand | ca8a055 | 2011-04-27 11:00:34 +1000 | [diff] [blame] | 25 | install: $(TARGDIR)/$(TARG) |
Russ Cox | bdcf1f8 | 2009-08-27 11:17:14 -0700 | [diff] [blame] | 26 | |
Andrew Gerrand | ca8a055 | 2011-04-27 11:00:34 +1000 | [diff] [blame] | 27 | $(TARGDIR)/$(TARG): $(TARG) |
Gustavo Niemeyer | 2c92fe0 | 2011-05-03 09:53:04 -0300 | [diff] [blame] | 28 | mkdir -p $(TARGDIR) && cp -f $(TARG) $(TARGDIR) |
Russ Cox | bdcf1f8 | 2009-08-27 11:17:14 -0700 | [diff] [blame] | 29 | |
Anthony Martin | fbb4be3 | 2011-05-11 22:53:42 -0400 | [diff] [blame] | 30 | CLEANFILES+=$(TARG) _test _testmain.go test.out build.out |
Russ Cox | bdcf1f8 | 2009-08-27 11:17:14 -0700 | [diff] [blame] | 31 | |
Rob Pike | 14abacf | 2010-03-19 15:14:46 -0700 | [diff] [blame] | 32 | nuke: clean |
Andrew Gerrand | ca8a055 | 2011-04-27 11:00:34 +1000 | [diff] [blame] | 33 | rm -f $(TARGDIR)/$(TARG) |
Russ Cox | 9d3db4b | 2011-02-03 14:54:01 -0500 | [diff] [blame] | 34 | |
| 35 | # for gotest |
| 36 | testpackage: _test/main.a |
| 37 | |
| 38 | testpackage-clean: |
| 39 | rm -f _test/main.a _gotest_.$O |
| 40 | |
Russ Cox | 9d3db4b | 2011-02-03 14:54:01 -0500 | [diff] [blame] | 41 | _test/main.a: _gotest_.$O |
| 42 | @mkdir -p _test |
| 43 | rm -f $@ |
| 44 | gopack grc $@ _gotest_.$O |
| 45 | |
| 46 | _gotest_.$O: $(GOFILES) $(GOTESTFILES) |
Russ Cox | 389d55f | 2011-10-18 14:55:10 -0400 | [diff] [blame] | 47 | $(GC) $(GCFLAGS) $(GCIMPORTS) -o $@ $(GOFILES) $(GOTESTFILES) |
Russ Cox | 9d3db4b | 2011-02-03 14:54:01 -0500 | [diff] [blame] | 48 | |
| 49 | importpath: |
| 50 | echo main |