From 7e2351011132de3d81cf42f6729ed6594b179da1 Mon Sep 17 00:00:00 2001 From: Giuseppe Bilotta Date: Tue, 21 Oct 2025 10:21:02 +0200 Subject: [PATCH 1/3] inform7.mkscript: fix typo The rule to generate Tangled/Syntax.preform was invalid. --- inform7/inform7.mkscript | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/inform7/inform7.mkscript b/inform7/inform7.mkscript index 336de5d69..fc1497030 100644 --- a/inform7/inform7.mkscript +++ b/inform7/inform7.mkscript @@ -42,7 +42,7 @@ preform: $(ME)/Tangled/Syntax.preform $(ME)/Tangled/$(MYNAME): {dependent-files} $(call make-me) -$(ME)/TangledSyntax.preform: +$(ME)/Tangled/Syntax.preform: $(call make-me) .PHONY: force From deb81f919ba33de099a6c5d0862338f51aee6919 Mon Sep 17 00:00:00 2001 From: Giuseppe Bilotta Date: Tue, 21 Oct 2025 11:55:57 +0200 Subject: [PATCH 2/3] Fix inform7_clib build instructions When tangling inter directly, the inform7_clib.{c,h} files end up in the inter directory rather than under the inform7 directory. Copy them to the expected place after tangling. While we're at it, make the inter subset tangling its own target, to ensure that it's only run once during parallel builds. --- scripts/inform.mkscript | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/scripts/inform.mkscript b/scripts/inform.mkscript index 3418f836c..08c697d4a 100644 --- a/scripts/inform.mkscript +++ b/scripts/inform.mkscript @@ -202,13 +202,19 @@ $(INFORM7WEB)/Internal/Miscellany/inform7_clib.c: $(INFORM7WEB)/Tangled/inform7_ cp -f "$(INFORM7WEB)/Tangled/inform7_clib.c" "$(INFORM7WEB)/Internal/Miscellany/inform7_clib.c" # It is in fact sufficient to tangle just the inter subset of inform7 to make -# the two C-library files: +# the two C-library files: of course they then need to be copied into the inform7 directory. +# Note the use of the phony intermediate tangleintersubset target to ensure that +# the tangle is only run once even when both files are needed. -$(INFORM7WEB)/Tangled/inform7_clib.h: inter/final-module/Chapter\ 5/*.w +.PHONY: tangleintersubset +tangleintersubset: inter/final-module/Chapter\ 5/*.w $(INWEBX) tangle $(INTERWEB) -$(INFORM7WEB)/Tangled/inform7_clib.c: inter/final-module/Chapter\ 5/*.w - $(INWEBX) tangle $(INTERWEB) +$(INFORM7WEB)/Tangled/inform7_clib.h: tangleintersubset + cp -f "$(INTERWEB)/Tangled/inform7_clib.h" "$(INFORM7WEB)/Tangled/inform7_clib.h" + +$(INFORM7WEB)/Tangled/inform7_clib.c: tangleintersubset + cp -f "$(INTERWEB)/Tangled/inform7_clib.c" "$(INFORM7WEB)/Tangled/inform7_clib.c" # ----------------------------------------------------------------------------- # Target "makers" From 9f4661b5cdedb8f3ec1d7aa930b8bcf3594deff3 Mon Sep 17 00:00:00 2001 From: Giuseppe Bilotta Date: Tue, 21 Oct 2025 12:29:56 +0200 Subject: [PATCH 3/3] Robustness for parallel builds When the environment variable MAKEFLAGS contains -j or similar parallel building flag, a clean build (scripts/first.sh from a fresh checkout) will lead to errors such as (Step 3 of 4: building the tools) make -f inblorb/inblorb.mk force inbuild/Tangled/inbuild -rebuild -contents-of inform7/Internal/Extensions/Graham\ Nelson/Standard\ Rules.i7xd/Materials/Inter make: inbuild/Tangled/inbuild: No such file or directory make: *** No rule to make target 'inform7/Tangled/Syntax.preform', needed by 'inform7/Internal/Extensions/Graham Nelson/English Language.i7xd/Materials/Languages/English/Syntax.preform'. Stop. make: *** Waiting for unfinished jobs.... make: *** [makefile:331: forcekits] Error 127 and others. This is due to the 'force' build trying to build forcetools, forcekits and localintegration in parallel, even though there is actually a strict dependency between them that is not fully described by the makefile rules. This patch introduces two changes to avoid this issue. First of all, we introduce the .WAIT dependency before localintegration in the 'all' and 'force' targets. This implicitly-defined phony dependency is used by GNU Make to indicate that the dependencies on the right must wait for the dependencies on the left to finish. Secondly, the kits and forcekits targets now depend on the tools used to build the kits (i.e. Inbuild and inter). For the forcekits target, this requires the introduction of force_* variants for the tools, that were previously built using a single target. As a bonus, this allows the tools themselves to now be built in parallel even during a force build. Similar changes can be implemented for other targets that currently build multiple files serially, but this will be left to later commits. --- scripts/inform.mkscript | 31 +++++++++++++++++++++++-------- 1 file changed, 23 insertions(+), 8 deletions(-) diff --git a/scripts/inform.mkscript b/scripts/inform.mkscript index 08c697d4a..f45d09466 100644 --- a/scripts/inform.mkscript +++ b/scripts/inform.mkscript @@ -165,12 +165,15 @@ INFORM6WEB = inform6 # one of these performs a "make integration", to push the results of our efforts # into a surrounding GUI app (if it is present) - that must be done (if desired) # by "make integration" explicitly. +# Note the use of .WAIT to ensure order during parallel builds. +# This is necessary because localintegration depends on the preform grammar +# generated when building inform7. .PHONY: all -all: tools kits localintegration +all: tools kits .WAIT localintegration .PHONY: force -force: forcetools forcekits localintegration +force: forcetools forcekits .WAIT localintegration # ----------------------------------------------------------------------------- # Target "localintegration" @@ -267,15 +270,16 @@ versions: # ----------------------------------------------------------------------------- # These are easier because Inbuild already performs a make-like service on # directories of kits; that saves a great deal of messy make code here. +# We do depend on $(INBUILDX) and $(INTERX) to avoid errors during parallel builds .PHONY: kits -kits: +kits: $(INBUILDX) $(INTERX) $(INBUILDX) -build -contents-of $(INFORM7WEB)/Internal/Extensions/Graham\ Nelson/Standard\ Rules.i7xd/Materials/Inter $(INBUILDX) -build -contents-of $(INFORM7WEB)/Internal/Extensions/Graham\ Nelson/Basic\ Inform.i7xd/Materials/Inter $(INBUILDX) -build -contents-of $(INFORM7WEB)/Internal/Extensions/Graham\ Nelson/English\ Language.i7xd/Materials/Inter .PHONY: forcekits -forcekits: +forcekits: force_$(INBUILDX) force_$(INTERX) $(INBUILDX) -rebuild -contents-of $(INFORM7WEB)/Internal/Extensions/Graham\ Nelson/Standard\ Rules.i7xd/Materials/Inter $(INBUILDX) -rebuild -contents-of $(INFORM7WEB)/Internal/Extensions/Graham\ Nelson/Basic\ Inform.i7xd/Materials/Inter $(INBUILDX) -rebuild -contents-of $(INFORM7WEB)/Internal/Extensions/Graham\ Nelson/English\ Language.i7xd/Materials/Inter @@ -303,13 +307,24 @@ $(INFORM6X): $(INFORM6WEB)/Inform6/*.c # ----------------------------------------------------------------------------- # Target "forcetools" # ----------------------------------------------------------------------------- -# Similarly, but with a single target, since nothing is incremental here. +# Similarly, but the targets are called force_$(INBLORBX), force_$(INBUILDX) etc. +# This could be done with a single target, since nothing is incremental here, +# but using multiple targets improves parallel building. .PHONY: forcetools -forcetools: - {components type: tool} +forcetools: {components type: tool}force_$({SYMBOL}X) {end-components}force_$(INFORM6X) + +{components type: tool} +.PHONY: force_$({SYMBOL}X) +force_$({SYMBOL}X): $(MAKE) -f $({SYMBOL}MAKER) force - {end-components} + +{end-components} + +# As ever, Inform 6 needs special handling: + +.PHONY: force_$(INFORM6X) +force_$(INFORM6X): $(MAKE) -f $(INFORM6WEB)/inform6.mk force # -----------------------------------------------------------------------------