github.com/MichaelDarr/ahab@v0.0.0-20200528062404-c74c5106e605/Makefile (about) 1 # 2 # github.com/MichaelDarr/ahab 3 # 4 5 BIN := ahab 6 DESTDIR := 7 GO ?= go 8 PREFIX := /usr/local 9 VERSION = $(shell cat VERSION) 10 11 GOFLAGS := -mod=vendor 12 EXTRA_GOFLAGS ?= 13 LDFLAGS := $(LDFLAGS) -X "github.com/MichaelDarr/ahab/internal.Version=$(VERSION)" 14 15 .PHONY: default 16 default: $(BIN) 17 18 .PHONY: self 19 self: ## use ahab to build itself 20 $(BIN) exec make 21 22 .PHONY: build 23 build: $(BIN) 24 25 .PHONY: $(BIN) 26 $(BIN): ## build 27 $(GO) build $(GOFLAGS) -ldflags '-s -w $(LDFLAGS)' $(EXTRA_GOFLAGS) -o $@ 28 29 .PHONY: test 30 test: ## use ahab to test itself 31 cd test; \ 32 $(BIN) exec make containertest 33 34 .PHONY: containertest 35 containertest: ## must be run inside container set up for test suite 36 $(GO) test $(GOFLAGS) -ldflags '-s -w $(LDFLAGS)' github.com/MichaelDarr/ahab/internal 37 38 .PHONY: coverage 39 coverage: ## use ahab to test itself and generate a coverage report 40 cd test; \ 41 $(BIN) exec make containercoverage 42 43 .PHONY: containercoverage 44 containercoverage: ## also run inside container, with verbose output and a coverage report 45 $(GO) test $(GOFLAGS) -v -coverprofile cp.out -ldflags '-s -w $(LDFLAGS)' github.com/MichaelDarr/ahab/internal 46 47 .PHONY: install 48 install: 49 install -d $(DESTDIR)$(PREFIX)/bin 50 install -m 0755 $(BIN) $(DESTDIR)$(PREFIX)/bin/$(BIN) 51 52 .PHONY: uninstall 53 uninstall: 54 rm -f $(DESTDIR)$(PREFIX)/bin/$(BIN)