2016-01-25 07:57:22 +03:00
|
|
|
SOURCES = $(shell script/build files)
|
2018-12-30 03:59:02 +03:00
|
|
|
SOURCE_DATE_EPOCH ?= $(shell date +%s)
|
|
|
|
BUILD_DATE = $(shell date -u -d "@$(SOURCE_DATE_EPOCH)" '+%d %b %Y' 2>/dev/null || date -u -r "$(SOURCE_DATE_EPOCH)" '+%d %b %Y')
|
2018-12-29 13:31:21 +03:00
|
|
|
HUB_VERSION = $(shell hub version | tail -1)
|
2019-01-02 14:58:06 +03:00
|
|
|
FLAGS_ALL = $(shell go version | grep -q 'go1.[89]' || echo 'all=')
|
2019-01-02 14:57:06 +03:00
|
|
|
export LDFLAGS := -extldflags='$(LDFLAGS)'
|
2019-01-02 14:58:06 +03:00
|
|
|
export GCFLAGS := $(FLAGS_ALL)-trimpath='$(PWD)'
|
|
|
|
export ASMFLAGS := $(FLAGS_ALL)-trimpath='$(PWD)'
|
2016-01-25 07:57:22 +03:00
|
|
|
|
2018-06-07 18:33:19 +03:00
|
|
|
MIN_COVERAGE = 89.4
|
2018-06-07 15:52:22 +03:00
|
|
|
|
2016-01-25 07:57:22 +03:00
|
|
|
HELP_CMD = \
|
2016-08-21 14:51:14 +03:00
|
|
|
share/man/man1/hub-alias.1 \
|
|
|
|
share/man/man1/hub-browse.1 \
|
|
|
|
share/man/man1/hub-ci-status.1 \
|
|
|
|
share/man/man1/hub-compare.1 \
|
|
|
|
share/man/man1/hub-create.1 \
|
2018-03-18 22:47:34 +03:00
|
|
|
share/man/man1/hub-delete.1 \
|
2016-08-21 14:51:14 +03:00
|
|
|
share/man/man1/hub-fork.1 \
|
2017-02-26 12:13:22 +03:00
|
|
|
share/man/man1/hub-pr.1 \
|
2016-08-21 14:51:14 +03:00
|
|
|
share/man/man1/hub-pull-request.1 \
|
|
|
|
share/man/man1/hub-release.1 \
|
2016-08-21 15:03:50 +03:00
|
|
|
share/man/man1/hub-issue.1 \
|
2016-09-12 07:29:53 +03:00
|
|
|
share/man/man1/hub-sync.1 \
|
2016-01-25 07:57:22 +03:00
|
|
|
|
|
|
|
HELP_EXT = \
|
2016-08-21 14:51:14 +03:00
|
|
|
share/man/man1/hub-am.1 \
|
|
|
|
share/man/man1/hub-apply.1 \
|
|
|
|
share/man/man1/hub-checkout.1 \
|
|
|
|
share/man/man1/hub-cherry-pick.1 \
|
|
|
|
share/man/man1/hub-clone.1 \
|
|
|
|
share/man/man1/hub-fetch.1 \
|
|
|
|
share/man/man1/hub-help.1 \
|
|
|
|
share/man/man1/hub-init.1 \
|
|
|
|
share/man/man1/hub-merge.1 \
|
|
|
|
share/man/man1/hub-push.1 \
|
|
|
|
share/man/man1/hub-remote.1 \
|
|
|
|
share/man/man1/hub-submodule.1 \
|
|
|
|
|
|
|
|
HELP_ALL = share/man/man1/hub.1 $(HELP_CMD) $(HELP_EXT)
|
2016-01-25 07:57:22 +03:00
|
|
|
|
|
|
|
TEXT_WIDTH = 87
|
|
|
|
|
|
|
|
bin/hub: $(SOURCES)
|
|
|
|
script/build -o $@
|
|
|
|
|
|
|
|
test:
|
2018-06-08 12:16:45 +03:00
|
|
|
go test ./...
|
2016-01-25 07:57:22 +03:00
|
|
|
|
|
|
|
test-all: bin/cucumber
|
2018-06-07 15:52:22 +03:00
|
|
|
ifdef CI
|
|
|
|
script/test --coverage $(MIN_COVERAGE)
|
|
|
|
else
|
2016-01-25 07:57:22 +03:00
|
|
|
script/test
|
2018-06-07 15:52:22 +03:00
|
|
|
endif
|
2016-01-25 07:57:22 +03:00
|
|
|
|
2018-12-29 12:07:57 +03:00
|
|
|
bin/cucumber:
|
2016-01-25 07:57:22 +03:00
|
|
|
script/bootstrap
|
|
|
|
|
2016-01-25 09:14:05 +03:00
|
|
|
fmt:
|
2018-06-08 12:16:45 +03:00
|
|
|
go fmt ./...
|
2016-01-25 09:14:05 +03:00
|
|
|
|
2018-12-29 12:07:57 +03:00
|
|
|
man-pages: $(HELP_ALL:=.md) $(HELP_ALL) $(HELP_ALL:=.txt)
|
2016-01-25 07:57:22 +03:00
|
|
|
|
2018-12-29 12:07:57 +03:00
|
|
|
%.txt: %
|
2016-01-25 07:57:22 +03:00
|
|
|
groff -Wall -mtty-char -mandoc -Tutf8 -rLL=$(TEXT_WIDTH)n $< | col -b >$@
|
|
|
|
|
2018-11-12 18:44:42 +03:00
|
|
|
$(HELP_ALL): share/man/.man-pages.stamp
|
2018-12-29 13:31:21 +03:00
|
|
|
share/man/.man-pages.stamp: $(HELP_ALL:=.md) ./man-template.html
|
|
|
|
go run md2roff-bin/cmd.go --manual="hub manual" \
|
2018-12-30 03:59:02 +03:00
|
|
|
--date="$(BUILD_DATE)" --version="$(HUB_VERSION)" \
|
2018-12-29 13:31:21 +03:00
|
|
|
--template=./man-template.html \
|
|
|
|
share/man/man1/*.md
|
2018-10-09 14:09:58 +03:00
|
|
|
touch $@
|
2016-01-25 07:57:22 +03:00
|
|
|
|
2018-12-29 12:07:57 +03:00
|
|
|
%.1.md: bin/hub
|
|
|
|
bin/hub help $(*F) --plain-text >$@
|
2016-01-25 07:57:22 +03:00
|
|
|
|
2018-12-29 12:07:57 +03:00
|
|
|
share/man/man1/hub.1.md:
|
2016-01-25 07:57:22 +03:00
|
|
|
true
|
|
|
|
|
2016-10-03 21:32:39 +03:00
|
|
|
install: bin/hub man-pages
|
|
|
|
bash < script/install.sh
|
|
|
|
|
2016-01-25 07:57:22 +03:00
|
|
|
clean:
|
2017-05-17 14:03:06 +03:00
|
|
|
git clean -fdx bin share/man
|
2018-06-08 12:16:45 +03:00
|
|
|
|
|
|
|
.PHONY: clean test test-all man-pages fmt install
|