calendar-generator/Makefile
Sebastian Hugentobler d3e3fd02c7 add makefile
2018-08-09 15:00:13 +02:00

32 lines
836 B
Makefile

BUILD_DIR=build
TMP_DIR=.tmp
SRC_DIR=src
CALENDAR_DIR=calendars
CALENDAR_YEARS=$(wildcard ${CALENDAR_DIR}/*)
CALENDARS=$(patsubst %,${BUILD_DIR}/calendar-%.pdf,$(notdir ${CALENDAR_YEARS}))
.PHONY: directories calendars all
.DEFAULT_GOAL := all
directories: ${BUILD_DIR} ${TMP_DIR}
${BUILD_DIR}:
mkdir -p ${BUILD_DIR}
${TMP_DIR}:
mkdir -p ${TMP_DIR}
${BUILD_DIR}/calendar-%.pdf: directories ${CALENDAR_DIR}/%/images/* ${SRC_DIR}/*.tex ${SRC_DIR}/*.sty
cd ${SRC_DIR} && lualatex --jobname="calendar-$*" --output-directory="../${TMP_DIR}" "\def\calyear{$*} \def\caltitle{"$(file < ${CALENDAR_DIR}/$*/title)"} \input{calendar.tex}"
cp "${TMP_DIR}/calendar-$*.pdf" "${BUILD_DIR}/calendar-$*.pdf"
calendars: directories ${CALENDARS}
all: calendars
clean:
rm -rf ${BUILD_DIR}
rm -rf ${TMP_DIR}
%: ${BUILD_DIR}/calendar-%.pdf ;