Skip to content

Commit 392f47d

Browse files
author
H. Peter Anvin
committed
Makefile: fix "make spotless"
Fix "make spotless" and some of the related targets so they actually behave sensibly. Signed-off-by: H. Peter Anvin <[email protected]>
1 parent 99d3342 commit 392f47d

File tree

2 files changed

+23
-15
lines changed

2 files changed

+23
-15
lines changed

Makefile.in

Lines changed: 22 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -206,7 +206,7 @@ WARNSRCS = $(LIBOBJ_NW:.$(O)=.c) asm/nasm.c
206206
# have Perl just to recompile NASM from the distribution.
207207

208208
# Perl-generated source files
209-
PERLREQ = config/unconfig.h \
209+
PERLREQ_CLEANABLE = \
210210
x86/insnsb.c x86/insnsa.c x86/insnsd.c x86/insnsi.h x86/insnsn.c \
211211
x86/regs.c x86/regs.h x86/regflags.c x86/regdis.c x86/regdis.h \
212212
x86/regvals.c asm/tokhash.c asm/tokens.h asm/pptok.h asm/pptok.c \
@@ -217,10 +217,14 @@ PERLREQ = config/unconfig.h \
217217
misc/nasmtok.el \
218218
version.h version.mac version.mak nsis/version.nsh
219219

220+
# Special hack to keep config/unconfig.h from getting deleted
221+
# by "make spotless"...
222+
PERLREQ = config/unconfig.h $(PERLREQ_CLEANABLE)
223+
220224
INSDEP = x86/insns.dat x86/insns.pl x86/insns-iflags.ph x86/iflags.ph
221225

222-
config/unconfig.h: config/config.h.in
223-
$(RUNPERL) $(tools)/unconfig.pl \
226+
config/unconfig.h: config/config.h.in autoconf/unconfig.pl
227+
$(RUNPERL) '$(srcdir)'/autoconf/unconfig.pl \
224228
'$(srcdir)' config/config.h.in config/unconfig.h
225229

226230
x86/iflag.c: $(INSDEP)
@@ -293,7 +297,7 @@ x86/regs.h: x86/regs.dat x86/regs.pl
293297
# changed, to avoid rebuilding everything every time. Track the actual
294298
# dependency by the empty file asm/warnings.time.
295299
.PHONY: warnings
296-
warnings:
300+
warnings: dirs
297301
$(RM_F) $(WARNFILES) $(WARNTIMES) asm/warnings.time
298302
$(MAKE) asm/warnings.time
299303

@@ -362,7 +366,8 @@ misc/nasmtok.el: misc/emacstbl.pl asm/tokhash.c asm/pptok.c \
362366

363367
#-- End Generated File Rules --#
364368

365-
perlreq: $(PERLREQ)
369+
perlreq: dirs
370+
$(MAKE) $(PERLREQ)
366371

367372
#-- Begin NSIS Rules --#
368373

@@ -402,24 +407,26 @@ clean:
402407
$(RM_F) nsis/arch.nsh
403408
$(RM_F) perlbreq.si
404409

405-
distclean: clean
410+
411+
cleaner: clean
412+
$(RM_F) $(PERLREQ_CL) *.1 nasm.spec
413+
$(MAKE) -C doc clean
414+
$(RM_F) *.dep */*.time
415+
416+
distclean: clean | cleaner
406417
for d in . $(SUBDIRS) $(XSUBDIRS); do \
407418
$(RM_F) "$$d"/.\# "$$d"/\# "$$d"/*~ "$$d"/*.bak \
408419
"$$d"/*.lst "$$d"/*.bin ; \
409420
done
410421
$(RM_F) test/*.$(O)
411422
$(RM_F) *.dep
412-
$(RM_F) Makefile doc/Makefile config/config.h config.log config.status
423+
-sh autoconf/clean.sh || sh '$(srcdir)'/autoconf/clean.sh
413424

414-
cleaner: clean
415-
$(RM_F) $(PERLREQ) *.1 nasm.spec
416-
$(MAKE) -C doc clean
417-
$(RM_F) *.dep */*.time
418-
419-
makefile-clean:
420-
./autogen.sh
425+
# This cleans up files generated by autogen.sh
426+
autoconf-clean: | distclean
427+
$(RM_F) configure autoconf/aclocal.m4 autoconf/clean.sh
421428

422-
spotless: distclean cleaner makefile-clean
429+
spotless: cleaner distclean autoconf-clean
423430

424431
strip:
425432
$(STRIP) --strip-unneeded $(PROGS)

autogen.sh

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -65,6 +65,7 @@ rm -rf autoconf/*m4.old
6565
echo 'rm -f config.log config.status'
6666
echo 'rm -rf autom4te.cache'
6767
) > autoconf/clean.sh
68+
chmod +x autoconf/clean.sh
6869
sh autoconf/clean.sh
6970

7071
# Try to regenerate unconfig.h if Perl is available and unconfig.pl

0 commit comments

Comments
 (0)