From 2d7a8c3c571bcc5335437e9db074c75af00408ce Mon Sep 17 00:00:00 2001
From: James R <justsomejames2@gmail.com>
Date: Mon, 21 Jun 2021 14:47:42 -0700
Subject: [PATCH] Makefile: use shell commands to read in Sourcefile

File function is not supported < Make 4.2.
---
 src/Makefile               | 11 ++++++-----
 src/Makefile.d/platform.mk |  2 ++
 src/Makefile.d/util.mk     |  3 ++-
 3 files changed, 10 insertions(+), 6 deletions(-)

diff --git a/src/Makefile b/src/Makefile
index 18ab524b8e..7104a91cff 100644
--- a/src/Makefile
+++ b/src/Makefile
@@ -176,11 +176,7 @@ include Makefile.d/detect.mk
 # make would try to remove the implicitly made directories
 .PRECIOUS : %/ comptime.c
 
-# very sophisticated dependency
-sources:=\
-	$(call List,Sourcefile)\
-	$(call List,blua/Sourcefile)\
-
+sources:=
 makedir:=../make
 
 # -DCOMPVERSION: flag to use comptime.h
@@ -204,6 +200,11 @@ endif
 depdir:=$(makedir)/deps
 objdir:=$(makedir)/objs
 
+# very sophisticated dependency
+sources+=\
+	$(call List,Sourcefile)\
+	$(call List,blua/Sourcefile)\
+
 depends:=$(basename $(filter %.c %.s,$(sources)))
 objects:=$(basename $(filter %.c %.s %.nas,$(sources)))
 
diff --git a/src/Makefile.d/platform.mk b/src/Makefile.d/platform.mk
index 531d073e91..fad4be1916 100644
--- a/src/Makefile.d/platform.mk
+++ b/src/Makefile.d/platform.mk
@@ -7,9 +7,11 @@ PKG_CONFIG?=pkg-config
 ifdef WINDOWSHELL
 rmrf=-2>NUL DEL /S /Q
 mkdir=-2>NUL MD
+cat=TYPE
 else
 rmrf=rm -rf
 mkdir=mkdir -p
+cat=cat
 endif
 
 ifdef LINUX64
diff --git a/src/Makefile.d/util.mk b/src/Makefile.d/util.mk
index e76e324224..bda68df13a 100644
--- a/src/Makefile.d/util.mk
+++ b/src/Makefile.d/util.mk
@@ -10,7 +10,8 @@ Wildvar=$(foreach v,$(filter $(1),$(.VARIABLES)),$($(v)))
 
 # Read a list of words from file and prepend each with the
 # directory of the file.
-List=$(addprefix $(dir $(1)),$(file < $(1)))
+_cat=$(shell $(cat) $(call Windows_path,$(1)))
+List=$(addprefix $(dir $(1)),$(call _cat,$(1)))
 
 # Convert path separators to backslash on Windows.
 Windows_path=$(if $(WINDOWSHELL),$(subst /,\,$(1)),$(1))
-- 
GitLab