From d00f8b35b4838ba7c6bf00b7b211f463810f4ae5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?John=20Ankarstr=C3=B6m?= Date: Fri, 15 Jul 2022 16:57:15 +0200 Subject: Improve makedeps script. --- makedeps | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) create mode 100644 makedeps (limited to 'makedeps') 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"; +} -- cgit v1.2.3