mirror of
https://github.com/nasa/trick.git
synced 2024-12-19 05:07:54 +00:00
Merge pull request #740 from pappyvw/trick-CP-dashC-option
Give trick-CP the same -C/--directory option that 'make' has.
This commit is contained in:
commit
7ef86c92c0
26
bin/trick-CP
26
bin/trick-CP
@ -15,10 +15,19 @@ $trick_home = dirname($trick_bin) ;
|
|||||||
#### Handle arguments ####
|
#### Handle arguments ####
|
||||||
$numArgs = $#ARGV + 1;
|
$numArgs = $#ARGV + 1;
|
||||||
$makefileAddArgs = ' ';
|
$makefileAddArgs = ' ';
|
||||||
|
$sdefine_dir = ".";
|
||||||
|
$sdefine = "S_define";
|
||||||
|
$makefile = "makefile";
|
||||||
foreach $argnum (0 .. $#ARGV) {
|
foreach $argnum (0 .. $#ARGV) {
|
||||||
$arg = $ARGV[$argnum];
|
$arg = $ARGV[$argnum];
|
||||||
if ($arg =~ /(\w+)=(\w+)/ ) {
|
if ($arg =~ /(\w+)=(\w+)/ ) {
|
||||||
$makefileAddArgs = $makefileAddArgs . $1 . "=" . $2 . " ";
|
$makefileAddArgs = $makefileAddArgs . $1 . "=" . $2 . " ";
|
||||||
|
} elsif ($arg eq "-C" || $arg eq "--directory" ) {
|
||||||
|
$sdefine_dir = abs_path($ARGV[$argnum + 1]);
|
||||||
|
$makefileAddArgs = $makefileAddArgs . " -C $sdefine_dir ";
|
||||||
|
$sdefine = $sdefine_dir . "/${sdefine}";
|
||||||
|
$makefile = $sdefine_dir . "/${makefile}";
|
||||||
|
shift
|
||||||
} elsif ($arg =~ /-d/ ) {
|
} elsif ($arg =~ /-d/ ) {
|
||||||
$makefileAddArgs = $makefileAddArgs . " debug ";
|
$makefileAddArgs = $makefileAddArgs . " debug ";
|
||||||
} elsif ($arg =~ /-t/ ) {
|
} elsif ($arg =~ /-t/ ) {
|
||||||
@ -30,17 +39,17 @@ foreach $argnum (0 .. $#ARGV) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( -f "S_define" ) {
|
if ( -f $sdefine ) {
|
||||||
if ( not -w "." ) {
|
if ( not -w $sdefine_dir ) {
|
||||||
print getcwd() , " is not writable\n" ;
|
print $sdefine_dir , " is not writable\n" ;
|
||||||
print "CP aborted\n" ;
|
print "trick-CP aborted\n" ;
|
||||||
exit 1 ;
|
exit 1 ;
|
||||||
}
|
}
|
||||||
unlink "build/Makefile_sim", "makefile" ;
|
unlink "build/Makefile_sim", $makefile ;
|
||||||
$makefile_text = do { local $/; <main::DATA> } ;
|
$makefile_text = do { local $/; <main::DATA> } ;
|
||||||
$makefile_text =~ s/SUB_TRICK_HOME/$trick_home/ ;
|
$makefile_text =~ s/SUB_TRICK_HOME/$trick_home/ ;
|
||||||
$makefile_text =~ s/SUB_TRICK_BIN/$trick_bin/ ;
|
$makefile_text =~ s/SUB_TRICK_BIN/$trick_bin/ ;
|
||||||
open MAKEFILE, ">makefile" ;
|
open MAKEFILE, ">$makefile" ;
|
||||||
print MAKEFILE $makefile_text ;
|
print MAKEFILE $makefile_text ;
|
||||||
close MAKEFILE ;
|
close MAKEFILE ;
|
||||||
system("make -f makefile " . $makefileAddArgs) ;
|
system("make -f makefile " . $makefileAddArgs) ;
|
||||||
@ -90,6 +99,11 @@ Print the trick-CP help message (this message)
|
|||||||
|
|
||||||
Send CP output to FILE_NAME
|
Send CP output to FILE_NAME
|
||||||
|
|
||||||
|
=item B<-C> | B<--directory> I<SIM_DIRECTORY_NAME>
|
||||||
|
|
||||||
|
Build a simulation located in a different directory than the current
|
||||||
|
working directory.
|
||||||
|
|
||||||
=item B<-p> | B<--no-python>
|
=item B<-p> | B<--no-python>
|
||||||
|
|
||||||
Exclude python input processor from simulation.
|
Exclude python input processor from simulation.
|
||||||
|
Loading…
Reference in New Issue
Block a user