CP needs more verbose checking of makefile generation

CP now tests if the current directory is writable before
trying to create a makefile and compile the sim.

Fixes #26.
This commit is contained in:
Alex Lin 2015-03-23 17:06:41 -05:00
parent 306dee18a3
commit 48a09d386e

6
bin/CP
View File

@ -4,12 +4,18 @@
# so I converted CP back to perl. :)
use File::Basename ;
use Cwd ;
use Cwd 'abs_path';
$trick_bin = dirname(abs_path($0)) ;
$trick_home = dirname($trick_bin) ;
if ( -f "S_define" ) {
if ( not -w "." ) {
print getcwd() , " is not writable\n" ;
print "CP aborted\n" ;
exit 1 ;
}
unlink "Makefile_sim", "makefile" ;
$makefile_text = do { local $/; <main::DATA> } ;
$makefile_text =~ s/SUB_TRICK_HOME/$trick_home/ ;