github.com/mfpierre/corectl@v0.5.6/Makefile (about) 1 2 export GOARCH=amd64 3 export GOOS=darwin 4 export CGO_ENABLED=1 5 6 PROG = corectl 7 ORGANIZATION = github.com/TheNewNormal 8 REPOSITORY = $(ORGANIZATION)/$(PROG) 9 10 VERSION := $(shell git describe --abbrev=6 --dirty=-unreleased --always --tags) 11 BUILDDATE = $(shell /bin/date "+%FT%T%Z") 12 13 ifeq ($(DEBUG),true) 14 GO_GCFLAGS := $(GO_GCFLAGS) -N -l 15 else 16 GO_LDFLAGS := $(GO_LDFLAGS) -w -s 17 endif 18 19 GO_LDFLAGS := $(GO_LDFLAGS) -X main.Version=$(VERSION) \ 20 -X main.BuildDate=$(BUILDDATE) 21 22 all: $(PROG) docs 23 @git status 24 25 $(PROG): clean Makefile 26 godep go build -o $(PROG) -gcflags "$(GO_GCFLAGS)" -ldflags "$(GO_LDFLAGS)" 27 @touch $@ 28 29 clean: 30 @rm -rf $(PROG) documentation/ 31 32 godeps_diff: 33 @godep diff 34 35 godeps_save: godeps_diff 36 @rm -rf Godeps/ 37 @godep save 38 @git status 39 40 docs: ${NAME} documentation/markdown documentation/man 41 42 documentation/man: force 43 @mkdir -p documentation/man 44 ./$(PROG) utils mkMan 45 @for p in $$(ls documentation/man/*.1); do \ 46 sed -i.bak "s/$$(/bin/date '+%h %Y')//" "$$p" ;\ 47 sed -i.bak "/spf13\/cobra$$/d" "$$p" ;\ 48 rm "$$p.bak" ;\ 49 done 50 51 documentation/markdown: force 52 @mkdir -p documentation/markdown 53 ./$(PROG) utils mkMkdown 54 @for p in $$(ls documentation/markdown/*.md); do \ 55 sed -i.bak "/spf13\/cobra/d" "$$p" ;\ 56 rm "$$p.bak" ;\ 57 done 58 59 .PHONY: clean all docs force