2016-11-05 16:43:00 +00:00
|
|
|
|
2016-11-07 14:53:24 +00:00
|
|
|
BUILD := gomtree
|
|
|
|
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 := *~
|
2016-12-07 21:26:04 +00:00
|
|
|
TAGS := cvis
|
2016-11-05 16:43:00 +00:00
|
|
|
|
2016-11-18 00:47:31 +00:00
|
|
|
default: build validation
|
2016-11-05 16:43:00 +00:00
|
|
|
|
|
|
|
.PHONY: validation
|
2016-08-25 18:17:08 +00:00
|
|
|
validation: test .lint .vet .cli.test
|
2016-11-05 16:43:00 +00:00
|
|
|
|
|
|
|
.PHONY: test
|
2016-08-25 18:17:08 +00:00
|
|
|
test: .test .test.tags
|
|
|
|
|
|
|
|
CLEAN_FILES += .test .test.tags
|
2016-11-05 16:43:00 +00:00
|
|
|
|
|
|
|
.test: $(SOURCE_FILES)
|
|
|
|
go test -v ./... && touch $@
|
|
|
|
|
2016-08-25 18:17:08 +00:00
|
|
|
.test.tags: $(SOURCE_FILES)
|
2016-12-07 21:26:04 +00:00
|
|
|
for tag in $(TAGS) ; do go test -tags $$tag -v ./... ; done && touch $@
|
2016-08-25 18:17:08 +00:00
|
|
|
|
2016-11-05 16:43:00 +00:00
|
|
|
.PHONY: lint
|
2016-12-07 21:26:04 +00:00
|
|
|
lint: .lint .lint.tags
|
2016-11-05 16:43:00 +00:00
|
|
|
|
2016-12-07 21:26:04 +00:00
|
|
|
CLEAN_FILES += .lint .lint.tags
|
2016-08-25 18:17:08 +00:00
|
|
|
|
2016-11-05 16:43:00 +00:00
|
|
|
.lint: $(SOURCE_FILES)
|
|
|
|
golint -set_exit_status ./... && touch $@
|
|
|
|
|
2016-12-07 21:26:04 +00:00
|
|
|
.lint.tags: $(SOURCE_FILES)
|
|
|
|
for tag in $(TAGS) ; do golint -set_exit_status -tags $$tag -v ./... ; 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)
|
|
|
|
go vet ./... && touch $@
|
|
|
|
|
2016-12-07 21:26:04 +00:00
|
|
|
.vet.tags: $(SOURCE_FILES)
|
|
|
|
for tag in $(TAGS) ; do go vet -tags $$tag -v ./... ; done && touch $@
|
|
|
|
|
2016-11-07 14:53:24 +00:00
|
|
|
.PHONY: cli.test
|
|
|
|
cli.test: .cli.test
|
|
|
|
|
2016-08-25 18:17:08 +00:00
|
|
|
CLEAN_FILES += .cli.test
|
|
|
|
|
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-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)
|
|
|
|
go build ./cmd/$(BUILD)
|
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
|
|
|
|