# This file is meant to be included in the Makefile for # each group of compounds. JSLIBDIR := ${STOLFIHOME}/lib SHELL := /bin/bash # The including Makefile must define ${LIBDIR} to be the directory # containing the {mformula_*.py} sources, and ${LIBSOURCES} to be # all pre-requisite files from ${LIBDIR} and ${JSLIBDIR}. It # must also define ${PREFIX} as a string to use as file name prefix. # The calling Makefile must also define a list of ${OPT_LIST} of option combinations # to use. Each option combination is "{NAME}:{VALUE}/{NAME}:{VALUE}/..." # where {NAME} is the command line parameter and {VALUE} is its value. # For example, the option combination "style:B/hydro:1" will be # expanded to the command line arguments "-style B -hydro 1" # and will add the suffix "_styB_hyd1" to the file name. PYTHONPATH := ".:${LIBDIR}:${JSLIBDIR}" .PHONY: \ all-figs \ single-fig single-debug all: all-figs all-figs: cd ${LIBDIR} && ${MAKE} install for f in ${COMPS} ; do \ for opt in ${OPT_LIST}; do \ ${MAKE} SNAME="$$f" OPTS="$$opt" single-fig ; \ done ; \ done ######################################################################### # Recursive section for each ${SNAME},${PREFIX},${OPTS} ifneq "/" "/${SNAME}" ifneq "/" "/${PREFIX}" ifneq "/" "/${OPTS}" INDIR := in MAKEFIG := ${INDIR}/${SNAME}.py # Command line options: CMD_OPTS := ${subst :, ,${addprefix -,${subst /, ,${OPTS}}}} # File name suffix: SUFFIX := ${subst :,,${subst /,_,${OPTS}}} OUTDIR := out OUTFILE = ${OUTDIR}/${PREFIX}_${SNAME}_${SUFFIX}.svg OUTICON = ${OUTDIR}/${PREFIX}_${SNAME}_${SUFFIX}_icon.png OUTCMTS = ${OUTDIR}/${PREFIX}_${SNAME}_${SUFFIX}.comments single-fig: single-debug ${OUTFILE} ${OUTICON} ${OUTCMTS} ${OUTFILE}: ${MAKEFIG} ${LIBSOURCES} Makefile mkdir -p ${OUTDIR} -rm -f ${OUTFILE} export PYTHONPATH=${PYTHONPATH} ; \ ${MAKEFIG} \ ${CMD_OPTS} \ > ${OUTFILE} @if [[ -s ${OUTFILE} ]]; then \ display -title '%f' ${OUTFILE} ; \ else \ echo "${MAKEFIG}:1:** file ${OUTFILE} empty or missing" 1>&2 ; \ rm -f ${OUTFILE} ; exit 1 ; \ \ fi ${OUTICON}: ${OUTFILE} @if [[ -s ${OUTFILE} ]]; then \ convert ${OUTFILE} -resize 'x48' ${OUTICON} ; \ else \ echo "${MAKEFIG}:1:** file ${OUTFILE} empty or missing" 1>&2 ; \ rm -f ${OUTFILE} ; exit 1 ; \ fi ${OUTCMTS}: @echo "Schematic diagram of ${subst _, ,${SNAME}} (options ${CMD_OPTS})" > ${OUTCMTS} single-debug: @echo "${CMD_OPTS} ${OUTFILE}" endif endif endif # End of ${OPTS},${PREFIX},${SNAME} section #########################################################################