Makefile: Use new build system

This commit is contained in:
Alexander Neumann 2015-06-24 19:57:27 +02:00
parent 7738709f7a
commit f2dea829b4
1 changed files with 10 additions and 50 deletions

View File

@ -1,18 +1,4 @@
.PHONY: all clean env test bench gox test-integration .PHONY: all clean test
TMPGOPATH=$(PWD)/.gopath
VENDORPATH=$(PWD)/Godeps/_workspace
BASE=github.com/restic/restic
BASEPATH=$(TMPGOPATH)/src/$(BASE)
GOPATH=$(TMPGOPATH):$(VENDORPATH)
GOTESTFLAGS ?= -v
GOX_OS ?= linux darwin openbsd freebsd
SFTP_PATH ?= /usr/lib/ssh/sftp-server
CMDS=$(patsubst cmd/%,%,$(wildcard cmd/*))
CMDS_DEBUG=$(patsubst %,%.debug,$(CMDS))
SOURCE=$(wildcard *.go) $(wildcard */*.go) $(wildcard */*/*.go) SOURCE=$(wildcard *.go) $(wildcard */*.go) $(wildcard */*/*.go)
@ -20,43 +6,17 @@ export GOPATH GOX_OS
all: restic all: restic
.gopath: restic: $(SOURCE)
mkdir -p .gopath/src/github.com/restic go run build.go
ln -snf ../../../.. .gopath/src/github.com/restic/restic
%: cmd/% .gopath $(SOURCE) restic.debug: $(SOURCE)
cd $(BASEPATH) && \ go run build.go -tags debug
go build -a -tags release -ldflags "-s" -o $@ ./$<
%.debug: cmd/% .gopath $(SOURCE)
cd $(BASEPATH) && \
go build -a -tags debug -ldflags "-s" -o $@ ./$<
clean: clean:
rm -rf .gopath $(CMDS) $(CMDS_DEBUG) *.cov restic_* rm -rf restic restic.debug
go clean ./...
test: .gopath test: $(SOURCE)
cd $(BASEPATH) && \ go run run_tests.go /dev/null
go test $(GOTESTFLAGS) ./...
bench: .gopath all.cov: $(SOURCE)
cd $(BASEPATH) && \ go run run_tests.go all.cov
go test $(GOTESTFLAGS) -bench ./...
gox: .gopath $(SOURCE)
cd $(BASEPATH) && \
gox -verbose -os "$(GOX_OS)" ./cmd/restic
all.cov: .gopath $(SOURCE)
cd $(BASEPATH) && go run run_tests.go all.cov
env:
@echo export GOPATH=\"$(GOPATH)\"
goenv:
go env
list: .gopath
cd $(BASEPATH) && \
go list ./...