Makefile 1.8 KB
Newer Older
M
Mislav Marohnić 已提交
1
SOURCES = $(shell script/build files)
M
Mislav Marohnić 已提交
2 3
TODAY_DATE = $(shell date '+%d %b %Y')
HUB_VERSION = $(shell hub version | tail -1)
M
Mislav Marohnić 已提交
4

5
MIN_COVERAGE = 89.4
M
Mislav Marohnić 已提交
6

M
Mislav Marohnić 已提交
7
HELP_CMD = \
8 9 10 11 12
	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 \
13
	share/man/man1/hub-delete.1 \
14
	share/man/man1/hub-fork.1 \
J
Johan Walles 已提交
15
	share/man/man1/hub-pr.1 \
16 17
	share/man/man1/hub-pull-request.1 \
	share/man/man1/hub-release.1 \
18
	share/man/man1/hub-issue.1 \
19
	share/man/man1/hub-sync.1 \
M
Mislav Marohnić 已提交
20 21

HELP_EXT = \
22 23 24 25 26 27 28 29 30 31 32 33 34 35
	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)
M
Mislav Marohnić 已提交
36 37 38 39 40 41 42

TEXT_WIDTH = 87

bin/hub: $(SOURCES)
	script/build -o $@

test:
M
Mislav Marohnić 已提交
43
	go test ./...
M
Mislav Marohnić 已提交
44 45

test-all: bin/cucumber
M
Mislav Marohnić 已提交
46 47 48
ifdef CI
	script/test --coverage $(MIN_COVERAGE)
else
M
Mislav Marohnić 已提交
49
	script/test
M
Mislav Marohnić 已提交
50
endif
M
Mislav Marohnić 已提交
51

52
bin/cucumber:
M
Mislav Marohnić 已提交
53 54
	script/bootstrap

M
Mislav Marohnić 已提交
55
fmt:
M
Mislav Marohnić 已提交
56
	go fmt ./...
M
Mislav Marohnić 已提交
57

58
man-pages: $(HELP_ALL:=.md) $(HELP_ALL) $(HELP_ALL:=.txt)
M
Mislav Marohnić 已提交
59

60
%.txt: %
M
Mislav Marohnić 已提交
61 62
	groff -Wall -mtty-char -mandoc -Tutf8 -rLL=$(TEXT_WIDTH)n $< | col -b >$@

63
$(HELP_ALL): share/man/.man-pages.stamp
M
Mislav Marohnić 已提交
64 65 66 67 68
share/man/.man-pages.stamp: $(HELP_ALL:=.md) ./man-template.html
	go run md2roff-bin/cmd.go --manual="hub manual" \
		--date="$(TODAY_DATE)" --version="$(HUB_VERSION)" \
		--template=./man-template.html \
		share/man/man1/*.md
69
	touch $@
M
Mislav Marohnić 已提交
70

71 72
%.1.md: bin/hub
	bin/hub help $(*F) --plain-text >$@
M
Mislav Marohnić 已提交
73

74
share/man/man1/hub.1.md:
M
Mislav Marohnić 已提交
75 76
	true

M
Mislav Marohnić 已提交
77 78 79
install: bin/hub man-pages
	bash < script/install.sh

M
Mislav Marohnić 已提交
80
clean:
M
Mislav Marohnić 已提交
81
	git clean -fdx bin share/man
M
Mislav Marohnić 已提交
82 83

.PHONY: clean test test-all man-pages fmt install