aboutsummaryrefslogtreecommitdiff
path: root/makedeps.pl
diff options
context:
space:
mode:
Diffstat (limited to 'makedeps.pl')
-rw-r--r--makedeps.pl20
1 files changed, 20 insertions, 0 deletions
diff --git a/makedeps.pl b/makedeps.pl
new file mode 100644
index 0000000..8956e81
--- /dev/null
+++ b/makedeps.pl
@@ -0,0 +1,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";
+}