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