summaryrefslogtreecommitdiff
path: root/src/Make.cmd
blob: 27c6a2e13467071d2ca588d3a384dfa806b93646 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
# Copyright 2009 The Go Authors.  All rights reserved.
# Use of this source code is governed by a BSD-style
# license that can be found in the LICENSE file.

ifeq ($(GOOS),windows)
TARG:=$(TARG).exe
endif

ifeq ($(TARGDIR),)
TARGDIR:=$(QUOTED_GOBIN)
endif

all: $(TARG)

include $(QUOTED_GOROOT)/src/Make.common

PREREQ+=$(patsubst %,%.make,$(DEPS))

$(TARG): _go_.$O
	$(LD) $(LDIMPORTS) -o $@ _go_.$O

_go_.$O: $(GOFILES) $(PREREQ)
	$(GC) $(GCIMPORTS) -o $@ $(GOFILES)

install: $(TARGDIR)/$(TARG)

$(TARGDIR)/$(TARG): $(TARG)
	mkdir -p $(TARGDIR) && cp -f $(TARG) $(TARGDIR)

CLEANFILES+=$(TARG) _test _testmain.go test.out build.out

nuke: clean
	rm -f $(TARGDIR)/$(TARG)

# for gotest
testpackage: _test/main.a

testpackage-clean:
	rm -f _test/main.a _gotest_.$O

_test/main.a: _gotest_.$O
	@mkdir -p _test
	rm -f $@
	gopack grc $@ _gotest_.$O

_gotest_.$O: $(GOFILES) $(GOTESTFILES)
	$(GC) $(GCIMPORTS) -o $@ $(GOFILES) $(GOTESTFILES)

importpath:
	echo main