aboutsummaryrefslogtreecommitdiff
path: root/makedeps.pl
blob: 8956e8127c9704c9d5439b2b8957e4981381ba17 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
#!/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$//;
	print $fh "b/$f.obj: c/$f.cpp";
	while ($_ = <$gh>) {
		next if /^$/;
		goto n if not /#/;
		print $fh " c/$1" if /^#include\s+"([^"]+)"/;
	}
      n:
	print $fh "\n";
}