From 8840f9fe4825e5ad30e54477bfffc1c6750e3d61 Mon Sep 17 00:00:00 2001
From: Mark Poliakov <mark@alnyan.me>
Date: Wed, 13 Nov 2024 16:17:30 +0200
Subject: [PATCH 1/4] alnyan/yggdrasil: force cross-compilation for clang

---
 Make.inc | 7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)

diff --git a/Make.inc b/Make.inc
index df8fbf0..35eda23 100644
--- a/Make.inc
+++ b/Make.inc
@@ -47,7 +47,7 @@ AR := $(TOOLPREFIX)ar
 
 ifeq ($(USECLANG),1)
 USEGCC ?= 0
-CC = clang
+CC ?= clang
 CFLAGS_add += -fno-builtin -fno-strict-aliasing
 endif
 
@@ -144,6 +144,9 @@ ifeq ($(ARCH),wasm32)
 CFLAGS_arch += -ffreestanding -nostdlib -nostdinc --target=wasm32-unknown-unknown
 endif
 
+LDFLAGS_arch += --sysroot=$(SYSROOT) --target=$(TRIPLE)
+CFLAGS_arch += --target=$(TRIPLE) -ffreestanding
+
 # Add our "arch"-related FLAGS in.  We separate arch-related flags out so that
 # we can conveniently get at them for targets that don't want the rest of
 # *FLAGS_add, such as the testing Makefile targets
@@ -163,7 +166,7 @@ endif
 ifneq ($(filter $(ARCH),i387 amd64),)
 # Determines whether `long double` is the same as `double` on this arch.
 # linux x86_64, for instance, `long double` is 80 bits wide, whereas on macOS aarch64,
-# `long double` is the same as `double`. 
+# `long double` is the same as `double`.
 LONG_DOUBLE_NOT_DOUBLE := 1
 else ifeq ($(ARCH), aarch64 riscv64)
 ifeq ($(filter $(OS),Darwin WINNT),)
-- 
2.48.1

