aboutsummaryrefslogtreecommitdiff
path: root/makedeps
blob: 4cfa1ac95e2daefd9624d070735c923288b6088f (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.pl.\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";
}