aboutsummaryrefslogtreecommitdiff
path: root/Makefile
blob: becf326de4144cc9c07f950080046584d8248a08 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
.POSIX:
PREFIX       = /usr
MANPREFIX    = $(PREFIX)/share/man
DATE         = 1970-01-01
VERSION      = 0.1.0
NAME         = gistatic
MAILING_LIST = public-inbox
TRANSLATIONS = pt fr eo
CONTRIBLANGS =


.SUFFIXES:
.SUFFIXES: .in

.in:
	@sed \
		-e 's:@VERSION@:$(VERSION):g' \
		-e 's:@DATE@:$(DATE):g'       \
		-e 's:@NAME@:$(NAME):g'       \
		< $< > $@
	@if [ -x $< ]; then chmod +x $@; fi


manpages.en.in = \
	doc/gistatic.en.1.in
manpages.in = $(manpages.en.in) \
	doc/gistatic.pt.1.in \
	doc/gistatic.fr.1.in \
	doc/gistatic.eo.1.in
manpages = $(manpages.in:.in=)



all: src/gistatic $(manpages)


tests/resources/repositories/repo-1/.git \
tests/resources/repositories/repo-2/.git:
	ln -s .gitdir $@


shellcheck:
	@shellcheck src/gistatic.in

emit-index: src/gistatic
	@rm -rf tmp/index/
	@./src/gistatic -i -o tmp/index/ ~/dev/published/git-permalink/ ../capim/ ../libedn/ ../listatic/ ../lisp-cli/
	@ln -rfs tmp/git-permalink tmp/index/git-permalink

emit-repo: src/gistatic
	@rm -rf tmp/git-permalink/
	@time ./src/gistatic    -o tmp/git-permalink/ -u FIXME-url-1 ~/dev/published/git-permalink/

run: shellcheck emit-index emit-repo
	


check: all \
		tests/resources/repositories/repo-1/.git \
		tests/resources/repositories/repo-2/.git
	sh tests/build-sample.sh
	sh tests/integration.sh

clean:
	rm -rf \
		public/ $(manpages) README.*.md CHANGELOG.*.md messages.mo \
		vgcore.* tmp/ src/config.h $(all-objects) $(t-objects)     \
		libgistatic.a gistatic gistatic-tests src/gistatic         \
		tests/resources/repositories/repo-1/.git                   \
		tests/resources/repositories/repo-2/.git

install: all
	mkdir -p \
		'$(DESTDIR)$(PREFIX)/bin' \
		'$(DESTDIR)$(PREFIX)/lib' \
		'$(DESTDIR)$(PREFIX)/include'
	cp gistatic       '$(DESTDIR)$(PREFIX)/bin'
	cp libgistatic.a  '$(DESTDIR)$(PREFIX)/lib'
	cp src/gistatic.h '$(DESTDIR)$(PREFIX)/include'
	sh doc/manpages.sh -ip '$(DESTDIR)$(MANPREFIX)' $(manpages)

uninstall:
	rm -f \
		'$(DESTDIR)$(PREFIX)/bin/gistatic'      \
		'$(DESTDIR)$(PREFIX)/lib/libgistatic.a' \
		'$(DESTDIR)$(PREFIX)/include/gistatic.h'
	sh doc/manpages.sh -up '$(DESTDIR)$(MANPREFIX)' $(manpages)


#
# Personal workflow targets
#

dev-check: check public
	sh tests/dev-integration.sh
	sh aux/assert-shellcheck.sh
	sh aux/workflow/assert-todos.sh
	sh aux/workflow/assert-changelog.sh -n '$(NAME)' $(EXTRA_VERSION)
	sh aux/workflow/assert-readme.sh -n '$(NAME)' -m '$(MAILING_LIST)' \
		$(EXTRA_VERSION)
	sh aux/workflow/assert-manpages.sh -n '$(NAME)' -m '$(MAILING_LIST)' \
		-l '$(TRANSLATIONS) en' $(manpages.en.in)
	sh aux/workflow/repocheck.sh -x1 -l1 -f7

dist:
	sh aux/workflow/dist.sh -d '$(DATE)' -V '$(VERSION)' \
		-n '$(NAME)' -m '$(MAILING_LIST)'

README.en.md: README.md
	ln -fs $? $@

CHANGELOG.en.md: CHANGELOG.md
	ln -fs $? $@

l10n-gen: README.en.md CHANGELOG.en.md $(manpages.en.in)
	sh aux/workflow/l10n.sh -l '$(TRANSLATIONS)' -L '$(CONTRIBLANGS)' $?

public/makefile.svg: Makefile
	mkdir -p '$(@D)'
	makefile2graph check | dot -Tsvg > $@

public: l10n-gen TODOs.md $(manpages) public/makefile.svg
	sh aux/workflow/public.sh -l '$(TRANSLATIONS) $(CONTRIBLANGS) en' \
		-n '$(NAME)' -m '$(MAILING_LIST)' -o public
	sh doc/manpages.sh -Ho public $(manpages)

spellcheck: public
	sh aux/workflow/assert-spelling.sh -l '$(TRANSLATIONS) en' \
		$$(find public -type f -name '*.html')