]> oss.titaniummirror.com Git - tinyos-2.x.git/blobdiff - tools/tinyos/ncc/ncc.in
Support %F substitution for @includes
[tinyos-2.x.git] / tools / tinyos / ncc / ncc.in
index df2ffb16763453c43bf8f244cd2068db3ee4027d..b1fee5cec0c51ee8ec6bafcf3759295c7d93471c 100644 (file)
@@ -82,10 +82,6 @@ for ($i = 0; $i <= $#ARGV; $i++) {
            $strip = 1;
            push @includes, $file;
        }
-        elsif (/^-safe$/) {
-            $safe = 1;
-            $_ = "-fnesc-safe";
-        }
        elsif (/^-fnesc-cfile=(.*)/){
            $appfilename=$1;
        }
@@ -139,34 +135,6 @@ if (!defined $target) {
     }
 }
 
-if ($safe) {
-
-    my $safe_home = $ENV{'TOSDIR'}."/lib/safe";
-
-    if (($target eq "mica2") or ($target eq "micaz")) {
-       $mcu = "avr";
-    } elsif ($target eq "telosb") {
-       $mcu = "msp430";
-    } else {
-       print STDERR "Safe TinyOS does not (yet) support the ${target} target.\n";
-       print STDERR "Supported targets: ";
-       print STDERR "mica2, micaz, telosb\n";
-       exit 2;
-    }
-
-    push @new_args, "-fnesc-deputy";
-
-    $failfile = "${TOSDIR}/lib/safe/${mcu}/fail.c";
-
-    my $deputy_args = "-I${safe_home}/include " .
-                      "--FLIDs " . 
-                      "--envmachine " .
-                      "-DSAFE_TINYOS " .
-                      "--nolib";
-    push @new_args, "-fnesc-deputy-args=$deputy_args";
-    push @new_args, "$failfile";
-}
-
 if (!defined $scheduler && !$is_tos_1) {
        $scheduler = "TinySchedulerC,TinySchedulerC.TaskBasic,TaskBasic,TaskBasic,runTask,postTask";
 }
@@ -180,6 +148,15 @@ if ($print_target) {
 foreach $dir (@includes) {
     if ($dir =~ m!/$target/?$! && -f "$dir/.platform") {
        $platform_def = "$dir/.platform";
+       # Check to see if the platform is a member of a family
+       if (-f "$dir/.family") {
+           $family_def = "$dir/.family";
+       }
+       else {
+           if (-f "$dir/../.family") {
+               $family_def = "$dir/../.family";
+           }
+       }
        last;
     }
 }
@@ -256,7 +233,11 @@ $platform_dir = $platform_def;
 $platform_dir =~ s!/\.platform$!!;
 push @includes, $platform_dir unless $nostdinc;
 do $platform_def;
-do $family_def if -f $family_def;
+if (-f $family_def) {
+    $family_dir = $family_def;
+    $family_dir =~ s!/\.family$!!;
+    do $family_def
+}
 unshift @new_args, "-DPLATFORM_\U$target";
 
 push @new_args, @opts;
@@ -323,6 +304,7 @@ sub idir_subst {
        $rep = $TOSDIR if $char eq "T";
        $rep = $target if $char eq "p";
        $rep = $platform_dir if $char eq "P";
+       $rep = $family_dir if $char eq "F";
        &fail("unknown include-path substitution %" . $char) if !$rep;
        substr($idir, $idx, 2) = $rep;
        $idx += length $rep;