#
#	Riverworld Blitz mpeg makefile.  Assumes the netpbm and mpeg_encode
#	programs are somewhere in the path.  Assumes several files already
#	exist.  The * is the update number.
#
#	map-*.gif	Country numbers
#	fallmap-*.gif	Fallout (shows where the nukes hit)
#	overmap-*.gif	Country names overlay
#	frames		Number of frames mapped (updates)
#
#		-Drake (dld@chem.psu.edu)


.SUFFIXES: .pgm .gif .ppm


.gif.ppm: over.pbm over.mask color.ppm
	giftopnm $< | pgmtoppm -map color.ppm | pnmscale 4 | pnmcomp -invert -alpha over.mask over.pbm >$@

all: map.mpg final.gif


over.gif: over.pbm
	pnminvert over.pbm | ppmtogif >over.gif

map.param: param.pl default.param frames
	param.pl default.param >map.param

over.pbm: version report census over.awk
	over.awk scale=4 version report census

over.mask: over.pbm
	pbmmask -expand over.pbm >over.mask

color.ppm: randppm.awk
	randppm.awk >$@

map.mpg: map.param color.ppm over.pbm over.mask
	mpeg_encode map.param

final.gif: frames color.ppm over.mask over.pbm
	giftopnm fallmap-`cat frames`.gif | pnmgamma 2 | pnmscale 2 | pnmsmooth | pnmscale 2 | pnmsmooth | pnmdepth 255 >fall.ppm 
	giftopnm map-`cat frames`.gif | pgmtoppm -map color.ppm | pnmscale 4 | pnmarith -add fall.ppm - | pnmdepth 255 | pnmcomp -invert -alpha over.mask over.pbm | ppmquant 256 | ppmtogif -interlace >final.gif



