]> git.saurik.com Git - apple/libc.git/blobdiff - xcodescripts/generate_features.pl
Libc-1439.100.3.tar.gz
[apple/libc.git] / xcodescripts / generate_features.pl
index e2da8f95c45adeb9658b11a3ed6eb506b418344a..e1bf9c620a08a817c572aceeedd6e882ccb66903 100755 (executable)
@@ -23,11 +23,15 @@ for my $arch (split(/ /, $ENV{"ARCHS"}))
        my $platformName = $ENV{"VARIANT_PLATFORM_NAME"};
        $platformName =~ s/simulator/os/;
 
+       # Try to find a platform+arch config file. If not found, try just
+       # a platform config file.
+       my $platformArchPath = $ENV{"SRCROOT"} . "/Platforms/" . $platformName . "/Makefile." . $arch . ".inc";
        my $platformPath = $ENV{"SRCROOT"} . "/Platforms/" . $platformName . "/Makefile.inc";
+
        my $featuresHeaderDir = $ENV{"DERIVED_FILES_DIR"}."/".$arch;
        my $featuresHeader = $featuresHeaderDir."/libc-features.h";
 
-       open FEATURESFILE, "<$platformPath" or die "Unable to open: $platformPath";
+       open FEATURESFILE, "<$platformArchPath" or open FEATURESFILE, "<$platformPath" or die "Unable to open: $platformArchPath nor $platformPath";
 
        my %features = ();
        my $skip = 0;
@@ -94,7 +98,11 @@ for my $arch (split(/ /, $ENV{"ARCHS"}))
        
        elsif ($unifdef == 0) {
                # If we touch this file on every build, then every other iterative build in Xcode will rebuild *everything*
-               my $platform_mtime = (stat($platformPath))[9];
+               my $platform_mtime = (stat($platformArchPath))[9];
+               if (!defined($platform_mtime)) {
+                       # try the other one
+                       $platform_mtime = (stat($platformPath))[9];
+               }
                my $header_mtime = (stat($featuresHeader))[9];
 
                if (defined($header_mtime) && defined($platform_mtime) && ($header_mtime > $platform_mtime)) {