diff --git a/Makefile.am b/Makefile.am index 5cd00bd25f..6ea8e8d4ca 100644 --- a/Makefile.am +++ b/Makefile.am @@ -6,7 +6,7 @@ BUILT_SOURCES = bind.keys.h CLEANFILES = bind.keys.h bind.keys.h: bind.keys Makefile - ${PERL} ${top_srcdir}/util/bindkeys.pl < ${top_srcdir}/bind.keys > $@ + ${PERL} ${top_srcdir}/util/bindkeys.pl ${top_srcdir}/bind.keys > $@ dist_sysconf_DATA = bind.keys diff --git a/util/bindkeys.pl b/util/bindkeys.pl index 55d6cb2cc9..d2b8631974 100755 --- a/util/bindkeys.pl +++ b/util/bindkeys.pl @@ -12,20 +12,15 @@ use strict; use warnings; -my $lines; -while (<>) { +print "#pragma once\n"; +print "#define TRUST_ANCHORS \"\\\n"; + +my $fn = shift or die "Usage: $0 FILENAME\n"; +open(my $fh, '<', $fn) or die "cannot open file $ARGV[1]\n"; +while (<$fh>) { chomp; - if (/\/\* .Id:.* \*\//) { - next; - } s/\"/\\\"/g; - s/$/\\n\\/; - $lines .= $_ . "\n"; + print $_ . "\\n\\\n"; } - -my $mkey = "#define TRUST_ANCHORS \\\n\t\"\\\n" . $lines . "\"\n"; - -print "#ifndef BIND_KEYS_H\n"; -print "#define BIND_KEYS_H 1\n"; -print $mkey; -print "#endif /* BIND_KEYS_H */\n"; +close($fh); +print "\"\n"; diff --git a/win32utils/Configure b/win32utils/Configure index 2fb04b2711..68c6900f8d 100644 --- a/win32utils/Configure +++ b/win32utils/Configure @@ -2405,6 +2405,18 @@ sub setupproject { close F; } +# Make bind.keys.h +# Keep this in sync with util/bindkeys.pl + +sub makebindkeysh { + my $bindkeysh = `perl.exe ..\\util\\bindkeys.pl ..\\bind.keys`; + die "Failed to generate bind.keys.h!\n" unless (length($bindkeysh)); + + open(my $fout, ">" . "..\\bind.keys.h") || die $!; + print $fout $bindkeysh; + close($fout); +} + # Build install files sub makeinstallfile { @@ -2614,6 +2626,8 @@ if (($want_win32 eq "yes") || ($want_x64 eq "yes")) { makeinstallfile(); + makebindkeysh(); + print "Configured.\n"; } else { print "add win32 or x64 to commit configuration to build files\n";