@@ -75,7 +75,7 @@ ifeq ($(TRACE),1)
7575endif
7676
7777.SUFFIXES :
78- .SUFFIXES : $(X ) .$(O ) .$(A ) .xml .1 .c .i .s .txt
78+ .SUFFIXES : $(X ) .$(O ) .$(A ) .xml .1 .c .i .s .txt .time
7979
8080.PHONY : all doc rdf install clean distclean cleaner spotless install_rdf test
8181.PHONY : install_doc everything install_everything strip perlreq dist tags TAGS
@@ -100,7 +100,10 @@ endif
100100NASM = asm/nasm.$(O )
101101NDISASM = disasm/ndisasm.$(O )
102102
103- LIBOBJ = stdlib/snprintf.$(O ) stdlib/vsnprintf.$(O ) stdlib/strlcpy.$(O ) \
103+ PROGOBJ = $(NASM ) $(NDISASM )
104+ PROGS = nasm$(X ) ndisasm$(X )
105+
106+ LIBOBJ_NW = stdlib/snprintf.$(O ) stdlib/vsnprintf.$(O ) stdlib/strlcpy.$(O ) \
104107 stdlib/strnlen.$(O ) stdlib/strrchrnul.$(O ) \
105108 \
106109 nasmlib/ver.$(O ) \
@@ -122,7 +125,7 @@ LIBOBJ = stdlib/snprintf.$(O) stdlib/vsnprintf.$(O) stdlib/strlcpy.$(O) \
122125 x86/regs.$(O ) x86/regvals.$(O ) x86/regflags.$(O ) x86/regdis.$(O ) \
123126 x86/disp8.$(O ) x86/iflag.$(O ) \
124127 \
125- asm/error.$(O ) asm/warnings. $( O ) \
128+ asm/error.$(O ) \
126129 asm/floats.$(O ) \
127130 asm/directiv.$(O ) asm/directbl.$(O ) \
128131 asm/pragma.$(O ) \
@@ -147,15 +150,20 @@ LIBOBJ = stdlib/snprintf.$(O) stdlib/vsnprintf.$(O) stdlib/strlcpy.$(O) \
147150 \
148151 disasm/disasm.$(O ) disasm/sync.$(O )
149152
150- ALLOBJ = $(NASM ) $(NDISASM ) $(LIBOBJ )
153+ # Warnings depend on all source files, so handle them separately
154+ WARNOBJ = asm/warnings.$(O )
155+
156+ LIBOBJ = $(LIBOBJ_NW ) $(WARNOBJ )
157+ ALLOBJ_NW = $(PROGOBJ ) $(LIBOBJ_NW )
158+ ALLOBJ = $(PROGOBJ ) $(LIBOBJ )
151159
152160SUBDIRS = stdlib nasmlib output asm disasm x86 common macros
153161XSUBDIRS = test doc nsis rdoff
154162DEPDIRS = . include config x86 rdoff $(SUBDIRS )
155163# -- End File Lists --#
156164
157165all : dirs
158- $(MAKE ) nasm $( X ) ndisasm $( X ) rdf
166+ $(MAKE ) $( PROGS ) rdf
159167
160168NASMLIB = libnasm.$(A )
161169
@@ -271,18 +279,30 @@ warnings:
271279 $(RM_F ) $(WARNFILES )
272280 $(MAKE ) asm/warnings.time
273281
274- asm/warnings.time : $(ALLOBJ:.@OBJEXT@ =.c )
282+ asm/warnings.time : $(ALLOBJ_NW:. $( O ) =.c )
275283 : > asm/warnings.time
276- $(MAKE ) $(WARNFILES )
284+ $(MAKE ) $(WARNFILES:=.time )
277285
278- asm/warnings.c : asm/warnings.pl asm/warnings.time
286+ asm/warnings.c.time : asm/warnings.pl asm/warnings.time
279287 $(RUNPERL ) $(srcdir ) /asm/warnings.pl c asm/warnings.c $(srcdir )
288+ : > asm/warnings.c.time
289+
290+ asm/warnings.c : asm/warnings.c.time
291+ @: Side effect
280292
281- include/warnings.h : asm/warnings.pl asm/warnings.time
293+ include/warnings.h.time : asm/warnings.pl asm/warnings.time
282294 $(RUNPERL ) $(srcdir ) /asm/warnings.pl h include/warnings.h $(srcdir )
295+ : > include/warnings.h.time
283296
284- doc/warnings.src : asm/warnings.pl asm/warnings.time
297+ include/warnings.h : include/warnings.h.time
298+ @: Side effect
299+
300+ doc/warnings.src.time : asm/warnings.pl asm/warnings.time
285301 $(RUNPERL ) $(srcdir ) /asm/warnings.pl doc doc/warnings.src $(srcdir )
302+ : > doc/warnings.src.time
303+
304+ doc/warnings.src : doc/warnings.src.time
305+ @: Side effect
286306
287307# Assembler token hash
288308asm/tokhash.c : x86/insns.dat x86/regs.dat asm/tokens.dat asm/tokhash.pl \
@@ -385,10 +405,9 @@ nsis: nsis/nasm.nsi nsis/arch.nsh nsis/version.nsh
385405# Generated manpages, also pregenerated for distribution
386406manpages : nasm.1 ndisasm.1
387407
388- install : nasm $( X ) ndisasm $( X )
408+ install : $( PROGS )
389409 $(MKDIR_P ) $(DESTDIR )$(bindir )
390- $(INSTALL_PROGRAM ) nasm$(X ) $(DESTDIR )$(bindir ) /nasm$(X )
391- $(INSTALL_PROGRAM ) ndisasm$(X ) $(DESTDIR )$(bindir ) /ndisasm$(X )
410+ $(INSTALL_PROGRAM ) $(PROGS ) $(DESTDIR )$(bindir ) /
392411 $(MKDIR_P ) $(DESTDIR )$(mandir ) /man1
393412 $(INSTALL_DATA ) $(srcdir ) /nasm.1 $(DESTDIR )$(mandir ) /man1/nasm.1
394413 $(INSTALL_DATA ) $(srcdir ) /ndisasm.1 $(DESTDIR )$(mandir ) /man1/ndisasm.1
@@ -397,7 +416,7 @@ clean:
397416 for d in . $( SUBDIRS) $( XSUBDIRS) ; do \
398417 $(RM_F ) " $$ d" /* .$(O ) " $$ d" /* .s " $$ d" /* .i " $$ d" /* .$(A ) ; \
399418 done
400- $(RM_F ) nasm $( X ) ndisasm $( X )
419+ $(RM_F ) $( PROGS )
401420 $(RM_F ) nasm-* -installer-* .exe
402421 $(RM_F ) tags TAGS
403422 $(RM_F ) nsis/arch.nsh
@@ -412,18 +431,18 @@ distclean: clean
412431 done
413432 $(RM_F ) test/* .$(O )
414433 $(RM_RF ) autom4te* .cache
415- $(RM_F ) Makefile * .dep asm/warnings.time
434+ $(RM_F ) Makefile * .dep
416435
417436cleaner : clean
418437 $(RM_F ) $(PERLREQ ) * .1 nasm.spec
419438 $(MAKE ) -C doc clean
420- $(RM_F ) * .dep asm/warnings .time
439+ $(RM_F ) * .dep * / * .time
421440
422441spotless : distclean cleaner
423442 $(RM_F ) doc/Makefile
424443
425444strip :
426- $(STRIP ) --strip-unneeded nasm $( X ) ndisasm $( X )
445+ $(STRIP ) --strip-unneeded $( PROGS )
427446
428447TAGS :
429448 $(RM_F ) TAGS
@@ -496,13 +515,13 @@ nasm.spec: nasm.spec.in nasm.spec.sed version.sed perlbreq.si
496515splint :
497516 splint -weak * .c
498517
499- test : nasm $( X )
518+ test : $( PROGS )
500519 cd test && $(RUNPERL ) performtest.pl --nasm=../nasm * .asm
501520
502- golden : nasm $( X )
521+ golden : $( PROGS )
503522 cd test && $(RUNPERL ) performtest.pl --golden --nasm=../nasm * .asm
504523
505- travis : nasm $( X )
524+ travis : $( PROGS )
506525 $(PYTHON3 ) travis/nasm-t.py run
507526
508527#
0 commit comments