Skip to content

Commit 7e80d6b

Browse files
author
H. Peter Anvin
committed
Make: handle warning files while building in a directory
The dependency on the warning files breaks when we are building in a directory *and* the files already exist from being shipped with the distribution tarballs. The make VPATH simply isn't sophisticated enough to deal with it, so let the C compiler handle it by #including the generated file from a dummy C file. Reported-by: Rudi Heitbaum <[email protected]> Signed-off-by: H. Peter Anvin <[email protected]>
1 parent 66a91c3 commit 7e80d6b

File tree

6 files changed

+37
-34
lines changed

6 files changed

+37
-34
lines changed

.gitignore

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ TAGS
5050
/asm/pptok.ph
5151
/asm/tokens.h
5252
/asm/tokhash.c
53-
/asm/warnings.c
53+
/asm/warnings_c.h
5454
/config/config.h.in
5555
/config/config.h
5656
/config.log

Makefile.in

Lines changed: 20 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -37,8 +37,10 @@ AR = @AR@
3737
RANLIB = @RANLIB@
3838
STRIP = @STRIP@
3939

40+
tools = $(top_srcdir)/tools
41+
4042
PERL = perl
41-
PERLFLAGS = -I$(srcdir)/perllib -I$(srcdir)
43+
PERLFLAGS = -I$(top_srcdir)/perllib -I$(srcdir)
4244
RUNPERL = $(PERL) $(PERLFLAGS)
4345

4446
PYTHON3 = python3
@@ -65,8 +67,8 @@ LN_S = @LN_S@
6567
FIND = find
6668

6769
# Binary suffixes
68-
O = @OBJEXT@
69-
X = @EXEEXT@
70+
O = @OBJEXT@
71+
X = @EXEEXT@
7072
A = @LIBEXT@
7173

7274
# Debug stuff
@@ -194,14 +196,14 @@ PERLREQ = config/unconfig.h \
194196
x86/iflag.c x86/iflaggen.h \
195197
macros/macros.c \
196198
asm/pptok.ph asm/directbl.c asm/directiv.h \
197-
asm/warnings.c include/warnings.h doc/warnings.src \
199+
$(WARNFILES) \
198200
misc/nasmtok.el \
199201
version.h version.mac version.mak nsis/version.nsh
200202

201203
INSDEP = x86/insns.dat x86/insns.pl x86/insns-iflags.ph x86/iflags.ph
202204

203205
config/unconfig.h: config/config.h.in
204-
$(RUNPERL) $(srcdir)/tools/unconfig.pl \
206+
$(RUNPERL) $(tools)/unconfig.pl \
205207
'$(srcdir)' config/config.h.in config/unconfig.h
206208

207209
x86/iflag.c: $(INSDEP)
@@ -273,7 +275,7 @@ x86/regs.h: x86/regs.dat x86/regs.pl
273275
# reasonable, but doesn't update the time stamp if the files aren't
274276
# changed, to avoid rebuilding everything every time. Track the actual
275277
# dependency by the empty file asm/warnings.time.
276-
WARNFILES = asm/warnings.c include/warnings.h doc/warnings.src
278+
WARNFILES = asm/warnings_c.h include/warnings.h doc/warnings.src
277279

278280
warnings:
279281
$(RM_F) $(WARNFILES) $(WARNFILES:=.time)
@@ -283,11 +285,11 @@ asm/warnings.time: $(ALLOBJ_NW:.$(O)=.c)
283285
: > asm/warnings.time
284286
$(MAKE) $(WARNFILES:=.time)
285287

286-
asm/warnings.c.time: asm/warnings.pl asm/warnings.time
287-
$(RUNPERL) $(srcdir)/asm/warnings.pl c asm/warnings.c $(srcdir)
288-
: > asm/warnings.c.time
288+
asm/warnings_c.h.time: asm/warnings.pl asm/warnings.time
289+
$(RUNPERL) $(srcdir)/asm/warnings.pl c asm/warnings_c.h $(srcdir)
290+
: > asm/warnings_c.h.time
289291

290-
asm/warnings.c: asm/warnings.c.time
292+
asm/warnings_c.h: asm/warnings_c.h.time
291293
@: Side effect
292294

293295
include/warnings.h.time: asm/warnings.pl asm/warnings.time
@@ -506,8 +508,8 @@ EXTERNAL_DEPENDENCIES = 1
506508
# the dependency information will remain external, so it doesn't
507509
# pollute the git logs.
508510
#
509-
Makefile.dep: $(PERLREQ) tools/mkdep.pl config.status
510-
$(RUNPERL) tools/mkdep.pl -M Makefile.in -- $(DEPDIRS)
511+
Makefile.dep: $(PERLREQ) $(tools)/mkdep.pl config.status
512+
$(RUNPERL) $(tools)/mkdep.pl -M Makefile.in -- $(DEPDIRS)
511513

512514
dep: Makefile.dep
513515

@@ -517,9 +519,9 @@ dep: Makefile.dep
517519
# be invoked manually or via "make dist". It should be run before
518520
# creating release archives.
519521
#
520-
alldeps: $(PERLREQ) tools/syncfiles.pl tools/mkdep.pl
521-
$(RUNPERL) tools/syncfiles.pl Makefile.in Mkfiles/*.mak
522-
$(RUNPERL) tools/mkdep.pl -i -M Makefile.in Mkfiles/*.mak -- \
522+
alldeps: $(PERLREQ) $(tools)/syncfiles.pl $(tools)/mkdep.pl
523+
$(RUNPERL) $(tools)/syncfiles.pl Makefile.in Mkfiles/*.mak
524+
$(RUNPERL) $(tools)/mkdep.pl -i -M Makefile.in Mkfiles/*.mak -- \
523525
$(DEPDIRS)
524526
$(RM_F) *.dep
525527
if [ -f config.status ]; then \
@@ -528,9 +530,9 @@ alldeps: $(PERLREQ) tools/syncfiles.pl tools/mkdep.pl
528530

529531
# Strip internal dependency information from all Makefiles; this makes
530532
# the output good for git checkin
531-
cleandeps: $(PERLREQ) tools/syncfiles.pl tools/mkdep.pl
532-
$(RUNPERL) tools/syncfiles.pl Makefile.in Mkfiles/*.mak
533-
$(RUNPERL) tools/mkdep.pl -e -M Makefile.in Mkfiles/*.mak -- \
533+
cleandeps: $(PERLREQ) $(tools)/syncfiles.pl $(tools)/mkdep.pl
534+
$(RUNPERL) $(tools)/syncfiles.pl Makefile.in Mkfiles/*.mak
535+
$(RUNPERL) $(tools)/mkdep.pl -e -M Makefile.in Mkfiles/*.mak -- \
534536
$(DEPDIRS)
535537
$(RM_F) *.dep
536538
if [ -f config.status ]; then \

Mkfiles/msvc.mak

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -153,14 +153,14 @@ PERLREQ = config\unconfig.h \
153153
x86\iflag.c x86\iflaggen.h \
154154
macros\macros.c \
155155
asm\pptok.ph asm\directbl.c asm\directiv.h \
156-
asm\warnings.c include\warnings.h doc\warnings.src \
156+
$(WARNFILES) \
157157
misc\nasmtok.el \
158158
version.h version.mac version.mak nsis\version.nsh
159159

160160
INSDEP = x86\insns.dat x86\insns.pl x86\insns-iflags.ph x86\iflags.ph
161161

162162
config\unconfig.h: config\config.h.in
163-
$(RUNPERL) $(srcdir)\tools\unconfig.pl \
163+
$(RUNPERL) $(tools)\unconfig.pl \
164164
'$(srcdir)' config\config.h.in config\unconfig.h
165165

166166
x86\iflag.c: $(INSDEP)
@@ -232,7 +232,7 @@ x86\regs.h: x86\regs.dat x86\regs.pl
232232
# reasonable, but doesn't update the time stamp if the files aren't
233233
# changed, to avoid rebuilding everything every time. Track the actual
234234
# dependency by the empty file asm\warnings.time.
235-
WARNFILES = asm\warnings.c include\warnings.h doc\warnings.src
235+
WARNFILES = asm\warnings_c.h include\warnings.h doc\warnings.src
236236

237237
warnings:
238238
$(RM_F) $(WARNFILES) $(WARNFILES:=.time)
@@ -242,11 +242,11 @@ asm\warnings.time: $(ALLOBJ_NW:.$(O)=.c)
242242
: > asm\warnings.time
243243
$(MAKE) $(WARNFILES:=.time)
244244

245-
asm\warnings.c.time: asm\warnings.pl asm\warnings.time
246-
$(RUNPERL) $(srcdir)\asm\warnings.pl c asm\warnings.c $(srcdir)
247-
: > asm\warnings.c.time
245+
asm\warnings_c.h.time: asm\warnings.pl asm\warnings.time
246+
$(RUNPERL) $(srcdir)\asm\warnings.pl c asm\warnings_c.h $(srcdir)
247+
: > asm\warnings_c.h.time
248248

249-
asm\warnings.c: asm\warnings.c.time
249+
asm\warnings_c.h: asm\warnings_c.h.time
250250
@: Side effect
251251

252252
include\warnings.h.time: asm\warnings.pl asm\warnings.time

Mkfiles/openwcom.mak

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -166,14 +166,14 @@ PERLREQ = config\unconfig.h &
166166
x86\iflag.c x86\iflaggen.h &
167167
macros\macros.c &
168168
asm\pptok.ph asm\directbl.c asm\directiv.h &
169-
asm\warnings.c include\warnings.h doc\warnings.src &
169+
$(WARNFILES) &
170170
misc\nasmtok.el &
171171
version.h version.mac version.mak nsis\version.nsh
172172

173173
INSDEP = x86\insns.dat x86\insns.pl x86\insns-iflags.ph x86\iflags.ph
174174

175175
config\unconfig.h: config\config.h.in
176-
$(RUNPERL) $(srcdir)\tools\unconfig.pl &
176+
$(RUNPERL) $(tools)\unconfig.pl &
177177
'$(srcdir)' config\config.h.in config\unconfig.h
178178

179179
x86\iflag.c: $(INSDEP)
@@ -245,7 +245,7 @@ x86\regs.h: x86\regs.dat x86\regs.pl
245245
# reasonable, but doesn't update the time stamp if the files aren't
246246
# changed, to avoid rebuilding everything every time. Track the actual
247247
# dependency by the empty file asm\warnings.time.
248-
WARNFILES = asm\warnings.c include\warnings.h doc\warnings.src
248+
WARNFILES = asm\warnings_c.h include\warnings.h doc\warnings.src
249249

250250
warnings:
251251
$(RM_F) $(WARNFILES) $(WARNFILES:=.time)
@@ -255,11 +255,11 @@ asm\warnings.time: $(ALLOBJ_NW:.$(O)=.c)
255255
: > asm\warnings.time
256256
$(MAKE) $(WARNFILES:=.time)
257257

258-
asm\warnings.c.time: asm\warnings.pl asm\warnings.time
259-
$(RUNPERL) $(srcdir)\asm\warnings.pl c asm\warnings.c $(srcdir)
260-
: > asm\warnings.c.time
258+
asm\warnings_c.h.time: asm\warnings.pl asm\warnings.time
259+
$(RUNPERL) $(srcdir)\asm\warnings.pl c asm\warnings_c.h $(srcdir)
260+
: > asm\warnings_c.h.time
261261

262-
asm\warnings.c: asm\warnings.c.time
262+
asm\warnings_c.h: asm\warnings_c.h.time
263263
@: Side effect
264264

265265
include\warnings.h.time: asm\warnings.pl asm\warnings.time

asm/warnings.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
#include "warnings_c.h"

doc/Makefile.in

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ INSTALL = @INSTALL@
2020
INSTALL_PROGRAM = @INSTALL_PROGRAM@
2121
INSTALL_DATA = @INSTALL_DATA@
2222

23-
PERL = perl -I$(srcdir)
23+
PERL = perl -I$(top_srcdir)/perllib -I$(srcdir)
2424

2525
PDFOPT = @PDFOPT@
2626

0 commit comments

Comments
 (0)