Makefile

Thu, 17 Dec 2020 12:29:23 +0100

author
David Demelier <markand@malikania.fr>
date
Thu, 17 Dec 2020 12:29:23 +0100
changeset 5
1b128d430637
parent 4
fc87d1928dab
permissions
-rw-r--r--

change manual page styles

#
# Makefile -- basic Makefile for paster
#
# Copyright (c) 2011-2019 David Demelier <markand@malikania.fr>
#
# Permission to use, copy, modify, and/or distribute this software for any
# purpose with or without fee is hereby granted, provided that the above
# copyright notice and this permission notice appear in all copies.
#
# THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
# WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
# MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
# ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
# WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
# ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
# OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
#

.POSIX:

SRCS=           index.md
PROJECT=        paster
VERSION=        0.2.1
MAN1=           paster-${VERSION}/paster.1
MAN8=           paster-${VERSION}/pasterd-clean.8 \
                paster-${VERSION}/pasterd.8

OBJS=           ${SRCS:.md=.html}
PANDOC=         pandoc
PANDOC_FLAGS=   -f markdown -t html5 --no-highlight --template templates/template.html
MANDOC=         mandoc
MANDOC_MD=      -T markdown
MANDOC_PDF=     -T pdf
DIST=           ${PROJECT}-${VERSION}.tar.xz
WRKDIR=         ${PROJECT}-${VERSION}

MAN1_HTML=      ${MAN1:.1=.html}
MAN1_PDF=       ${MAN1:.1=.pdf}
MAN8_HTML=      ${MAN8:.8=.html}
MAN8_PDF=       ${MAN8:.8=.pdf}

MAN_OBJS=       ${MAN1_HTML} ${MAN1_PDF} \
                ${MAN8_HTML} ${MAN8_PDF}

.SUFFIXES:
.SUFFIXES: .1 .8 .html .md .pdf

all: www

.md.html:
	${PANDOC} ${PANDOC_FLAGS} -o $@ $<

.1.html:
	${MANDOC} < $< ${MANDOC_MD} | ${PANDOC} ${PANDOC_FLAGS} -M title=${<F} -o $@
.8.html:
	${MANDOC} < $< ${MANDOC_MD} | ${PANDOC} ${PANDOC_FLAGS} -M title=${<F} -o $@

.1.pdf:
	${MANDOC} < $< ${MANDOC_PDF} > $@
.8.pdf:
	${MANDOC} < $< ${MANDOC_PDF} > $@

${DIST}:
	wget -q http://releases.malikania.fr/${PROJECT}/${VERSION}/$@ -O $@

${WRKDIR}: ${DIST}
	tar -xJf $<

${MAN1} ${MAN8}: ${WRKDIR}
	${MAKE} -C $< ${@F}

${OBJS}: css/no-class.css templates/template.html

www: ${OBJS} ${MAN_OBJS}
	mkdir -p www
	cp -R css www
	cp ${OBJS} ${MAN_OBJS} www

clean:
	rm -rf www ${WRKDIR}
	rm -f ${DIST}
	rm -f ${OBJS} ${MAN_OBJS}

.PHONY: all clean

mercurial