From 7982070eecf514da2eaa0892537edc4bd2b17cfc Mon Sep 17 00:00:00 2001
From: Kaz Kylheku <kaz@kylheku.com>
Date: Fri, 5 Jan 2024 19:02:28 -0800
Subject: build: wrong build order of STDLIB_EARLY_TLOS.

The STDLIB_EARLY_TLOS are not being built in the intended
order for several reasons. Firstly, the list is built by
filtering STDLIB_TLOS which are in an order pulled by the
wildcard command. Secondly, the order-only rule isn't
preserving the order among the early tlos, only ensuring
that those members of STDLIB_TLOS which occur in
STDLIB_EARLY_TLOS are built before the others.

* Makefile (STDLIB_EARLY_PATS): Variable removed.
(STDLIB_EARLY_TLOS): Specified directly rather than via
filtering.
(all): Don't depend on $(STDLIB_TLOS) but rather on
$(STDLIB_EARLY_TLOS) and $(STDLIB_LATE_TLOS) in that order.
($(STDLIB_LATE_TLOS):): Ordering rule removed.
---
 Makefile | 7 ++-----
 1 file changed, 2 insertions(+), 5 deletions(-)

diff --git a/Makefile b/Makefile
index e3f40c99..005857d3 100644
--- a/Makefile
+++ b/Makefile
@@ -72,8 +72,7 @@ EXTRA_OBJS-$(add_win_res) += win/txr.res
 STDLIB_SRCS := $(wildcard stdlib/*.tl)
 STDLIB_TLOS := $(patsubst %.tl,%.tlo,$(STDLIB_SRCS))
 
-STDLIB_EARLY_PATS := %/optimize.tlo %/param.tlo %/compiler.tlo %/asm.tlo
-STDLIB_EARLY_TLOS := $(filter $(STDLIB_EARLY_PATS),$(STDLIB_TLOS))
+STDLIB_EARLY_TLOS := $(addprefix stdlib/,optimize.tlo param.tlo compiler.tlo asm.tlo)
 STDLIB_LATE_TLOS := $(filter-out $(STDLIB_EARLY_TLOS),$(STDLIB_TLOS))
 
 ifneq ($(have_git),)
@@ -217,9 +216,7 @@ endif
 
 .PHONY: all
 
-all: $(BUILD_TARGETS) $(STDLIB_TLOS)
-
-$(STDLIB_LATE_TLOS): | $(STDLIB_EARLY_TLOS)
+all: $(BUILD_TARGETS) $(STDLIB_EARLY_TLOS) $(STDLIB_LATE_TLOS)
 
 $(PROG): $(OPT_OBJS) $(EXTRA_OBJS-y)
 	$(call LINK_PROG,$(OPT_FLAGS))
-- 
cgit v1.2.3