Makefile

Wed, 13 Jan 2021 22:12:21 +0100

author
David Demelier <markand@malikania.fr>
date
Wed, 13 Jan 2021 22:12:21 +0100
changeset 35
a584aa4fa8f4
parent 34
394a5ae718bb
child 38
3aaac1af65d5
permissions
-rw-r--r--

add news/2020-01-13.diet

#
# Makefile -- basic BSD Makefile for irccd-www
#
# Copyright (c) 2013-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.
#

PANDOC=         pandoc
PANDOC_FLAGS=   -f markdown -t html5 --template templates/template.html
MANDOC=         mandoc
MANDOC_PDF=     -T pdf
MANDOC_MD=      -T markdown
VERSION=        3.1.1
SOURCE=         irccd-${VERSION}.tar.xz
WRKDIR=         irccd-${VERSION}

MAN1=           irccd-${VERSION}/man/irccd.1 \
                irccd-${VERSION}/man/irccdctl.1 \
                irccd-${VERSION}/man/irccd-test.1
MAN5=           irccd-${VERSION}/man/irccd.conf.5 \
                irccd-${VERSION}/man/irccdctl.conf.5
MAN7=           irccd-${VERSION}/man/irccd-api.7 \
                irccd-${VERSION}/man/irccd-ipc.7 \
                irccd-${VERSION}/man/irccd-templates.7 \
                irccd-${VERSION}/plugins/ask/ask.7 \
                irccd-${VERSION}/plugins/auth/auth.7 \
                irccd-${VERSION}/plugins/hangman/hangman.7 \
                irccd-${VERSION}/plugins/history/history.7 \
                irccd-${VERSION}/plugins/joke/joke.7 \
                irccd-${VERSION}/plugins/links/links.7 \
                irccd-${VERSION}/plugins/logger/logger.7 \
                irccd-${VERSION}/plugins/plugin/plugin.7 \
                irccd-${VERSION}/plugins/roulette/roulette.7 \
                irccd-${VERSION}/plugins/tictactoe/tictactoe.7

MAN1HTML=       ${MAN1:.1=.html}
MAN1PDF=        ${MAN1:.1=.pdf}
MAN5HTML=       ${MAN5:.5=.html}
MAN5PDF=        ${MAN5:.5=.pdf}
MAN7HTML=       ${MAN7:.7=.html}
MAN7PDF=        ${MAN7:.7=.pdf}

SITE_SRCS=      documentation.md \
                downloads.md \
                faq.md \
                index.md \
                versioning.md \
                news/2020-01-13.diet.md
SITE_HTML=      ${SITE_SRCS:.md=.html}

.SUFFIXES:
.SUFFIXES: .html .pdf .md .1 .5 .7

all: www man doxygen

${SITE_HTML}: templates/template.html

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

${WRKDIR}: ${SOURCE}
	tar xJf ${SOURCE}

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

.1.html .5.html .7.html:
	sed "s/@IRCCD_MAN_DATE@/January 04, 2021/" $< | ${MANDOC} ${MANDOC_MD} < $< | ${PANDOC} ${PANDOC_FLAGS} -M title=${<F} -o $@

.1.pdf .5.pdf .7.pdf:
	sed "s/@IRCCD_MAN_DATE@/January 04, 2021/" $< | ${MANDOC} ${MANDOC_PDF} > $@

man: ${WRKDIR} ${MAN1HTML} ${MAN5HTML} ${MAN7HTML} ${MAN1PDF} ${MAN5PDF} ${MAN7PDF}

doxygen: ${WKRDIR}
	mkdir -p irccd-${VERSION}/build
	cmake -S irccd-${VERSION} -B irccd-${VERSION}/build > /dev/null 2>&1
	cmake --build irccd-${VERSION}/build --target doxygen > /dev/null
	rsync -a --delete irccd-${VERSION}/build/doc/doxygen/html/ doxygen

www: ${SITE_HTML} man doxygen
	rm -rf $@
	mkdir -p $@
	cp -R css $@
	cp -R doxygen $@/api
	cp ${MAN1HTML} ${MAN5HTML} ${MAN7HTML} $@
	cp ${MAN1PDF} ${MAN5PDF} ${MAN7PDF} $@
	cp ${SITE_HTML} $@

clean:
	rm -f ${MAN1HTML} ${MAN5HTML} ${MAN7HTML}
	rm -f ${MAN1PDF} ${MAN5PDF} ${MAN7PDF}
	rm -f ${SITE_HTML}
	rm -f ${SOURCE}
	rm -rf doxygen
	rm -rf ${WRKDIR}

.PHONY: all clean man

mercurial