dependencyClosure { ... searchPath = [ ../foo ../bar ]; ... }
* Primop `dirOf' to return the directory part of a path (e.g., dirOf
  /a/b/c == /a/b).
* Primop `relativise' (according to Webster that's a real word!) that
  given paths A and B returns a string representing path B relative
  path to A; e.g., relativise /a/b/c a/b/x/y => "../x/y".
		
	
			
		
			
				
	
	
		
			21 lines
		
	
	
	
		
			340 B
		
	
	
	
		
			Perl
		
	
	
	
	
	
			
		
		
	
	
			21 lines
		
	
	
	
		
			340 B
		
	
	
	
		
			Perl
		
	
	
	
	
	
| use strict;
 | |
| 
 | |
| my $root = $ENV{"main"};
 | |
| my $out = $ENV{"out"};
 | |
| 
 | |
| open OUT, ">$out" or die "$!";
 | |
| print OUT "[\n";
 | |
| 
 | |
| open IN, "<$root" or die "$!";
 | |
| while (<IN>) {
 | |
|     if (/^\#include\s+\"(.*)\"/) {
 | |
|         print OUT "\"$1\"\n";
 | |
|     }
 | |
|     if (/^\#include\s+\<(.*)\>/) {
 | |
|         print OUT "\"$1\"\n";
 | |
|     }
 | |
| }
 | |
| close IN;
 | |
| 
 | |
| print OUT "]\n";
 | |
| close OUT;
 |