From c90a5c7e2d14670099effd821dce71de1c41a312 Mon Sep 17 00:00:00 2001
From: Amitesh Singh <singh.amitesh@gmail.com>
Date: Thu, 21 Dec 2023 15:33:39 +0530
Subject: [PATCH] fix compilation for arch linux

on arch linux, the risc compiler name is different.
Add some logic to pick correct risc compiler on arch linux

Signed-off-by: Amitesh Singh <singh.amitesh@gmail.com>
---
 ch32v003fun/ch32v003fun.mk | 11 +++++++++--
 1 file changed, 9 insertions(+), 2 deletions(-)

diff --git a/ch32v003fun/ch32v003fun.mk b/ch32v003fun/ch32v003fun.mk
index f3c6a7c..e44254c 100644
--- a/ch32v003fun/ch32v003fun.mk
+++ b/ch32v003fun/ch32v003fun.mk
@@ -1,5 +1,12 @@
-
-PREFIX?=riscv64-unknown-elf
+ifeq ($(OS),Windows_NT)
+    PREFIX?=riscv64-unknown-elf
+else
+    ifeq (, $(shell which riscv64-unknown-elf-gcc))
+        PREFIX?=riscv64-elf
+    else
+        PREFIX?=riscv64-unknown-elf
+    endif
+endif
 
 CH32V003FUN?=../../ch32v003fun
 MINICHLINK?=$(CH32V003FUN)/../minichlink
-- 
GitLab