2016-11-05 16:43:00 +00:00
|
|
|
|
2016-11-07 14:53:24 +00:00
|
|
|
BUILD := gomtree
|
2017-01-20 15:28:19 +00:00
|
|
|
BUILDPATH := github.com/vbatts/go-mtree/cmd/gomtree
|
2016-11-07 14:53:24 +00:00
|
|
|
CWD := $(shell pwd)
|
2016-11-05 16:43:00 +00:00
|
|
|
SOURCE_FILES := $(shell find . -type f -name "*.go")
|
2016-08-25 18:17:08 +00:00
|
|
|
CLEAN_FILES := *~
|
2017-02-15 16:10:30 +00:00
|
|
|
TAGS :=
|
2016-12-08 01:39:47 +00:00
|
|
|
ARCHES := linux,386 linux,amd64 linux,arm linux,arm64 openbsd,amd64 windows,amd64 darwin,amd64
|
2016-11-05 16:43:00 +00:00
|
|
|
|
2017-02-15 16:10:30 +00:00
|
|
|
default: build validation
|
2016-11-05 16:43:00 +00:00
|
|
|
|
|
|
|
.PHONY: validation
|
2016-12-08 01:03:41 +00:00
|
|
|
validation: .test .lint .vet .cli.test
|
|
|
|
|
|
|
|
.PHONY: validation.tags
|
|
|
|
validation.tags: .test.tags .vet.tags .cli.test
|
2016-11-05 16:43:00 +00:00
|
|
|
|
|
|
|
.PHONY: test
|
2016-12-08 01:03:41 +00:00
|
|
|
test: .test
|
2016-08-25 18:17:08 +00:00
|
|
|
|
|
|
|
CLEAN_FILES += .test .test.tags
|
2016-11-05 16:43:00 +00:00
|
|
|
|
|
|
|
.test: $(SOURCE_FILES)
|
2017-01-20 15:28:19 +00:00
|
|
|
go test -v $$(glide novendor) && touch $@
|
2016-11-05 16:43:00 +00:00
|
|
|
|
2016-08-25 18:17:08 +00:00
|
|
|
.test.tags: $(SOURCE_FILES)
|
2017-01-20 15:28:19 +00:00
|
|
|
set -e ; for tag in $(TAGS) ; do go test -tags $$tag -v $$(glide novendor) ; done && touch $@
|
2016-08-25 18:17:08 +00:00
|
|
|
|
2016-11-05 16:43:00 +00:00
|
|
|
.PHONY: lint
|
2016-12-08 01:03:41 +00:00
|
|
|
lint: .lint
|
2016-11-05 16:43:00 +00:00
|
|
|
|
2016-12-08 01:03:41 +00:00
|
|
|
CLEAN_FILES += .lint
|
2016-08-25 18:17:08 +00:00
|
|
|
|
2016-11-05 16:43:00 +00:00
|
|
|
.lint: $(SOURCE_FILES)
|
2017-01-20 15:28:19 +00:00
|
|
|
set -e ; for dir in $$(glide novendor) ; do golint -set_exit_status $$dir ; done && touch $@
|
2016-11-05 16:43:00 +00:00
|
|
|
|
|
|
|
.PHONY: vet
|
2016-12-07 21:26:04 +00:00
|
|
|
vet: .vet .vet.tags
|
2016-11-05 16:43:00 +00:00
|
|
|
|
2016-12-07 21:26:04 +00:00
|
|
|
CLEAN_FILES += .vet .vet.tags
|
2016-08-25 18:17:08 +00:00
|
|
|
|
2016-11-05 16:43:00 +00:00
|
|
|
.vet: $(SOURCE_FILES)
|
2017-01-20 15:28:19 +00:00
|
|
|
go vet $$(glide novendor) && touch $@
|
2016-11-05 16:43:00 +00:00
|
|
|
|
2016-12-07 21:26:04 +00:00
|
|
|
.vet.tags: $(SOURCE_FILES)
|
2017-01-20 15:28:19 +00:00
|
|
|
set -e ; for tag in $(TAGS) ; do go vet -tags $$tag -v $$(glide novendor) ; done && touch $@
|
2016-12-07 21:26:04 +00:00
|
|
|
|
2016-11-07 14:53:24 +00:00
|
|
|
.PHONY: cli.test
|
|
|
|
cli.test: .cli.test
|
|
|
|
|
2016-12-08 01:03:41 +00:00
|
|
|
CLEAN_FILES += .cli.test .cli.test.tags
|
2016-08-25 18:17:08 +00:00
|
|
|
|
2016-11-07 14:53:24 +00:00
|
|
|
.cli.test: $(BUILD) $(wildcard ./test/cli/*.sh)
|
2016-11-22 15:57:47 +00:00
|
|
|
@go run ./test/cli.go ./test/cli/*.sh && touch $@
|
2016-11-07 14:53:24 +00:00
|
|
|
|
2016-12-08 01:03:41 +00:00
|
|
|
.cli.test.tags: $(BUILD) $(wildcard ./test/cli/*.sh)
|
|
|
|
@set -e ; for tag in $(TAGS) ; do go run -tags $$tag ./test/cli.go ./test/cli/*.sh ; done && touch $@
|
|
|
|
|
2016-11-05 16:43:00 +00:00
|
|
|
.PHONY: build
|
2016-11-07 14:53:24 +00:00
|
|
|
build: $(BUILD)
|
2016-11-05 16:43:00 +00:00
|
|
|
|
2016-11-07 14:53:24 +00:00
|
|
|
$(BUILD): $(SOURCE_FILES)
|
2017-01-20 15:28:19 +00:00
|
|
|
go build -o $(BUILD) $(BUILDPATH)
|
2016-11-05 16:43:00 +00:00
|
|
|
|
2018-08-14 03:03:28 +00:00
|
|
|
install.tools:
|
|
|
|
go get -u -v github.com/Masterminds/glide
|
|
|
|
go get -u -v golang.org/x/lint/golint
|
|
|
|
|
2016-12-08 01:39:47 +00:00
|
|
|
./bin:
|
|
|
|
mkdir -p $@
|
|
|
|
|
|
|
|
CLEAN_FILES += bin
|
|
|
|
|
|
|
|
build.arches: ./bin
|
|
|
|
@set -e ;\
|
|
|
|
for pair in $(ARCHES); do \
|
|
|
|
p=$$(echo $$pair | cut -d , -f 1);\
|
|
|
|
a=$$(echo $$pair | cut -d , -f 2);\
|
|
|
|
echo "Building $$p/$$a ...";\
|
2017-01-20 15:28:19 +00:00
|
|
|
GOOS=$$p GOARCH=$$a go build -o ./bin/gomtree.$$p.$$a $(BUILDPATH) ;\
|
2016-12-08 01:39:47 +00:00
|
|
|
done
|
|
|
|
|
2016-11-05 16:43:00 +00:00
|
|
|
clean:
|
2016-08-25 18:17:08 +00:00
|
|
|
rm -rf $(BUILD) $(CLEAN_FILES)
|
2016-11-05 16:43:00 +00:00
|
|
|
|