warnings: always regenerate outputs; tidy up unnecessary rules

With warnings disaggregated, there is no reason to play games with not
updating the output timestamp. Always write the files as usual.

Remove unnecessary Makefile rules.

Signed-off-by: H. Peter Anvin (Intel) <hpa@zytor.com>
1# Please enter the commit message for your changes. Lines starting
This commit is contained in:
H. Peter Anvin 2025-10-04 14:04:31 -07:00
parent 69f1aa6c6a
commit cd5dfb8c5f
4 changed files with 40 additions and 20 deletions

View file

@ -134,7 +134,7 @@ NDISASM = disasm/ndisasm.$(O)
PROGOBJ = $(NASM) $(NDISASM)
PROGS = nasm$(X) ndisasm$(X)
# Files dependent on extracted warnings
# Files dependent on warnings.dat
WARNOBJ = asm/warnings.$(O)
WARNFILES = asm/warnings_c.h include/warnings.h doc/warnings.src
@ -260,9 +260,6 @@ ndisasm$(X): $(NDISASM) $(MANIFEST) $(DISLIB) $(NASMLIB)
$(CC) $(ALL_LDFLAGS) -o $@ $(NDISASM) $(MANIFEST) \
$(DISLIB) $(NASMLIB) $(LIBS)
# These are specific to certain Makefile syntaxes...
WARNSRCS = $(ALLOBJ_W:.$(O)=.c)
# Make sure we have subdirectories set up...
$(LIBOBJ) $(LIBOBJ_DIS): $(DIRS)
@ -532,7 +529,7 @@ editor_builtin: nasm$(X)
dist:
$(MAKE) alldeps
$(MAKE) perlreq warnings spec
$(MAKE) perlreq spec
$(MAKE) editor_builtin
$(MAKE) editors $(MANPAGES)
$(MAKE) distclean

View file

@ -344,7 +344,25 @@ editors\nasmtok.json: editors\nasmtok.pl asm\tokhash.c asm\pptok.c \
version.mak
$(RUNPERL) $(srcdir)\editors\nasmtok.pl -json $@ $(srcdir) $(objdir)
editors: $(EDITORS)
editors: $(EDITORS) $(PHONY)
asm\warnings_c.h: asm\warnings.pl asm\warnings.dat
$(RUNPERL) $(srcdir)\asm\warnings.pl c asm\warnings_c.h \
$(srcdir)\asm\warnings.dat
include\warnings.h: asm\warnings.pl asm\warnings.dat
$(RUNPERL) $(srcdir)\asm\warnings.pl h include\warnings.h \
$(srcdir)\asm\warnings.dat
doc\warnings.src: asm\warnings.pl asm\warnings.dat
$(RUNPERL) $(srcdir)\asm\warnings.pl doc doc\warnings.src \
$(srcdir)\asm\warnings.dat
$(PERLREQ): $(DIRS)
perlreq: $(PERLREQ) $(PHONY)
warnings: $(WARNFILES) $(PHONY)
#-- End Generated File Rules --#

View file

@ -353,7 +353,25 @@ editors\nasmtok.json: editors\nasmtok.pl asm\tokhash.c asm\pptok.c &
version.mak
$(RUNPERL) $(srcdir)\editors\nasmtok.pl -json $@ $(srcdir) $(objdir)
editors: $(EDITORS)
editors: $(EDITORS) $(PHONY)
asm\warnings_c.h: asm\warnings.pl asm\warnings.dat
$(RUNPERL) $(srcdir)\asm\warnings.pl c asm\warnings_c.h &
$(srcdir)\asm\warnings.dat
include\warnings.h: asm\warnings.pl asm\warnings.dat
$(RUNPERL) $(srcdir)\asm\warnings.pl h include\warnings.h &
$(srcdir)\asm\warnings.dat
doc\warnings.src: asm\warnings.pl asm\warnings.dat
$(RUNPERL) $(srcdir)\asm\warnings.pl doc doc\warnings.src &
$(srcdir)\asm\warnings.dat
$(PERLREQ): $(DIRS)
perlreq: $(PERLREQ) $(PHONY)
warnings: $(WARNFILES) $(PHONY)
#-- End Generated File Rules --#

View file

@ -288,19 +288,6 @@ if ($what eq 'c') {
close($out);
# Write data to file if and only if it has changed
# For some systems, even if we don't write, opening for append
# apparently touches the timestamp, so we need to read and write
# as separate operations.
if (open(my $out, '<', $outfile)) {
my $datalen = length($outdata);
my $oldlen = read($out, my $oldoutdata, $datalen+1);
close($out);
exit 0 if (defined($oldlen) && $oldlen == $datalen &&
($oldoutdata eq $outdata));
}
# Data changed, must rewrite
open(my $out, '>', $outfile)
or die "$0: cannot open output file $outfile: $!\n";