@@ -43,6 +43,8 @@ PERL = perl
43
43
PERLFLAGS = -I$(top_srcdir ) /perllib -I$(srcdir )
44
44
RUNPERL = $(PERL ) $(PERLFLAGS )
45
45
46
+ EMPTY = : >
47
+
46
48
PYTHON3 = python3
47
49
48
50
INSTALL = @INSTALL@
@@ -55,6 +57,7 @@ ASCIIDOC = @ASCIIDOC@
55
57
XMLTO = @XMLTO@
56
58
MAKENSIS = @MAKENSIS@
57
59
XZ = @XZ@
60
+ WINDRES = @WINDRES@
58
61
59
62
# Optional targets
60
63
MANPAGES = @MANPAGES@
@@ -76,6 +79,12 @@ ifeq ($(TRACE),1)
76
79
CFLAGS += -DNASM_TRACE
77
80
endif
78
81
82
+ # Don't delete intermediate files
83
+ .SECONDARY :
84
+
85
+ # Delete files on error
86
+ .DELETE_ON_ERROR :
87
+
79
88
.SUFFIXES :
80
89
.SUFFIXES : $(X ) .$(O ) .$(A ) .xml .1 .c .i .s .txt .time
81
90
98
107
.xml.1 :
99
108
$(XMLTO ) man --skip-validation $< 2> /dev/null
100
109
110
+ MANIFEST = @MANIFEST@
111
+
101
112
# -- Begin File Lists --#
102
113
NASM = asm/nasm.$(O )
103
114
NDISASM = disasm/ndisasm.$(O )
@@ -115,7 +126,8 @@ LIBOBJ_NW = stdlib/snprintf.$(O) stdlib/vsnprintf.$(O) stdlib/strlcpy.$(O) \
115
126
nasmlib/file.$(O ) nasmlib/mmap.$(O ) nasmlib/ilog2.$(O ) \
116
127
nasmlib/realpath.$(O ) nasmlib/path.$(O ) \
117
128
nasmlib/filename.$(O ) nasmlib/rlimit.$(O ) \
118
- nasmlib/zerobuf.$(O ) nasmlib/readnum.$(O ) nasmlib/bsi.$(O ) \
129
+ nasmlib/readnum.$(O ) nasmlib/numstr.$(O ) \
130
+ nasmlib/zerobuf.$(O ) nasmlib/bsi.$(O ) \
119
131
nasmlib/rbtree.$(O ) nasmlib/hashtbl.$(O ) \
120
132
nasmlib/raa.$(O ) nasmlib/saa.$(O ) \
121
133
nasmlib/strlist.$(O ) \
@@ -153,14 +165,16 @@ LIBOBJ_NW = stdlib/snprintf.$(O) stdlib/vsnprintf.$(O) stdlib/strlcpy.$(O) \
153
165
154
166
# Warnings depend on all source files, so handle them separately
155
167
WARNOBJ = asm/warnings.$(O )
168
+ WARNFILES = asm/warnings_c.h include/warnings.h doc/warnings.src
156
169
157
170
LIBOBJ = $(LIBOBJ_NW ) $(WARNOBJ )
158
171
ALLOBJ_NW = $(PROGOBJ ) $(LIBOBJ_NW )
159
172
ALLOBJ = $(PROGOBJ ) $(LIBOBJ )
160
173
161
- SUBDIRS = stdlib nasmlib output asm disasm x86 common macros
162
- XSUBDIRS = test doc nsis
163
- DEPDIRS = . include config x86 $(SUBDIRS )
174
+ SUBDIRS = stdlib nasmlib include config output asm disasm x86 \
175
+ common macros
176
+ XSUBDIRS = test doc nsis win
177
+ DEPDIRS = . $(SUBDIRS )
164
178
# -- End File Lists --#
165
179
166
180
all : dirs
@@ -176,11 +190,15 @@ $(NASMLIB): $(LIBOBJ)
176
190
$(AR ) cq $(NASMLIB ) $(LIBOBJ )
177
191
$(RANLIB ) $(NASMLIB )
178
192
179
- nasm$(X ) : $(NASM ) $(NASMLIB )
180
- $(CC ) $(ALL_LDFLAGS ) -o nasm$(X ) $( NASM ) $( NASMLIB ) $(LIBS )
193
+ nasm$(X ) : $(NASM ) $(MANIFEST ) $( NASMLIB )
194
+ $(CC ) $(ALL_LDFLAGS ) -o nasm$(X ) $^ $(LIBS )
181
195
182
- ndisasm$(X ) : $(NDISASM ) $(NASMLIB )
183
- $(CC ) $(ALL_LDFLAGS ) -o ndisasm$(X ) $(NDISASM ) $(NASMLIB ) $(LIBS )
196
+ ndisasm$(X ) : $(NDISASM ) $(MANIFEST ) $(NASMLIB )
197
+ $(CC ) $(ALL_LDFLAGS ) -o ndisasm$(X ) $^ $(LIBS )
198
+
199
+ # These are specific to certain Makefile syntaxes...
200
+ WARNTIMES = $(WARNFILES:=.time )
201
+ WARNSRCS = $(LIBOBJ_NW:.$(O ) =.c ) asm/nasm.c
184
202
185
203
# -- Begin Generated File Rules --#
186
204
@@ -189,7 +207,7 @@ ndisasm$(X): $(NDISASM) $(NASMLIB)
189
207
# have Perl just to recompile NASM from the distribution.
190
208
191
209
# Perl-generated source files
192
- PERLREQ = config/unconfig.h \
210
+ PERLREQ_CLEANABLE = \
193
211
x86/insnsb.c x86/insnsa.c x86/insnsd.c x86/insnsi.h x86/insnsn.c \
194
212
x86/regs.c x86/regs.h x86/regflags.c x86/regdis.c x86/regdis.h \
195
213
x86/regvals.c asm/tokhash.c asm/tokens.h asm/pptok.h asm/pptok.c \
@@ -200,10 +218,14 @@ PERLREQ = config/unconfig.h \
200
218
misc/nasmtok.el \
201
219
version.h version.mac version.mak nsis/version.nsh
202
220
221
+ # Special hack to keep config/unconfig.h from getting deleted
222
+ # by "make spotless"...
223
+ PERLREQ = config/unconfig.h $(PERLREQ_CLEANABLE )
224
+
203
225
INSDEP = x86/insns.dat x86/insns.pl x86/insns-iflags.ph x86/iflags.ph
204
226
205
- config/unconfig.h : config/config.h.in
206
- $(RUNPERL ) $( tools ) /unconfig.pl \
227
+ config/unconfig.h : config/config.h.in autoconf/unconfig.pl
228
+ $(RUNPERL ) ' $(srcdir) ' /autoconf /unconfig.pl \
207
229
' $(srcdir)' config/config.h.in config/unconfig.h
208
230
209
231
x86/iflag.c : $(INSDEP )
@@ -275,33 +297,32 @@ x86/regs.h: x86/regs.dat x86/regs.pl
275
297
# reasonable, but doesn't update the time stamp if the files aren't
276
298
# changed, to avoid rebuilding everything every time. Track the actual
277
299
# dependency by the empty file asm/warnings.time.
278
- WARNFILES = asm/warnings_c.h include/warnings.h doc/warnings.src
279
-
280
- warnings :
281
- $(RM_F ) $(WARNFILES ) $(WARNFILES:=.time )
300
+ .PHONY : warnings
301
+ warnings : dirs
302
+ $(RM_F ) $(WARNFILES ) $(WARNTIMES ) asm/warnings.time
282
303
$(MAKE ) asm/warnings.time
283
304
284
- asm/warnings.time : $(ALLOBJ_NW:. $( O ) =.c )
285
- : > asm/warnings.time
286
- $(MAKE ) $(WARNFILES:=.time )
305
+ asm/warnings.time : $(WARNSRCS ) asm/warnings.pl
306
+ $( EMPTY ) asm/warnings.time
307
+ $(MAKE ) $(WARNTIMES )
287
308
288
309
asm/warnings_c.h.time : asm/warnings.pl asm/warnings.time
289
310
$(RUNPERL ) $(srcdir ) /asm/warnings.pl c asm/warnings_c.h $(srcdir )
290
- : > asm/warnings_c.h.time
311
+ $( EMPTY ) asm/warnings_c.h.time
291
312
292
313
asm/warnings_c.h : asm/warnings_c.h.time
293
314
@: Side effect
294
315
295
316
include/warnings.h.time : asm/warnings.pl asm/warnings.time
296
317
$(RUNPERL ) $(srcdir ) /asm/warnings.pl h include/warnings.h $(srcdir )
297
- : > include/warnings.h.time
318
+ $( EMPTY ) include/warnings.h.time
298
319
299
320
include/warnings.h : include/warnings.h.time
300
321
@: Side effect
301
322
302
323
doc/warnings.src.time : asm/warnings.pl asm/warnings.time
303
324
$(RUNPERL ) $(srcdir ) /asm/warnings.pl doc doc/warnings.src $(srcdir )
304
- : > doc/warnings.src.time
325
+ $( EMPTY ) doc/warnings.src.time
305
326
306
327
doc/warnings.src : doc/warnings.src.time
307
328
@: Side effect
@@ -346,7 +367,8 @@ misc/nasmtok.el: misc/emacstbl.pl asm/tokhash.c asm/pptok.c \
346
367
347
368
# -- End Generated File Rules --#
348
369
349
- perlreq : $(PERLREQ )
370
+ perlreq : dirs
371
+ $(MAKE ) $(PERLREQ )
350
372
351
373
# -- Begin NSIS Rules --#
352
374
@@ -361,6 +383,11 @@ nsis: nsis/nasm.nsi nsis/arch.nsh nsis/version.nsh
361
383
362
384
# -- End NSIS Rules --#
363
385
386
+ # Windows embedded manifest
387
+ MANIFEST_RC = win/manifest.rc
388
+ win/manifest.$(O ) : win/manifest.xml $(MANIFEST_RC )
389
+ $(WINDRES ) -I. -Iwin -DMANIFEST_FILE=' \"$<\"' -i $(MANIFEST_RC ) -o $@
390
+
364
391
# Generated manpages, also pregenerated for distribution
365
392
manpages : nasm.1 ndisasm.1
366
393
@@ -388,16 +415,16 @@ distclean: clean
388
415
done
389
416
$(RM_F ) test/* .$(O )
390
417
$(RM_F ) * .dep
418
+ -sh autoconf/clean.sh || sh ' $(srcdir)' /autoconf/clean.sh
391
419
392
- cleaner : clean
393
- $(RM_F ) $(PERLREQ ) * .1 nasm.spec
420
+ cleaner :
421
+ $(RM_F ) $(PERLREQ_CL ) * .1 nasm.spec
394
422
$(MAKE ) -C doc clean
395
- $(RM_F ) * .dep * /* .time
396
-
397
- makefile-clean :
398
- ./autogen.sh
423
+ $(MAKE ) distclean
424
+ $(RM_F ) * /* .time
399
425
400
- spotless : distclean cleaner makefile-clean
426
+ spotless : cleaner
427
+ $(RM_F ) configure autoconf/aclocal.m4 autoconf/clean.sh
401
428
402
429
strip :
403
430
$(STRIP ) --strip-unneeded $(PROGS )
@@ -433,23 +460,22 @@ everything: always_everything
433
460
install_everything : everything install install_doc
434
461
435
462
dist :
436
- $(MAKE ) distclean
437
463
$(MAKE ) alldeps
438
- $(MAKE ) perlreq manpages spec $(MANPAGES )
464
+ $(MAKE ) perlreq warnings spec $(MANPAGES )
465
+ $(MAKE ) distclean
439
466
./autogen.sh
440
467
441
468
tar : dist
442
- tar -cv --exclude CVS -C .. -f - | \
443
- $(XZ ) -9e > \
444
- ../nasm-` cat version` -` date +%Y%m%d` .tar.xz ` basename \` pwd\` `
469
+ tar -cv --exclude CVS --exclude .git -C .. -f - ` basename \` pwd\` ` | \
470
+ $(XZ ) -9e > ../nasm-` cat version` -` date +%Y%m%d` .tar.xz
445
471
446
472
spec : nasm.spec
447
473
448
474
ALLPERLSRC := $(shell find $(srcdir ) -type f -name '* .p[lh]')
449
475
450
476
perlbreq.si : $(ALLPERLSRC )
451
- sed -n -r -e ' s/^[[:space:]]*use[[:space:]]+([^[:space:];]+ ).*$$/BuildRequires: perl(\1)/p' $(ALLPERLSRC ) | \
452
- sed -r -e ' /perl\((strict|warnings| Win32.*)\)/d' | \
477
+ sed -n -r -e ' s/^[[:space:]]*use[[:space:]]+([[:upper:]][ ^[:space:];]* ).*$$/BuildRequires: perl(\1)/p' $(ALLPERLSRC ) | \
478
+ sed -r -e ' /perl\((Win32.*)\)/d' | \
453
479
sort | uniq > perlbreq.si
454
480
455
481
nasm.spec : nasm.spec.in nasm.spec.sed version.sed perlbreq.si
@@ -508,8 +534,9 @@ EXTERNAL_DEPENDENCIES = 1
508
534
# the dependency information will remain external, so it doesn't
509
535
# pollute the git logs.
510
536
#
511
- Makefile.dep : $(PERLREQ ) $(tools ) /mkdep.pl config.status
512
- $(RUNPERL ) $(tools ) /mkdep.pl -M Makefile.in -- $(DEPDIRS )
537
+ Makefile.dep : $(tools ) /mkdep.pl config.status $(PERLREQ )
538
+ $(RUNPERL ) $(tools ) /mkdep.pl -s ' $(top_srcdir)' \
539
+ -M $(srcdir ) /Makefile.in -- $(DEPDIRS )
513
540
514
541
dep : Makefile.dep
515
542
0 commit comments