-
Notifications
You must be signed in to change notification settings - Fork 16
/
Makefile
126 lines (106 loc) · 3.61 KB
/
Makefile
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
PREFIX=/usr
BINDIR=$(DESTDIR)$(PREFIX)/bin
HTMLDIR?=$(PREFIX)/share/doc/slurm-bank/html
MANS=sbank sbank-deposit sbank-balance sbank-project sbank-user \
sbank-time sbank-cluster sbank-submit sbank-version \
sbank-refund
BINS=${MANS} _sbank-balance.pl _sbank-common-cpu_hrs.pl
VERSION=$(shell cat VERSION)
# If ikiwiki is available, build static html docs suitable for being
# shipped in the software package.
ifeq ($(shell which ikiwiki),)
IKIWIKI=@echo "** ikiwiki not found, skipping building docs" >&2; true
## NO_IKIWIKI=1
else
IKIWIKI=ikiwiki
endif
all: build
build:
for man in $(MANS); do \
./mdwn2man $$man 1 doc/$$man.mdwn > $$man.1; \
done
html: docs
docs:
$(IKIWIKI) doc html -v --wikiname slurm-bank --plugin=goodstuff \
--no-usedirs --disable-plugin=openid --plugin=sidebar \
--disable-plugin=shortcut \
--disable-plugin=smiley \
--plugin=comments --set comments_pagespec="*" \
--exclude='news/.*'
ifdef NO_IKIWIKI
$(MAKE) import-docs
endif
install: build
install -d $(DESTDIR)$(PREFIX)/bin
install -m644 src/shflags $(DESTDIR)$(PREFIX)/bin
for bin in $(BINS); do \
install -m 644 src/$$bin $(DESTDIR)$(PREFIX)/bin; \
done
install -m 644 src/sbank-common $(DESTDIR)$(PREFIX)/bin;
chmod +x $(DESTDIR)$(PREFIX)/bin/sbank
chmod +x $(DESTDIR)$(PREFIX)/bin/_sbank-balance.pl
chmod +x $(DESTDIR)$(PREFIX)/bin/_sbank-common-cpu_hrs.pl
install -d $(DESTDIR)$(PREFIX)/share/man/man1
for man in $(MANS); do \
install -m 0644 $$man.1 $(DESTDIR)$(PREFIX)/share/man/man1; \
done
install-docs: docs
install -d $(DESTDIR)$(HTMLDIR)/
if [ -d html ]; then \
rsync -a --delete html/ $(DESTDIR)$(HTMLDIR)/; \
fi
runtests:
$(MAKE) -C t runtests
test: build
./wvtestrun $(MAKE) runtests
check: test
clean:
for man in $(MANS); do \
rm -f $$man.1; \
done
rm -rf html doc/.ikiwiki
dist:
git archive --format tar --prefix=$$(cat VERSION)/ HEAD | \
gzip > $$(cat VERSION).tar.gz
git archive --format tar --prefix=$$(cat VERSION)-html/ html | \
gzip > $$(cat VERSION)-html.tar.gz
dist-withdocs: docs
git archive --format tar --prefix=$$(cat VERSION)/ HEAD | tar xv -
if [ -d html ]; then \
rsync -a --delete html/ $$(cat VERSION)/html/; \
fi
tar czvf $$(cat VERSION).tar.gz $$(cat VERSION)/
echo rm -rf $$(cat VERSION)
release: dist docs
mkdir -p release/$$(cat VERSION)
cp $$(cat VERSION).tar.gz release/$$(cat VERSION)
cp $$(cat VERSION)-html.tar.gz release/$$(cat VERSION)
cp -a html release/$$(cat VERSION)
# update the local 'man' and 'html' branches with pregenerated output files, for
# people who don't have ikiwiki (and maybe to aid in google searches or something)
export-docs: docs
# git update-ref refs/heads/man origin/man '' 2>/dev/null || true
# GIT_INDEX_FILE=gitindex.tmp; export GIT_INDEX_FILE; \
# rm -f $${GIT_INDEX_FILE} && \
# git add -f Documentation/*.1 && \
# git update-ref refs/heads/man \
# $$(echo "Autogenerated man pages for $$(git describe)" \
# | git commit-tree $$(git write-tree --prefix=Documentation) \
# -p refs/heads/man) && \
git update-ref refs/heads/html origin/html '' 2>/dev/null || true
GIT_INDEX_FILE=gitindex.tmp; export GIT_INDEX_FILE; \
rm -f $${GIT_INDEX_FILE} && \
git add -f html/* && \
git update-ref refs/heads/html \
$$(echo "Autogenerated html pages for $$(git describe)" \
| git commit-tree $$(git write-tree --prefix=html) \
-p refs/heads/html)
# don't have ikiwiki but still want to be able to install the docs.
import-docs: clean
mkdir -p html
git archive origin/html | (cd html; tar -xvf -)
push-docs: export-docs
git push origin html
gh-pages: export-docs
git push origin +html:gh-pages
.PHONY: docs