X-Git-Url: https://oss.titaniummirror.com/gitweb/?p=nesc.git;a=blobdiff_plain;f=src%2Fnesc-compile;h=cdda7760ab1fa42ccdf3e92fa3b1ee9cd0374380;hp=cdcfe1234590c5ddb98ce0aed118e46ea4c62280;hb=627b462e8421954b5102d839ff203adb3400a8cc;hpb=7b54393e237ed8f23c0c74f0a6cbc8de26c5bf98 diff --git a/src/nesc-compile b/src/nesc-compile index cdcfe12..cdda776 100755 --- a/src/nesc-compile +++ b/src/nesc-compile @@ -18,6 +18,15 @@ use File::Basename; +# Extract information from enviroment variables set by nescc +$ctarget = $ENV{NESCC_CFILE}; +$conly = $ENV{NESCC_CONLY} eq "yes"; +$deputy = $ENV{NESCC_DEPUTY} eq "yes"; +@deputy_args = split(" ", $ENV{NESCC_DEPUTY_ARGS}); +$gcc = $ENV{NESCC_GCC}; + +push @nesc_args, "-fnesc-gcc=$gcc"; + for ($i = 0; $i <= $#ARGV; $i++) { $_ = $ARGV[$i]; @@ -33,18 +42,15 @@ for ($i = 0; $i <= $#ARGV; $i++) { $nocompile = 1; } - if (/^-_?fnesc-conly$/) { - $conly = 1; - } - - if (/^-[_WwvpfmD]/ || /^-pedantic$/ || /^-ansi$/) { - push @nesc_args, $_ unless /^-_?fnesc-.*cfile=/; + if (/^-[_WwvpfmH]/ || /^-pedantic$/ || /^-ansi$/) { + push @nesc_args, $_; $verbose = 1 if /^-v/; } - if (/^-I/) { - ($i, $idir) = &extractarg($i); - push @nesc_args, "-I$idir"; + if (/^-([IDUA])/) { + $opt = $1; + ($i, $val) = &extractarg($i); + push @nesc_args, "-$opt$val"; } elsif (/^-o/) { ($i, $objtarget) = &extractarg($i); @@ -61,28 +67,14 @@ for ($i = 0; $i <= $#ARGV; $i++) { elsif (/^-S$/) { $asmonly = 1; } - elsif (/^-_?fnesc-/) { - if (/^-_?fnesc-cfile=(.*)$/) { - $ctarget = $1; - } - if (/^-_?fnesc-tmpcfile=(.*)$/) { - $ctarget = $1; - $delcfile = 1; - } - if (/^-_?fnesc-gcc=(.*)$/) { - $gcc = $1; - } - if (/^-_?fnesc-deputy$/) { - $deputy = 1; - } - if (/^-_?fnesc-deputy-args=(.*)$/) { - @deputy_args = split(" ", $1); - } + elsif (/^-fnesc-tmpcfile=(.*)$/) { + if ($ctarget eq "") { + $ctarget = $1; + $delcfile = 1; + } } - elsif (!(/^-D/)) { - if (!(/^-_?W(no-)?nesc/)) { - push @gcc_args, $_; - } + else { + push @gcc_args, $_; } } else { @@ -94,6 +86,12 @@ for ($i = 0; $i <= $#ARGV; $i++) { } } +# Split on spaces not preceded by \, then unquote. +push @nesc_args, split(/(?