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) |
| 27 | test: |
| 28 | go test $(PROJECT)/... |
| 29 | |
Pawel Wieczorek | ab8186e | 2019-08-07 13:38:38 +0200 | [diff] [blame^] | 30 | clean: clean_deps |
Pawel Wieczorek | 660f496 | 2019-07-08 14:24:19 +0200 | [diff] [blame] | 31 | -rmdir $(BIN_DIR) |
Pawel Wieczorek | ab8186e | 2019-08-07 13:38:38 +0200 | [diff] [blame^] | 32 | rm -rf $(PKG_DIR) |
| 33 | find $(SRC_DIR) -mindepth 1 -maxdepth 1 ! -name $(PROJECT) -exec rm -rf {} + |
Pawel Wieczorek | cc75291 | 2019-05-26 11:40:36 +0200 | [diff] [blame] | 34 | |
Pawel Wieczorek | ab8186e | 2019-08-07 13:38:38 +0200 | [diff] [blame^] | 35 | .PHONY: all run build deps clean_deps test clean $(BIN) |