# Last edited on 2023-12-31 10:53:09 by stolfi # Makefile for solar energy labs # To be included in a Makefile # The Makefile must define ${WIDTH} ${HEIGHT} ${ICONWIDTH} ${ICONHEIGHT} SHELL := /bin/bash OTHERINPUTS := ${wildcard *.inc} # Automatic "make showXXX" after "make XXX": SHOW := YES # Show POV-Ray progress: POVSHOW := YES ROOTNAME = main POVFILE := ${ROOTNAME}.pov # POV-Ray installation directories: POVRAY := /usr/bin/povray POVINC := /usr/share/povray-3.7/include/ TOPDIR := ../../.. POVTTF := tt-fonts POVFILTER := mc937_povray_error_filter.gawk # POVFILTER := cat # Note: defined with "=" rather than ":=" DIRTAIL = ${shell pwd | sed -e 's:^.*/::'} IMVIEW = display -title "${DIRTAIL}/%f" .PHONY: \ vista showvista \ plot showstrip showplot \ runpov do-runpov print-help: @-echo "Voce deve executar 'make '" @-echo "" @-echo " 'make vista' Mostra vista geral da cena de Ă¢ngulo genĂ©rico." @-echo " 'make showvista' Mostra a imagem da vista geral." @-echo " 'make plot' Gera plot da energia solar e tira com as imagens solares." @-echo " 'make showplot' Mostra o plot." @-echo " 'make showstrip' Mostra a tira tira com as imagens solares." @-echo "" @-echo " 'make clean' Remove imagens geradas." # ---------------------------------------------------------------------- # Generic showXXX - caller must define ${PNGFILE}: ifneq "/${PNGFILE}" "/" showimage: @if [[ -s ${PNGFILE} ]]; then \ ${IMVIEW} ${PNGFILE} ; \ else \ echo "** file ${PNGFILE} not found" 1>&2 ; exit 1 ; \ fi endif # ---------------------------------------------------------------------- VISPNG := ${ROOTNAME}-v.png STRIPPNG := ${ROOTNAME}-s.png PLOTPNG := ${ROOTNAME}-e.png vista: ${VISPNG} @if [[ "/${SHOW}" == "/YES" ]]; then make showvista; fi ${VISPNG}: ${ROOTNAME.pov} calcula_energia.sh plota_energia.sh calcula_energia.sh NO ${SHOW} YES showvista: ${MAKE} PNGFILE=${VISPNG} showimage plot: ${ROOTNAME}-e.png @if [[ "/${SHOW}" == "/YES" ]]; then make showplot; fi strip: ${ROOTNAME}-s.png @if [[ "/${SHOW}" == "/YES" ]]; then make showstrip; fi ${ROOTNAME}-e.png ${ROOTNAME}-s.png: ${ROOTNAME.pov} calcula_energia.sh plota_energia.sh calcula_energia.sh YES ${SHOW} NO showstrip: ${MAKE} PNGFILE=${STRIPPNG} showimage showplot: ${MAKE} PNGFILE=${PLOTPNG} showimage GENPNG := ${ROOTNAME}.png runpov: do-runpov -@echo "did runpov ${WIDTH} ${HEIGHT} ${POVSHOW}" -@ls ${GENPNG} ###################################################################### # Running POV-Ray # Caller must define ${WIDTH} ${HEIGHT} ${POVSHOW} # ifneq "/${WIDTH}" "/" ifneq "/${HEIGHT}" "/" ifneq "/${POVSHOW}" "/" do-runpov: ${GENPNG} -@echo "did do-runpov" ifeq "/${POVSHOW}" "/YES" POVSHOWOP := +D else POVSHOWOP := -D endif ${GENPNG}: ${POVFILE} ${OTHERINPUTS} -/bin/rm -f ${GENPNG} nice ${POVRAY} \ +FN +Q9 \ +W${WIDTH} +H${HEIGHT} \ ${POVSHOWOP} \ +AM1 +A0.0 +R${NRAYS} \ +L${POVINC} \ +L${POVTTF} \ +I${POVFILE} \ +O${GENPNG} \ 2>&1 \ | ${POVFILTER} endif endif endif