From b11cd3a4266c075916539d7accafb0ae1febd881 Mon Sep 17 00:00:00 2001 From: "H. Peter Anvin" Date: Thu, 4 Apr 2024 14:18:34 -0700 Subject: [PATCH] warnings: more improvements to warnings generation Try to better sort out the necessary dependencies for warning generation. Fix regex for cleaning up nasmdoc markup: nasmdoc markup does not nest, although it may include \} sequences. Signed-off-by: H. Peter Anvin --- Makefile.in | 13 ++++++++++--- asm/warnings.pl | 3 ++- doc/Makefile.in | 6 ++++++ 3 files changed, 18 insertions(+), 4 deletions(-) diff --git a/Makefile.in b/Makefile.in index 93ea2c3a..d5028a4b 100644 --- a/Makefile.in +++ b/Makefile.in @@ -79,6 +79,12 @@ ifeq ($(TRACE),1) CFLAGS += -DNASM_TRACE endif +# Don't delete intermediate files +.SECONDARY: + +# Delete files on error +.DELETE_ON_ERROR: + .SUFFIXES: .SUFFIXES: $(X) .$(O) .$(A) .xml .1 .c .i .s .txt .time @@ -191,7 +197,7 @@ ndisasm$(X): $(NDISASM) $(MANIFEST) $(NASMLIB) # These are specific to certain Makefile syntaxes... WARNTIMES = $(WARNFILES:=.time) -WARNSRCS = $(LIBOBJ_NW:.$(O)=.c) +WARNSRCS = $(LIBOBJ_NW:.$(O)=.c) asm/nasm.c #-- Begin Generated File Rules --# @@ -286,11 +292,12 @@ x86/regs.h: x86/regs.dat x86/regs.pl # reasonable, but doesn't update the time stamp if the files aren't # changed, to avoid rebuilding everything every time. Track the actual # dependency by the empty file asm/warnings.time. +.PHONY: warnings warnings: - $(RM_F) $(WARNFILES) $(WARNTIMES) + $(RM_F) $(WARNFILES) $(WARNTIMES) asm/warnings.time $(MAKE) asm/warnings.time -asm/warnings.time: $(WARNSRCS) +asm/warnings.time: $(WARNSRCS) asm/warnings.pl $(EMPTY) asm/warnings.time $(MAKE) $(WARNTIMES) diff --git a/asm/warnings.pl b/asm/warnings.pl index bff566c0..33e85cfa 100755 --- a/asm/warnings.pl +++ b/asm/warnings.pl @@ -18,10 +18,11 @@ sub quote_for_c(@) { return $s; } +# Remove a subset of nasmdoc markup sub remove_markup(@) { my $s = join('', @_); - $s =~ s/\\[\w+](\{((?:(?>[^{}]+)|(?1))*)\})?/$2/g; + $s =~ s/\\[\w+](?:\{((?:[^\}]|\\\})*)\})/$1/g; $s =~ s/\\(\W)/$1/g; return $s; } diff --git a/doc/Makefile.in b/doc/Makefile.in index 1c8393c5..f87c7155 100644 --- a/doc/Makefile.in +++ b/doc/Makefile.in @@ -43,6 +43,12 @@ SRCS = nasmdoc.src inslist.src changes.src warnings.src version.src OUT = html nasmdoc.txt nasmdoc.pdf $(XZFILES) XZOUT = nasmdoc.pdf.xz +# Don't delete intermediate files +.SECONDARY: + +# Delete files on error +.DELETE_ON_ERROR: + .SUFFIXES: .SUFFIXES: .pfa .ph