aboutsummaryrefslogtreecommitdiff
path: root/Makefile
blob: 03c006b63708ec8914397d1f349906003eb6c6ae (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
.POSIX:
PREFIX       = /usr/local
MANPREFIX    = $(PREFIX)/usr/local
DATE         = 1970-01-01
VERSION      = 0.1.0
NAME         = gistatic
MAILING_LIST = public-inbox
TRANSLATIONS = pt fr eo
CONTRIBLANGS =
LOCALLDLIBS  = -lgit2
DEFS         = \
	-D_POSIX_C_SOURCE=200809L \
	-DVERSION='"$(VERSION)"'  \
	-DDATE='"$(DATE)"'

.SUFFIXES: .in .t

.in:
	sed -e 's:@VERSION@:$(VERSION):g' -e 's:@DATE@:$(DATE):g' < $< > $@

.c:
	$(CC) $(CFLAGS) $(DEFS) $(LDFLAGS)        -o $@ $< $(LOCALLDLIBS) \
		$(LDLIBS)

.c.t:
	$(CC) $(CFLAGS) $(DEFS) $(LDFLAGS) -DTEST -o $@ $< $(LOCALLDLIBS) \
		$(LDLIBS)

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: $(manpages) src/gistatic

check: all src/gistatic.t
	rm -f tests/resources/repositories/repo-1/.git
	rm -f tests/resources/repositories/repo-2/.git
	ln -s .gitdir tests/resources/repositories/repo-1/.git
	ln -s .gitdir tests/resources/repositories/repo-2/.git
	./src/gistatic.t
	sh tests/integration.sh
	sh aux/assert-catgets.sh src/gistatic.c

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

install: all
	mkdir -p $(DESTDIR)$(PREFIX)/bin
	cp src/gistatic $(DESTDIR)$(PREFIX)/bin
	sh aux/workflow/manpages.sh -ip $(DESTDIR)$(MANPREFIX) $(manpages)

uninstall:
	sh aux/workflow/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)
	sh aux/workflow/assert-readme.sh -n $(NAME) -m $(MAILING_LIST)
	sh aux/workflow/assert-manpages.sh -n $(NAME) -m $(MAILING_LIST) \
		-l '$(TRANSLATIONS) en' $(manpages.en.in)
	. aux/lib.sh && $(MAKE) PREFIX=`mkdtemp` \
		install installcheck uninstall uninstallcheck

installcheck:
	sh aux/workflow/installcheck.sh -x1 -l1 -f5 -p $(PREFIX)

uninstallcheck:
	sh aux/workflow/installcheck.sh -up $(PREFIX)

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: l10n-gen TODOs.md $(manpages)
	sh aux/workflow/public.sh -l '$(TRANSLATIONS) $(CONTRIBLANGS) en' \
		-n $(NAME) -m $(MAILING_LIST) -o public
	sh aux/workflow/manpages.sh -Ho public $(manpages)

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