[PATCH 2/3] libga68: do not record the source directory in generated sources

Trevor Woerner <[email protected]> Wed, 5 Aug 2026 02:37:28 -0400
Newsgroups gmane.comp.gcc.patches
Message-ID <[email protected]>
sppp.awk writes a header comment naming the file it was generated from,
using awk's FILENAME. The makefile rule invokes it as

    $(AWK) -f $(srcdir)/sppp.awk $< > $@

so FILENAME is $(srcdir)/standard.a68.in, and for an out-of-tree build
with an absolute srcdir the resulting standard.a68 begins with

    { This is auto-generated from /abs/path/to/libga68/standard.a68.in.
      Do not edit.  }

The content of a generated source therefore depends on where the tree
was unpacked. That is a reproducibility problem in its own right, and it
leaks the build directory into anything that ships the generated source,
such as a distribution's debug-source package.

Print only the file name, which is what the comment is for.

Assisted by: Codex (Claude Opus 5)

libga68/ChangeLog:

	* sppp.awk: Strip any directory prefix from FILENAME in the
	generated header comment.

Signed-off-by: Trevor Woerner <[email protected]>
---
 libga68/sppp.awk | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/libga68/sppp.awk b/libga68/sppp.awk
index 8ab94bac6363..97a2fb825b3e 100644
--- a/libga68/sppp.awk
+++ b/libga68/sppp.awk
@@ -29,7 +29,9 @@ BEGIN {
 }
 
 /^[ \t]*\{ Process this file/ {
-    print "{ This is auto-generated from " FILENAME ".  Do not edit.  }"
+    srcfile = FILENAME
+    sub (/^.*\//, "", srcfile)
+    print "{ This is auto-generated from " srcfile ".  Do not edit.  }"
     next
 }
 
-- 
2.51.0