# Last edited on 2024-09-20 16:50:40 by stolfi SHELL := /bin/bash .PHONY: \ choose-runs choose-objs \ make-all-models show-all-models make-all-images \ make-nnn-models show-nnn-models make-nnn-images PROG := slicing_keg_example # all: make-all-models show-all-models # all: make-all-models make-all-images # all: make-all-models # all: make-all-images all: choose-runs choose-objs TAG := keg # Should {make-nnn-images} display each image and wait? SHOW := NO RUNS_FILE := out/choose_runs_kuk.txt OBJS_FILE := out/choose_objs_kuk.txt make-all-models: ${OBJS_FILE} objs=( `cat ${OBJS_FILE} | sed -e 's/[ ]*$//g' -e 's/^[ ]*//g' -e 's/[ ][ ]*/:/g'` ) ; \ for obj in $${objs[@]} ; do \ pps=( `echo $${obj} | tr ':' ' '` ); \ Ns=$${pps[0]}; Nr=$${pps[1]}; Nb=$${pps[2]}; \ ${MAKE} NS=$${Ns} NR=$${Nr} NB=$${Nb} make-nnn-models ; \ done make-all-images: ${MAKE} NS=10 NR=6 NB=2 make-nnn-models make-nnn-images choose-runs: ${RUNS_FILE} choose-objs: ${OBJS_FILE} ${RUNS_FILE}: slicing_keg_choose_runs.py slicing_keg_choose_runs.py ${OBJS_FILE}: ${RUNS_FILE} cat ${RUNS_FILE} \ | gawk '/^ *[0-9]/{ printf "%5d %5d %5d\n", $$2, $$3, $$4 }' \ | sort -b -k1,3n \ | uniq \ > ${OBJS_FILE} echo "objects to build:" ; cat ${OBJS_FILE} ######################################################################## # Section for one ${NR},${NS},${NB} combination: ifneq "/${NS}" "/" ifneq "/${NR}" "/" ifneq "/${NB}" "/" NS5 := ${shell printf "%05d" ${NS}} NR5 := ${shell printf "%05d" ${NR}} NB5 := ${shell printf "%05d" ${NB}} OUT_PREF := out/${TAG}_ns${NS5}_nr${NR5}_nb${NB5} make-nnn-models: ${PROG}.py ${wildcard *.py} mkdir -p out rm -fv ${OUT_PREF}_*.{obj,inc,pgm,tgz} ${PROG}.py ${TAG} ${NS} ${NR} ${NB} || ( rm -fv ${OUT_PREF}_*.{obj,inc,pgm} ; exit 1 ) tar -cvzf ${OUT_PREF}.tgz ${OUT_PREF}_*.obj show-nnn-models: for subd in orig ; do \ ofile="${OUT_PREF}_$${subd}.obj" ; \ if [[ -s $${ofile} ]]; then \ ls -l $${ofile} ; \ f3d -n $${ofile} ; \ fi ; \ done make-nnn-images: slicing_keg_run_povray.sh for subd in orig triang; do \ ifile="${OUT_PREF}_$${subd}.inc" ; \ if [[ -s $${ifile} ]]; then \ slicing_keg_run_povray.sh ${TAG} ${NS} ${NR} ${NB} $${subd} ${SHOW} ; \ fi ; \ done endif endif endif # End ${NS},${NR} # make-all-models show-all-models make-all-images ########################################################################