From 2559eb24b6314939dde07d7bed5927cb37929dda Mon Sep 17 00:00:00 2001 From: David Griffith Date: Mon, 15 Jul 2019 02:38:12 -0700 Subject: [PATCH] Avoid race conditions when doing a parallelized buid. If the -jX flag is used to indicate that X CPUs should be used to build Frotz, there is a slight chance that the definitions files: src/common/defs.h, src/curses/ux_defines.h, and src/common/git_hash.h; will not be complete before the build process starts on the rest of the source files. If this happens, the build fails. --- Makefile | 23 ++++++++++++++++------- 1 file changed, 16 insertions(+), 7 deletions(-) diff --git a/Makefile b/Makefile index 1809fa2..5da15b6 100644 --- a/Makefile +++ b/Makefile @@ -30,7 +30,7 @@ CFLAGS += -D_POSIX_C_SOURCE=200809L CFLAGS += -g # This keeps make(1) output understandable when using -j for parallel -# building If your version of make(1) can't do parallel builds, comment +# building. If your version of make(1) can't do parallel builds, comment # this out. MAKEFLAGS += -Orecurse @@ -223,6 +223,7 @@ DOS_BIN = frotz.exe # Build recipes # + curses: $(FROTZ_BIN) ncurses: $(FROTZ_BIN) $(FROTZ_BIN): $(COMMON_LIB) $(CURSES_LIB) $(BLORB_LIB) $(COMMON_LIB) @@ -230,7 +231,7 @@ $(FROTZ_BIN): $(COMMON_LIB) $(CURSES_LIB) $(BLORB_LIB) $(COMMON_LIB) @echo "** Done building Frotz with curses interface" @echo "** Audio support $(CURSES_SOUND)" -nosound: nosound_helper $(FROTZ_BIN) +nosound: nosound_helper $(FROTZ_BIN) | nosound_helper nosound_helper: $(eval NOSOUND= -DNO_SOUND) $(eval CURSES_SOUND_LDFLAGS= ) @@ -262,11 +263,19 @@ dumb_lib: $(DUMB_LIB) blorb_lib: $(BLORB_LIB) dos_lib: $(DOS_LIB) -$(COMMON_LIB): $(COMMON_DEFINES) $(COMMON_STRINGS) $(HASH) $(COMMON_DIR); -$(CURSES_LIB): $(HASH) $(COMMON_DEFINES) $(CURSES_DEFINES) $(CURSES_DIR); -$(SDL_LIB): $(HASH) $(COMMON_DEFINES) $(SDL_DIR); -$(DUMB_LIB): $(HASH) $(COMMON_DEFINES) $(DUMB_DIR); -$(BLORB_LIB): $(BLORB_DIR); +$(COMMON_LIB): $(COMMON_DEFINES) $(COMMON_STRINGS) $(HASH) + $(MAKE) -C $(COMMON_DIR) + +$(CURSES_LIB): $(COMMON_DEFINES) $(CURSES_DEFINES) $(HASH) + $(MAKE) -C $(CURSES_DIR) + +$(SDL_LIB): $(COMMON_DEFINES) $(HASH) + $(MAKE) -C $(SDL_DIR) + +$(DUMB_LIB): $(COMMON_DEFINES) $(HASH) + $(MAKE) -C $(DUMB_DIR) + +$(BLORB_LIB): $(BLORB_DIR) $(SUBDIRS): $(MAKE) -C $@ -- 2.34.1