Pawel Wieczorek | cc75291 | 2019-05-26 11:40:36 +0200 | [diff] [blame] | 1 | PROJECT = check |
| 2 | BIN_DIR = bin |
Pawel Wieczorek | ab8186e | 2019-08-07 13:38:38 +0200 | [diff] [blame] | 3 | SRC_DIR = src |
| 4 | PKG_DIR = pkg |
Pawel Wieczorek | cc75291 | 2019-05-26 11:40:36 +0200 | [diff] [blame] | 5 | BIN = check |
| 6 | |
| 7 | all: run |
| 8 | |
| 9 | run: build |
| 10 | $(BIN_DIR)/$(BIN) |
| 11 | |
| 12 | build: $(BIN) |
| 13 | |
| 14 | $(BIN): export GOPATH = $(shell pwd) |
Pawel Wieczorek | ab8186e | 2019-08-07 13:38:38 +0200 | [diff] [blame] | 15 | $(BIN): deps |
Pawel Wieczorek | cc75291 | 2019-05-26 11:40:36 +0200 | [diff] [blame] | 16 | go install $(PROJECT)/cmd/$(BIN) |
| 17 | |
Pawel Wieczorek | ab8186e | 2019-08-07 13:38:38 +0200 | [diff] [blame] | 18 | deps: export GOPATH = $(shell pwd) |
| 19 | deps: |
| 20 | go get $(PROJECT)/... |
| 21 | |
| 22 | clean_deps: export GOPATH = $(shell pwd) |
| 23 | clean_deps: |
| 24 | go clean -i -r $(PROJECT)/... 2>/dev/null || true |
| 25 | |
Pawel Wieczorek | 056ef4c | 2019-07-08 14:17:55 +0200 | [diff] [blame] | 26 | test: export GOPATH = $(shell pwd) |
Pawel Wieczorek | 2b2b799 | 2019-08-07 13:52:49 +0200 | [diff] [blame^] | 27 | test: test_deps |
Pawel Wieczorek | 056ef4c | 2019-07-08 14:17:55 +0200 | [diff] [blame] | 28 | go test $(PROJECT)/... |
| 29 | |
Pawel Wieczorek | 2b2b799 | 2019-08-07 13:52:49 +0200 | [diff] [blame^] | 30 | test_watch: export GOPATH = $(shell pwd) |
| 31 | test_watch: test_deps |
| 32 | $(BIN_DIR)/ginkgo watch $(SRC_DIR)/$(PROJECT)/... |
| 33 | |
| 34 | test_deps: export GOPATH = $(shell pwd) |
| 35 | test_deps: |
| 36 | go get github.com/onsi/ginkgo/ginkgo |
| 37 | go get -t $(PROJECT)/... |
| 38 | |
| 39 | clean_test_deps: export GOPATH = $(shell pwd) |
| 40 | clean_test_deps: |
| 41 | go clean -i -r github.com/onsi/ginkgo/ginkgo 2>/dev/null || true |
| 42 | |
| 43 | clean: clean_deps clean_test_deps |
Pawel Wieczorek | 660f496 | 2019-07-08 14:24:19 +0200 | [diff] [blame] | 44 | -rmdir $(BIN_DIR) |
Pawel Wieczorek | ab8186e | 2019-08-07 13:38:38 +0200 | [diff] [blame] | 45 | rm -rf $(PKG_DIR) |
| 46 | find $(SRC_DIR) -mindepth 1 -maxdepth 1 ! -name $(PROJECT) -exec rm -rf {} + |
Pawel Wieczorek | cc75291 | 2019-05-26 11:40:36 +0200 | [diff] [blame] | 47 | |
Pawel Wieczorek | 2b2b799 | 2019-08-07 13:52:49 +0200 | [diff] [blame^] | 48 | .PHONY: all run build deps clean_deps test test_watch test_deps clean_test_deps clean $(BIN) |