#!/bin/csh
pwd
#if ( -f work/.clean_done) then
#	exit
#endif
#if ( -f work/.package_done) then
	if ( `grep -c NO_WRKSUBDIR Makefile`) then
		pwd
		cd work/
		bsdmake clean
		gnumake clean
		cd ../
		rm -rf */work/.configure_done
		rm -rf */work/.build_done
		rm -rf */work/.install_done
		rm -rf */work/.package_done
		touch work/.clean_done
		exit
	endif
	if (!( `grep -c NO_WRKSUBDIR Makefile`)) then
		pwd
		if (!( -d work/* )) then
			rm -rf work
			exit
		endif
		cd work/*
		bsdmake clean
		gnumake clean
		cd ../..
		rm -rf */work/.configure_done
		rm -rf */work/.build_done
		rm -rf */work/.install_done
		rm -rf */work/.package_done
		touch work/.clean_done
		exit
	endif
#endif

