Team Fortress 2 Source Code as on 22/4/2020
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

69 lines
1.7 KiB

  1. @setlocal enableextensions & "%2\..\game\sdktools\Perl\bin\perl.exe" -x "%~f0" %* & goto :EOF
  2. #!/usr/bin/perl
  3. my $swigFile = $ARGV[ 0 ];
  4. my $srcDir = $ARGV[ 1 ];
  5. my $pyVer = $ARGV[ 2 ];
  6. my $swig = $srcDir . "\\devtools\\swigwin-1.3.34\\swig.exe";
  7. $dirtyFile = $swigFile . ".dep";
  8. if ( ! -f $dirtyFile )
  9. {
  10. open DIRTY, ">${dirtyFile}";
  11. print DIRTY <<"EOF";
  12. //
  13. // This file is simply here to be a build dependency for ${swigFile}.i
  14. // The modification time of this file will be the newest modification time
  15. // of all of the dependencies of ${baseFile}.i as generated by
  16. //
  17. // ${swig} \\
  18. // -Fmicrosoft -ignoremissing -c++ -I${srcDir}\\public -python -M ${swigFile}.i
  19. //
  20. // If this file doesn't exist, it is created by the pre-build step
  21. //
  22. EOF
  23. ( $dev,$ino,$mode,$nlink,$uid,$gid,$rdev,$size,$atime,$mtime,$ctime,$blksize,$blocks ) = stat( $dirtyFile );
  24. print( "[swig_depend] Setting ${dirtyFile} Modification Time To: " . localtime( $atime ) . "\n" );
  25. exit( 0 );
  26. }
  27. if ( ! -f $dirtyFile )
  28. {
  29. die( "Can't Find ${dirtyFile}\n" );
  30. }
  31. ( $dev,$ino,$mode,$nlink,$uid,$gid,$rdev,$size,$atime,$mtime,$ctime,$blksize,$blocks ) = stat( $dirtyFile );
  32. my $dirtyTime = $mtime;
  33. my $maxTime = $mtime;
  34. open SWIG, "$swig -Fmicrosoft -ignoremissing -c++ -Iswig_python${pyVer} -I${srcDir}\\public -python -M ${swigFile}.i |" || die( "Couldn't Run Swig\n" );
  35. while ( <SWIG> )
  36. {
  37. chomp;
  38. s/^\s+//;
  39. s/\s+\\\s*$//;
  40. ( $dev,$ino,$mode,$nlink,$uid,$gid,$rdev,$size,$atime,$mtime,$ctime,$blksize,$blocks ) = stat( $_ );
  41. if ( $mtime > $maxTime )
  42. {
  43. $maxTime = $mtime;
  44. }
  45. }
  46. close SWIG;
  47. if ( $maxTime > $dirtyTime )
  48. {
  49. print( "[swig_depend] Setting ${dirtyFile} Modification Time To: " . localtime( $atime ) . "\n" );
  50. utime $maxTime, $maxTime, $dirtyFile;
  51. }
  52. exit( 0 );