blob: 829d389f80077ef5ade17643d60141eaf5c09b83 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
|
#!/usr/bin/env perl
use strict;
use warnings;
open my $fh, ">", "deps.mk";
print $fh "# This file is generated by makedeps.\n";
while (my $f = glob("c/*.cpp")) {
open my $gh, "<", $f;
$f =~ s,^c/,,;
$f =~ s/\.cpp$//;
if ($f eq "main") {
print $fh "b/\$(EXE):";
} else {
print $fh "b/$f.obj:";
}
while ($_ = <$gh>) {
next if /^$/;
goto n if not /#/;
print $fh " c/$1" if /^#include\s*"([^"]+)"/;
}
n:
print $fh "\n";
}
|