# Last edited on 2012-07-01 02:19:33 by stolfilocal

# To be included by campus makes
# Client must define 
#   ${P}    Filename prefix (eg "unicamp-12")
#   ${NX}   Map width (pixels)
#   ${NY}   Map height (pixels)

# Raw satellite images:
RAW_IMAGES := ${wildcard ${P}-raw-*.png}
  
# Maps created by hand:
HAND_MAPS := \
  ${P}-apas.png \
  ${P}-water.png \
  ${P}-boroughs.png \
  ${P}-companies.png \
  ${P}-unicampbld.png \

# Simple handmade images used in compositing:
LEG_PATCHES := ${wildcard ../generic/legpatch-*.png}
BASIC_IMAGES := \
  ${LEG_PATCHES}

# Intermediate images:
AUXILIARY := \
  ${P}-transp.png \
  ${P}-bground.png \
  ${P}-quadrets.png \
  ${P}-legbg-black.png \
  ${P}-legbg-white.png \
  ${P}-mymap.png \
  ${P}-borquad.png \
  ${P}-hatching.png \
  ${P}-apahatch.png

# Main final images:
TARGETS := \
  ${P}-crop.png \
  ${P}-mark.png \
  ${P}-legend-black.png \
  ${P}-legend-white.png

# Defined with "=" rather than ":=" so that client can redefine ${TARGETS} ${AUXILIARY}
DERIVED = ${TARGETS} ${AUXILIARY}

all: ${DERIVED}

${P}-mark.png: define-points.sh make-mark.sh ${P}-mymap.png  
	make-mark.sh 
	gimp ${P}-mark.png
        
${P}-mymap.png: make-mymap.sh \
                ${P}-bground.png ${P}-apahatch.png ${P}-borquad.png \
                ${P}-companies.png ${P}-unicampbld.png \
                ${P}-water.png
	make-mymap.sh
	gimp ${P}-mymap.png

${P}-borquad.png: make-borquad.sh ${P}-boroughs.png ${P}-quadrets.png
	make-borquad.sh
	gimp ${P}-borquad.png
        
${P}-apahatch.png: make-apahatch.sh ${P}-apas.png ${P}-hatching.png
	make-apahatch.sh
	gimp ${P}-apahatch.png
        
${P}-legend-black.png: make-legend.sh ${P}-legbg-black.png ${LEG_PATCHES}
	make-legend.sh black white
	gimp ${P}-legend-black.png

${P}-legend-white.png: make-legend.sh ${P}-legbg-white.png ${LEG_PATCHES}
	make-legend.sh white black
	gimp ${P}-legend-white.png

${P}-crop.png: stitch-maps.sh ${RAW_IMAGES}
	stitch-maps.sh
	gimp ${P}-crop.png

# Auxiliary images:

${P}-transp.png:
	convert -size "${NX}x${NY}" -depth 8 "XC:#FFFFFF00" ${P}-transp.png 
	gimp ${P}-transp.png

${P}-bground.png:
	convert -size "${NX}x${NY}" -depth 8 "XC:#092910FF" ${P}-bground.png 
	gimp ${P}-bground.png

${P}-legbg-black.png:
	convert -size "${NX}x${NY}" -depth 8 "XC:#353535FF" ${P}-legbg-black.png 
	gimp ${P}-legbg-black.png

${P}-legbg-white.png:
	convert -size "${NX}x${NY}" -depth 8 "XC:#FFFFFFFF" ${P}-legbg-white.png 
	gimp ${P}-legbg-white.png 

${P}-hatching.png: ../tools/make-hatching.sh ../tools/make-hatch-cmds.gawk 
	../tools/make-hatching.sh ${NX} ${NY} >  ${P}-hatching.png 
	gimp ${P}-hatching.png
 
${P}-quadrets.png: ../tools/make-quadrets.sh
	../tools/make-quadrets.sh ${NX} ${NY} >  ${P}-quadrets.png 
	gimp ${P}-quadrets.png

clean:  
	rm -f -v ${DERIVED}

ship:
	rsync -avu ${TARGETS} stolfi@manaus.ic.unicamp.br:public_html/temp/
