aboutsummaryrefslogtreecommitdiff
path: root/makedeps
blob: 79c392ee008a129e10447e29926456d7f75f99ad (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";
}