#!/usr/bin/perl # This file is part of the nesC compiler. # Copyright (C) 2002 Intel Corporation # # The attached "nesC" software is provided to you under the terms and # conditions of the GNU General Public License Version 2 as published by the # Free Software Foundation. # # nesC is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # # You should have received a copy of the GNU General Public License # along with nesC; see the file COPYING. If not, write to # the Free Software Foundation, 59 Temple Place - Suite 330, # Boston, MA 02111-1307, USA. 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]; if (/^-_ASM$/) { # magic marker for assembler options $for_assembler = 1; } elsif ($for_assembler) { push @gcc_args, "-Wa,$_"; } elsif (/^-/) { if (/^-fsyntax-only$/) { $nocompile = 1; } if (/^-[_WwvpfmH]/ || /^-pedantic$/ || /^-ansi$/) { push @nesc_args, $_; $verbose = 1 if /^-v/; } if (/^-([IDUA])/) { $opt = $1; ($i, $val) = &extractarg($i); push @nesc_args, "-$opt$val"; } elsif (/^-o/) { ($i, $objtarget) = &extractarg($i); } elsif (/^--param$/) { ($i, $param) = &nextarg($i); push @gcc_args, "--param"; push @gcc_args, $param; } elsif (/^-include$/) { ($i, $file) = &nextarg($i); push @nesc_args, "-include", $file; } elsif (/^-S$/) { $asmonly = 1; } elsif (/^-fnesc-tmpcfile=(.*)$/) { if ($ctarget eq "") { $ctarget = $1; $delcfile = 1; } } else { push @gcc_args, $_; } } else { if ($source ne "") { printf STDERR "two source files specified ($source and $_)\n"; exit 2; } $source = $_; } } # Split on spaces not preceded by \, then unquote. push @nesc_args, split(/(?&1|"); while () { return 1 if /^gcc version 4\.0/; } return 0; }