Makefile

Fri, 07 Feb 2020 14:38:00 +0100

author
David Demelier <markand@malikania.fr>
date
Fri, 07 Feb 2020 14:38:00 +0100
changeset 0
80a2cf045e6a
child 1
acfb872c93a1
permissions
-rw-r--r--

initial website

0
80a2cf045e6a initial website
David Demelier <markand@malikania.fr>
parents:
diff changeset
1 #
80a2cf045e6a initial website
David Demelier <markand@malikania.fr>
parents:
diff changeset
2 # Makefile -- basic Makefile for paster
80a2cf045e6a initial website
David Demelier <markand@malikania.fr>
parents:
diff changeset
3 #
80a2cf045e6a initial website
David Demelier <markand@malikania.fr>
parents:
diff changeset
4 # Copyright (c) 2020 David Demelier <markand@malikania.fr>
80a2cf045e6a initial website
David Demelier <markand@malikania.fr>
parents:
diff changeset
5 #
80a2cf045e6a initial website
David Demelier <markand@malikania.fr>
parents:
diff changeset
6 # Permission to use, copy, modify, and/or distribute this software for any
80a2cf045e6a initial website
David Demelier <markand@malikania.fr>
parents:
diff changeset
7 # purpose with or without fee is hereby granted, provided that the above
80a2cf045e6a initial website
David Demelier <markand@malikania.fr>
parents:
diff changeset
8 # copyright notice and this permission notice appear in all copies.
80a2cf045e6a initial website
David Demelier <markand@malikania.fr>
parents:
diff changeset
9 #
80a2cf045e6a initial website
David Demelier <markand@malikania.fr>
parents:
diff changeset
10 # THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
80a2cf045e6a initial website
David Demelier <markand@malikania.fr>
parents:
diff changeset
11 # WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
80a2cf045e6a initial website
David Demelier <markand@malikania.fr>
parents:
diff changeset
12 # MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
80a2cf045e6a initial website
David Demelier <markand@malikania.fr>
parents:
diff changeset
13 # ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
80a2cf045e6a initial website
David Demelier <markand@malikania.fr>
parents:
diff changeset
14 # WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
80a2cf045e6a initial website
David Demelier <markand@malikania.fr>
parents:
diff changeset
15 # ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
80a2cf045e6a initial website
David Demelier <markand@malikania.fr>
parents:
diff changeset
16 # OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
80a2cf045e6a initial website
David Demelier <markand@malikania.fr>
parents:
diff changeset
17 #
80a2cf045e6a initial website
David Demelier <markand@malikania.fr>
parents:
diff changeset
18
80a2cf045e6a initial website
David Demelier <markand@malikania.fr>
parents:
diff changeset
19 .POSIX:
80a2cf045e6a initial website
David Demelier <markand@malikania.fr>
parents:
diff changeset
20
80a2cf045e6a initial website
David Demelier <markand@malikania.fr>
parents:
diff changeset
21 SRCS= index.md
80a2cf045e6a initial website
David Demelier <markand@malikania.fr>
parents:
diff changeset
22 OBJS= ${SRCS:.md=.html}
80a2cf045e6a initial website
David Demelier <markand@malikania.fr>
parents:
diff changeset
23 PANDOC= pandoc
80a2cf045e6a initial website
David Demelier <markand@malikania.fr>
parents:
diff changeset
24 PANDOC_FLAGS= -f markdown -t html5 --template templates/template.html
80a2cf045e6a initial website
David Demelier <markand@malikania.fr>
parents:
diff changeset
25 MANDOC= mandoc
80a2cf045e6a initial website
David Demelier <markand@malikania.fr>
parents:
diff changeset
26 MANDOC_HTML= -T html -O man=%N.html
80a2cf045e6a initial website
David Demelier <markand@malikania.fr>
parents:
diff changeset
27 MANDOC_PDF= -T pdf
80a2cf045e6a initial website
David Demelier <markand@malikania.fr>
parents:
diff changeset
28 VERSION= 0.1.0
80a2cf045e6a initial website
David Demelier <markand@malikania.fr>
parents:
diff changeset
29 SOURCE= paster-${VERSION}.tar.xz
80a2cf045e6a initial website
David Demelier <markand@malikania.fr>
parents:
diff changeset
30 WRKDIR= paster-${VERSION}
80a2cf045e6a initial website
David Demelier <markand@malikania.fr>
parents:
diff changeset
31
80a2cf045e6a initial website
David Demelier <markand@malikania.fr>
parents:
diff changeset
32 MAN1= paster-${VERSION}/paster.1
80a2cf045e6a initial website
David Demelier <markand@malikania.fr>
parents:
diff changeset
33 MAN8= paster-${VERSION}/pasterd.8 \
80a2cf045e6a initial website
David Demelier <markand@malikania.fr>
parents:
diff changeset
34 paster-${VERSION}/pasterd-clean.8
80a2cf045e6a initial website
David Demelier <markand@malikania.fr>
parents:
diff changeset
35
80a2cf045e6a initial website
David Demelier <markand@malikania.fr>
parents:
diff changeset
36 MAN1HTML= ${MAN1:.1=.html}
80a2cf045e6a initial website
David Demelier <markand@malikania.fr>
parents:
diff changeset
37 MAN1PDF= ${MAN1:.1=.pdf}
80a2cf045e6a initial website
David Demelier <markand@malikania.fr>
parents:
diff changeset
38 MAN8HTML= ${MAN8:.8=.html}
80a2cf045e6a initial website
David Demelier <markand@malikania.fr>
parents:
diff changeset
39 MAN8PDF= ${MAN8:.8=.pdf}
80a2cf045e6a initial website
David Demelier <markand@malikania.fr>
parents:
diff changeset
40
80a2cf045e6a initial website
David Demelier <markand@malikania.fr>
parents:
diff changeset
41 .SUFFIXES:
80a2cf045e6a initial website
David Demelier <markand@malikania.fr>
parents:
diff changeset
42 .SUFFIXES: .html .md .pdf .1 .8 .in
80a2cf045e6a initial website
David Demelier <markand@malikania.fr>
parents:
diff changeset
43
80a2cf045e6a initial website
David Demelier <markand@malikania.fr>
parents:
diff changeset
44 all: site
80a2cf045e6a initial website
David Demelier <markand@malikania.fr>
parents:
diff changeset
45
80a2cf045e6a initial website
David Demelier <markand@malikania.fr>
parents:
diff changeset
46 .md.html:
80a2cf045e6a initial website
David Demelier <markand@malikania.fr>
parents:
diff changeset
47 ${PANDOC} ${PANDOC_FLAGS} -o $@ $<
80a2cf045e6a initial website
David Demelier <markand@malikania.fr>
parents:
diff changeset
48
80a2cf045e6a initial website
David Demelier <markand@malikania.fr>
parents:
diff changeset
49 .1.html .8.html:
80a2cf045e6a initial website
David Demelier <markand@malikania.fr>
parents:
diff changeset
50 ${MANDOC} < $< ${MANDOC_HTML} > $@
80a2cf045e6a initial website
David Demelier <markand@malikania.fr>
parents:
diff changeset
51
80a2cf045e6a initial website
David Demelier <markand@malikania.fr>
parents:
diff changeset
52 .1.pdf .8.pdf:
80a2cf045e6a initial website
David Demelier <markand@malikania.fr>
parents:
diff changeset
53 ${MANDOC} < $< ${MANDOC_PDF} > $@
80a2cf045e6a initial website
David Demelier <markand@malikania.fr>
parents:
diff changeset
54
80a2cf045e6a initial website
David Demelier <markand@malikania.fr>
parents:
diff changeset
55 ${MAN1HTML} ${MAN8HTML} ${MAN1PDF} ${MAN8PDF}: pre-man
80a2cf045e6a initial website
David Demelier <markand@malikania.fr>
parents:
diff changeset
56
80a2cf045e6a initial website
David Demelier <markand@malikania.fr>
parents:
diff changeset
57 ${FILES}: templates/template.html
80a2cf045e6a initial website
David Demelier <markand@malikania.fr>
parents:
diff changeset
58
80a2cf045e6a initial website
David Demelier <markand@malikania.fr>
parents:
diff changeset
59 ${SOURCE}:
80a2cf045e6a initial website
David Demelier <markand@malikania.fr>
parents:
diff changeset
60 wget -q http://releases.malikania.fr/paster/${VERSION}/$@ -O $@
80a2cf045e6a initial website
David Demelier <markand@malikania.fr>
parents:
diff changeset
61
80a2cf045e6a initial website
David Demelier <markand@malikania.fr>
parents:
diff changeset
62 ${WRKDIR}: ${SOURCE}
80a2cf045e6a initial website
David Demelier <markand@malikania.fr>
parents:
diff changeset
63 tar -xJf ${SOURCE}
80a2cf045e6a initial website
David Demelier <markand@malikania.fr>
parents:
diff changeset
64
80a2cf045e6a initial website
David Demelier <markand@malikania.fr>
parents:
diff changeset
65 pre-man: ${WRKDIR}
80a2cf045e6a initial website
David Demelier <markand@malikania.fr>
parents:
diff changeset
66 ${MAKE} -C ${WRKDIR} pasterd.8 pasterd-clean.8 paster.1
80a2cf045e6a initial website
David Demelier <markand@malikania.fr>
parents:
diff changeset
67
80a2cf045e6a initial website
David Demelier <markand@malikania.fr>
parents:
diff changeset
68 site: ${OBJS} ${MAN1HTML} ${MAN1PDF} ${MAN8HTML} ${MAN8PDF}
80a2cf045e6a initial website
David Demelier <markand@malikania.fr>
parents:
diff changeset
69
80a2cf045e6a initial website
David Demelier <markand@malikania.fr>
parents:
diff changeset
70 clean:
80a2cf045e6a initial website
David Demelier <markand@malikania.fr>
parents:
diff changeset
71 rm -f ${OBJS}
80a2cf045e6a initial website
David Demelier <markand@malikania.fr>
parents:
diff changeset
72 rm -f ${MAN1HTML} ${MAN8HTML}
80a2cf045e6a initial website
David Demelier <markand@malikania.fr>
parents:
diff changeset
73 rm -f ${MAN1PDF} ${MAN8PDF}
80a2cf045e6a initial website
David Demelier <markand@malikania.fr>
parents:
diff changeset
74 rm -rf ${WRKDIR} ${SOURCE}
80a2cf045e6a initial website
David Demelier <markand@malikania.fr>
parents:
diff changeset
75
80a2cf045e6a initial website
David Demelier <markand@malikania.fr>
parents:
diff changeset
76 publish: site
80a2cf045e6a initial website
David Demelier <markand@malikania.fr>
parents:
diff changeset
77 rsync -av css webfonts ${OBJS} ${MAN1HTML} ${MAN1PDF} \
80a2cf045e6a initial website
David Demelier <markand@malikania.fr>
parents:
diff changeset
78 ${MAN8HTML} ${MAN8PDF} ${DESTINATION}
80a2cf045e6a initial website
David Demelier <markand@malikania.fr>
parents:
diff changeset
79
80a2cf045e6a initial website
David Demelier <markand@malikania.fr>
parents:
diff changeset
80 .PHONY: all clean publish site

mercurial