fix #H4286 - race condition during Unix build

Update sys/unix/Makefile.src to force it to build monst.o and
objects.o before attempting to build makedefs, so that building
the latter doesn't use the rules for those two object files in
Makefile.utl.  Prior to this, if 'make' was building multiple
targets in parallel monst.o and/or objects.o might be clobbered
when a process using util/Makefile tries to build them while its
parent is also building them via src/Makefile.

This includes a bit of reformatting which wasn't present in
yesterday's email attachment.
This commit is contained in:
PatR
2016-03-27 16:50:38 -07:00
parent d6fa06f8e8
commit 105fd0a9a2

View File

@@ -1,5 +1,5 @@
# NetHack Makefile.
# NetHack 3.6 Makefile.src $NHDT-Date: 1447313972 2015/11/12 07:39:32 $ $NHDT-Branch: master $:$NHDT-Revision: 1.45 $
# NetHack 3.6 Makefile.src $NHDT-Date: 1459122529 2016/03/27 23:48:49 $ $NHDT-Branch: NetHack-3.6.0 $:$NHDT-Revision: 1.46 $
# Root of source tree:
NHSROOT=..
@@ -357,9 +357,9 @@ WINCSRC = $(WINTTYSRC) $(WINX11SRC) $(WINGNOMESRC) $(WINGEMSRC)
WINCXXSRC = $(WINQTSRC) $(WINBESRC)
# Files for window system chaining. Requires SYSCF; include via HINTSRC/HINTOBJ
CHAINSRC=../win/chain/wc_chainin.c ../win/chain/wc_chainout.c \
../win/chain/wc_trace.c
CHAINOBJ=wc_chainin.o wc_chainout.o wc_trace.o
CHAINSRC = ../win/chain/wc_chainin.c ../win/chain/wc_chainout.c \
../win/chain/wc_trace.c
CHAINOBJ = wc_chainin.o wc_chainout.o wc_trace.o
# .c files for this version (for date.h)
VERSOURCES = $(HACKCSRC) $(SYSSRC) $(WINSRC) $(CHAINSRC) $(GENCSRC)
@@ -378,9 +378,9 @@ HACKINCL = align.h amiconf.h artifact.h artilist.h attrib.h beconf.h botl.h \
global.h hack.h lev.h lint.h macconf.h mextra.h mfndpos.h micro.h \
mkroom.h \
monattk.h mondata.h monflag.h monst.h monsym.h obj.h objclass.h \
os2conf.h patchlevel.h pcconf.h permonst.h prop.h rect.h region.h rm.h \
sp_lev.h spell.h sys.h system.h tcap.h timeout.h tosconf.h tradstdc.h \
trampoli.h trap.h unixconf.h vision.h vmsconf.h wintty.h \
os2conf.h patchlevel.h pcconf.h permonst.h prop.h rect.h region.h \
rm.h sp_lev.h spell.h sys.h system.h tcap.h timeout.h tosconf.h \
tradstdc.h trampoli.h trap.h unixconf.h vision.h vmsconf.h wintty.h \
winX.h winprocs.h wintype.h you.h youprop.h
HSOURCES = $(HACKINCL) date.h onames.h pm.h vis_tab.h\
@@ -490,23 +490,31 @@ qt_win.moc: ../include/qt_win.h
qttableview.moc: ../include/qttableview.h
$(QTDIR)/bin/moc -o qttableview.moc ../include/qttableview.h
$(MAKEDEFS): ../util/makedefs.c $(CONFIG_H) ../include/permonst.h \
# build monst.o and objects.o before executing '$(MAKE) makedefs'
$(MAKEDEFS): $(FIRSTOBJ) \
../util/makedefs.c $(CONFIG_H) ../include/permonst.h \
../include/objclass.h ../include/monsym.h \
../include/artilist.h ../include/dungeon.h ../include/obj.h \
../include/monst.h ../include/you.h ../include/flag.h \
../include/dlb.h ../include/patchlevel.h ../include/qtext.h
@( cd ../util ; $(MAKE) makedefs)
@( cd ../util ; $(MAKE) makedefs )
# Source files created by 'makedefs' at build time.
# Each is given an artificial dependency upon the one before
# so that parallel makes will have to build them sequentially and
# not clobber makedefs by attempting simultaneous builds of it.
../include/onames.h: $(MAKEDEFS)
@( cd ../util ; $(MAKE) ../include/onames.h )
../include/pm.h: $(MAKEDEFS)
../include/pm.h: $(MAKEDEFS) ../include/onames.h
@( cd ../util ; $(MAKE) ../include/pm.h )
monstr.c: $(MAKEDEFS)
monstr.c: $(MAKEDEFS) ../include/pm.h
@( cd ../util ; $(MAKE) ../src/monstr.c )
../include/vis_tab.h: $(MAKEDEFS)
../include/vis_tab.h: $(MAKEDEFS) monstr.c
@( cd ../util ; $(MAKE) ../include/vis_tab.h )
# makedefs -z makes both vis_tab.h and vis_tab.c, but writes the .h first
vis_tab.c: ../include/vis_tab.h
# Created at build time for configurations which support tiles,
# but not by makedefs so not connected to the others.
tile.c: ../win/share/tilemap.c $(HACK_H)
@( cd ../util ; $(MAKE) ../src/tile.c )