shithub: pointless

ref: ef6f0d84ca2feebdb3a49863fa9b87ac1bb0f1e1
dir: /generate/

View raw version
#!/bin/rc -e

rfork en

fn usage {
	aux/usage
	exit usage
}

args='dir'
flagfmt='o:outdir outdir'

if(! eval `{aux/getflags $*})
	usage

if(~ $#outdir 0)
	outdir=`{pwd}^/out

if(! ~ $#* 1)
	usage

mkdir -p $outdir
dircp $1 $outdir

@ {
	cd $outdir
	pointlessroot=`{pwd}
}

for(index in `{walk $outdir | grep 'index\.rc$'}) @{
	cd `{basename -d $index}
	. index.rc
	rm index.rc
}

for(ptless in `{walk $outdir | grep '\.ptless$'}) @{
	cd `{basename -d $ptless}
	ptless=`{basename $ptless}
	pointless/pointless.awk $ptless >`{echo $ptless | sed 's@\[email protected]@'}
	rm $ptless
}

for(epilogue in `{walk $outdir | grep 'epilogue\.rc$'}) @{
	cd `{basename -d $epilogue}
	. epilogue.rc
	rm epilogue.rc
}