| 1 | VERSION ?= $(shell git describe --tags 2>/dev/null) |
| 2 | ifeq "$(VERSION)" "" |
| 3 | VERSION := UNKNOWN |
| 4 | endif |
| 5 | |
| 6 | LDFLAGS=\ |
| 7 | -X kevinschoon.com/hierarchy/pkg/version/internal.Version=$(VERSION) |
| 8 | |
| 9 | .PHONY: bin/hierarchy |
| 10 | |
| 11 | bin/hierarchy: bin |
| 12 | cd cmd/hierarchy && \ |
| 13 | go build -ldflags '${LDFLAGS}' -o ../../$@ |
| 14 | |
| 15 | bin: |
| 16 | mkdir $@ |
| 17 | |
| 18 | clean: |
| 19 | [[ -d bin ]] && rm -r bin |
| 20 | |
| 21 | watch: |
| 22 | ./watch.sh "go build -o bin/hierarchy" |
| 23 | |
| 24 | man/hierarchy.8: bin/hierarchy |
| 25 | bin/hierarchy gen_man > $@ |
| 26 |