shithub: pointless

ref: 462fbf10a2e06272c1ab95e97c9ee8b818f83cf6
dir: /generate/

View raw version
#!/bin/rc

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
}