[nasm:nasm-2.16.xx] Makefile: fix "make spotless"

nasm-bot for H. Peter Anvin hpa at zytor.com
Fri Apr 12 13:21:05 PDT 2024


Commit-ID:  392f47d06e5f0b48d8242ea6dd28af9bce3bb437
Gitweb:     http://repo.or.cz/w/nasm.git?a=commitdiff;h=392f47d06e5f0b48d8242ea6dd28af9bce3bb437
Author:     H. Peter Anvin <hpa at zytor.com>
AuthorDate: Fri, 12 Apr 2024 12:05:52 -0700
Committer:  H. Peter Anvin <hpa at zytor.com>
CommitDate: Fri, 12 Apr 2024 12:05:52 -0700

Makefile: fix "make spotless"

Fix "make spotless" and some of the related targets so they actually
behave sensibly.

Signed-off-by: H. Peter Anvin <hpa at zytor.com>


---
 Makefile.in | 37 ++++++++++++++++++++++---------------
 autogen.sh  |  1 +
 2 files changed, 23 insertions(+), 15 deletions(-)

diff --git a/Makefile.in b/Makefile.in
index d5028a4b..df048988 100644
--- a/Makefile.in
+++ b/Makefile.in
@@ -206,7 +206,7 @@ WARNSRCS  = $(LIBOBJ_NW:.$(O)=.c) asm/nasm.c
 # have Perl just to recompile NASM from the distribution.
 
 # Perl-generated source files
-PERLREQ = config/unconfig.h \
+PERLREQ_CLEANABLE = \
 	  x86/insnsb.c x86/insnsa.c x86/insnsd.c x86/insnsi.h x86/insnsn.c \
 	  x86/regs.c x86/regs.h x86/regflags.c x86/regdis.c x86/regdis.h \
 	  x86/regvals.c asm/tokhash.c asm/tokens.h asm/pptok.h asm/pptok.c \
@@ -217,10 +217,14 @@ PERLREQ = config/unconfig.h \
 	  misc/nasmtok.el \
 	  version.h version.mac version.mak nsis/version.nsh
 
+# Special hack to keep config/unconfig.h from getting deleted
+# by "make spotless"...
+PERLREQ = config/unconfig.h $(PERLREQ_CLEANABLE)
+
 INSDEP = x86/insns.dat x86/insns.pl x86/insns-iflags.ph x86/iflags.ph
 
-config/unconfig.h: config/config.h.in
-	$(RUNPERL) $(tools)/unconfig.pl \
+config/unconfig.h: config/config.h.in autoconf/unconfig.pl
+	$(RUNPERL) '$(srcdir)'/autoconf/unconfig.pl \
 		'$(srcdir)' config/config.h.in config/unconfig.h
 
 x86/iflag.c: $(INSDEP)
@@ -293,7 +297,7 @@ x86/regs.h: x86/regs.dat x86/regs.pl
 # changed, to avoid rebuilding everything every time. Track the actual
 # dependency by the empty file asm/warnings.time.
 .PHONY: warnings
-warnings:
+warnings: dirs
 	$(RM_F) $(WARNFILES) $(WARNTIMES) asm/warnings.time
 	$(MAKE) asm/warnings.time
 
@@ -362,7 +366,8 @@ misc/nasmtok.el: misc/emacstbl.pl asm/tokhash.c asm/pptok.c \
 
 #-- End Generated File Rules --#
 
-perlreq: $(PERLREQ)
+perlreq: dirs
+	$(MAKE) $(PERLREQ)
 
 #-- Begin NSIS Rules --#
 
@@ -402,24 +407,26 @@ clean:
 	$(RM_F) nsis/arch.nsh
 	$(RM_F) perlbreq.si
 
-distclean: clean
+
+cleaner: clean
+	$(RM_F) $(PERLREQ_CL) *.1 nasm.spec
+	$(MAKE) -C doc clean
+	$(RM_F) *.dep */*.time
+
+distclean: clean | cleaner
 	for d in . $(SUBDIRS) $(XSUBDIRS); do \
 		$(RM_F) "$$d"/.\# "$$d"/\# "$$d"/*~ "$$d"/*.bak \
 			"$$d"/*.lst "$$d"/*.bin ; \
 	done
 	$(RM_F) test/*.$(O)
 	$(RM_F) *.dep
-	$(RM_F) Makefile doc/Makefile config/config.h config.log config.status
+	-sh autoconf/clean.sh || sh '$(srcdir)'/autoconf/clean.sh
 
-cleaner: clean
-	$(RM_F) $(PERLREQ) *.1 nasm.spec
-	$(MAKE) -C doc clean
-	$(RM_F) *.dep */*.time
-
-makefile-clean:
-	./autogen.sh
+# This cleans up files generated by autogen.sh
+autoconf-clean: | distclean
+	$(RM_F) configure autoconf/aclocal.m4 autoconf/clean.sh
 
-spotless: distclean cleaner makefile-clean
+spotless: cleaner distclean autoconf-clean
 
 strip:
 	$(STRIP) --strip-unneeded $(PROGS)
diff --git a/autogen.sh b/autogen.sh
index 91ebbb1e..4ed675d8 100755
--- a/autogen.sh
+++ b/autogen.sh
@@ -65,6 +65,7 @@ rm -rf autoconf/*m4.old
     echo 'rm -f config.log config.status'
     echo 'rm -rf autom4te.cache'
 ) > autoconf/clean.sh
+chmod +x autoconf/clean.sh
 sh autoconf/clean.sh
 
 # Try to regenerate unconfig.h if Perl is available and unconfig.pl


More information about the Nasm-commits mailing list