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 <hpa@zytor.com>
This commit is contained in:
H. Peter Anvin 2024-04-04 14:18:34 -07:00
parent 5a03edfdd9
commit b11cd3a426
3 changed files with 18 additions and 4 deletions

View File

@ -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)

View File

@ -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;
}

View File

@ -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