# Makefile para exercícios ESTÁTICOS de POV-Ray # Auxiliary source files should be named "*.inc". # Image fiels used for textures etc. shoud be named "pic-*.png" or "pic-*.jpg". SHELL := /bin/bash # Test parameters are {WIDTH}+{HEIGHT}+{NRAYS}+{VIEW}+{POVNAME} SINGLE_JOB := \ 640+480+3+1+fig_geom_allene_bond_R \ 640+480+3+0+fig_geom_allene_bond_R \ SPECIAL_JOBS := \ 640+480+2+0+fig_geom_triple_bond \ 640+480+2+0+fig_geom_double_bond_trans \ 640+480+2+0+fig_geom_double_bond_cis \ 640+480+2+0+fig_geom_right_hand_rule \ 640+480+2+0+fig_geom_double_bond_trans \ # Defaults: DEF_SIZE := 200+200 DEF_NRAYS := 2 DEF_VIEW := 0 FIG_POVS := ${wildcard fig*.pov} FIG_JOBS := ${addprefix ${DEF_SIZE}+${DEF_NRAYS}+${DEF_VIEW}+,${subst .pov,,${FIG_POVS}}} # The goal jobjs: # TARGET_JOBS := ${SPECIAL_JOBS} # TARGET_JOBS := ${FIG_JOBS} TARGET_JOBS := ${SINGLE_JOB} all: render-all render-all: -for job in ${TARGET_JOBS} ; do \ ${MAKE} JOB=$$job render-single ; \ done clean-all: -for job in ${TARGET_JOBS} ; do \ ${MAKE} JOB=$$job clean-single ; \ done # Should images be displayed automatically? SHOW := YES # Should filter error messages (0 or 1): FILTER := 1 # Directories where POV-Ray is installed: POVRAY := /usr/bin/povray POVINC := \ +L/usr/share/povray-3.7/include \ +L../tools/ttf\ +L../tools \ +L../wshop_drawer # ---------------------------------------------------------------------- # Full name of POV-ray executable: POVRAY := povray # Command to display resultin image: DISPLAY := display -title '%d/%f' ifneq "/${JOB}" "/" ####################################################################### # For recursive "make" - caller must define ${JOB} # Will cast {NRAYS^2} rays per pixel: JOB_ARGS := ${subst +, ,${JOB}} WIDTH := ${shell printf "%04d" "${word 1,${JOB_ARGS}}"} HEIGHT := ${shell printf "%04d" "${word 2,${JOB_ARGS}}"} NRAYS := ${word 3,${JOB_ARGS}} VIEW := ${word 4,${JOB_ARGS}} NAME := ${word 5,${JOB_ARGS}} OUT_DIR := out/${WIDTH}x${HEIGHT}-${NRAYS} OUT_PREFIX := ${OUT_DIR}/${NAME}_${VIEW} POVFILE := ${NAME}.pov PNGFILE := ${OUT_PREFIX}.png ICON_PNGFILE := ${subst .png,_icon.png,${PNGFILE}} # ---------------------------------------------------------------------- # Rendered static image: # Input files: INC_IMG_FILES := ${wildcard *.inc pic-*.{png,jpg,JPG} } MAKE_FILES := ${wildcard Makefile POVRAY-*.make} SHELL_FILES := ${wildcard *.sh} render-single: ${PNGFILE} @echo "main file = ${NAME}.pov" @echo "aux files = ${INC_IMG_FILES}" @echo "image = ${PNGFILE}" ${PNGFILE}: ${POVFILE} ${INC_IMG_FILES} ../tools mkdir -p ${OUT_DIR} -/bin/rm -f ${PNGFILE} echo "#declare view = ${VIEW};" > parms.inc ${POVRAY} +K0.5000 \ +FN +Q9 \ +W${WIDTH} +H${HEIGHT} \ +AM1 +A0.0 +R${NRAYS} \ +D \ ${POVINC} \ +I${POVFILE} \ +O${PNGFILE} \ 2>&1 | ./povray-output-filter.gawk -v do_filter=${FILTER} if [[ -s ${PNGFILE} ]]; then \ if [[ "/${SHOW}" == "/YES" ]]; then \ ${DISPLAY} ${PNGFILE} ; \ fi ; \ convert ${PNGFILE} -resize 'x48' ${ICON_PNGFILE} ; \ fi clean-single: rm -fv ${PNGFILE} # ---------------------------------------------------------------------- # Icon of overlaid or rendered image: %_icon.png: %.png convert $*.png -resize 'x75' $*_icon.png # End of ${JOB} section ####################################################################### endif