# Last edited on 2008-02-04 12:47:19 by stolfi

EXDIR := $${STOLFIHOME}/bureau/ic-3/palco-2007-05/fig

# DO_FIGS = ${SPEC_FIGS}

DO_FIGS := \
  300:300:fig_910_test_chairs \
  400:350:fig_811_stage_chrs \
  320:240:fig_216_lab_322_stage \
  400:300:fig_220_lab_322_stage_t
  
LATER_FIGS := \
  300:300:fig_910_test_chairs \
  400:350:fig_811_stage_chrs \
  320:240:fig_210_lab_322_stage \
  400:300:fig_220_lab_322_stage_t
  
SPEC_FIGS := \
  800:600:fig_810_stage_solo \
  800:700:fig_811_stage_chrs \
  \
  800:800:fig_820_stage_box_wide_dims \
  800:600:fig_821_stage_box_wide_expl \
  800:800:fig_822_stage_box_wide_fram \
  800:600:fig_823_stage_box_wide_solo \
  \
  800:800:fig_825_stage_box_narr_dims \
  800:600:fig_826_stage_box_narr_expl \
  800:800:fig_827_stage_box_narr_fram \
  800:600:fig_828_stage_box_narr_solo \
  \
  800:800:fig_830_stage_stair_dims \
  800:600:fig_831_stage_stair_expl \
  800:800:fig_832_stage_stair_fram \
  800:600:fig_833_stage_stair_solo \
  \
  400:800:fig_840_stage_rail_dims \
  \
  600:600:fig_850_stage_rail_plug_dims \
  400:600:fig_851_stage_rail_plug_expl \
  400:600:fig_853_stage_rail_plug_solo

TEST_FIGS := \
  600:600:fig_910_test_chairs \
  600:600:fig_930_test_human \
  600:600:fig_960_test_basics \
  600:600:fig_970_test_ctrim

ALL_FIGS := \
  \
  ${TEST_FIGS} \
  \
  ${SPEC_FIGS} \
  \
  640:480:fig_051_stage_1 \
  640:480:fig_053_stage_3 \
  640:480:fig_054_stage_4 \
  640:480:fig_056_stage_6 \
  640:480:fig_061_stage_1_chairs \
  640:480:fig_063_stage_3_chairs \
  640:480:fig_064_stage_4_chairs \
  640:480:fig_066_stage_6_chairs \
  \
  640:480:fig_210_lab_322_stage \
  640:480:fig_211_lab_322_stage \
  640:480:fig_212_lab_322_stage \
  640:480:fig_213_lab_322_stage \
  640:480:fig_214_lab_322_stage \
  640:480:fig_215_lab_322_stage \
  640:480:fig_216_lab_322_stage \
  \
  800:600:fig_220_lab_322_stage_t

DONT_DO_FIGS :=
  
JUNK_FIGS :=

INCLUDES := \
  basics.inc \
  human.inc \
  chair_dimensions.inc \
  chairs.inc \
  whiteboard.inc \
  screen.inc \
  stage_dimensions.inc \
  stage.inc \
  stage_box.inc \
  stage_box_frame.inc \
  stage_box_rail_holes.inc \
  stage_stair.inc \
  stage_stair_frame.inc \
  stage_rail.inc \
  stage_ramp.inc \
  stage_chamfer.inc \
  stage_ctrim.inc \
  stage_textures.inc \
  lab_322.inc \
  lights_lab_322.inc \
  lights_detail.inc \
  lights_camera.inc \
  camera.inc \
  misc_arrows.inc \
  scene_test_basics.inc \
  scene_test_chairs.inc \
  scene_test_ctrim.inc \
  scene_test_stage.inc \
  scene_test_stage_box.inc \
  scene_test_stage_stair.inc \
  scene_test_stage_rail.inc \
  scene_test_stage_rail_plug.inc \
  scene_test_human.inc \
  scene_lab_322.inc

.PHONY: all single cleanup  image showimage export
  
all: 
	for fig in ${DO_FIGS} ; do \
          ${MAKE} FIGARGS=$$fig single showimage ; \
        done

export: ${EXDIR}
	for fig in ${DO_FIGS} ; do \
          ${MAKE} FIGARGS=$$fig export-single ; \
        done
        
        
######################################################################
# Sub-makefile - caller must define ${FIGARGS}

FIGARGS := FIGARGS.IS.UNDEFINED

ifneq "/${FIGARGS}" "/FIGARGS.IS.UNDEFINED"

FIELDS   := ${subst :, ,${FIGARGS}}
WIDTH    := ${word  1,${FIELDS}}
HEIGHT   := ${word  2,${FIELDS}}
FIG      := ${word  3,${FIELDS}}

ICONFIG = ${FIG}-i

POVPUB = $${STOLFIHOME}/pkg/povray-3.50c-1/PUB
POVRAY = ${POVPUB}/i686-Linux-2.2/bin/povray
POVINC = ${POVPUB}/share/povray-3.5/include
POVTTF = $${STOLFIHOME}/PUB/povray/tt-fonts
IMVIEW = display -title '%d/%f'
CONVERT = convert

# single: image showimage
single: image
	@echo "@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@"

cleanup: 
	-/bin/rm -f ${FIG}.png

image: ${FIG}.png

showimage: ${FIG}.png
	-${IMVIEW} ${FIG}.png

NRAYS := 1

${FIG}.png: ${FIG}.pov ${INCLUDES}
	@echo "@@@ ${FIG} @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@"
	-/bin/rm -f ${FIG}.png
	nice ${POVRAY} \
            +FN +Q9 \
            +W${WIDTH} +H${HEIGHT} \
            +AM1 +A0.0 +R${NRAYS} \
            +D +SP32 +EP4 \
            +L${POVINC} \
            +L${POVTTF} \
	    +I${FIG}.pov \
	    +O${FIG}.png


ICONHEIGHT := 100

${ICONFIG}.jpg: ${FIG}.png
	convert ${FIG}.png \
            -quality 99 \
            -resize 'x${ICONHEIGHT}' \
            ${ICONFIG}.jpg
        
export-single: ${FIG}.png ${ICONFIG}.jpg
	cp -av ${FIG}.png ${ICONFIG}.jpg ${EXDIR}


endif
# End ${FIGARGS} sub-makefile.
######################################################################

ALL_PNGS := ${addsuffix .png,${patsubst %:,,${patsubst %:,,${ALL_FIGS}}}}

debug: 
	@echo "${ALL_PNGS}"
