wingo pushed a commit to branch main
in repository guile.

commit 23c4e36dcaa7f0758023ad58208dcf645bedef2f
Author: Ekaitz Zarraga <eka...@elenq.tech>
AuthorDate: Thu May 13 17:52:28 2021 +0200

    Makefile: RISCV support and optional vars
    
    Optional variables are needed because the structure of the makefile
    is prepared to run on Guix but Guix doesn't support RISCV yet, so it's
    better to set them as optional and let the user decide how do they want
    to compile this thing.
---
 tests/Makefile | 17 +++++++++++------
 1 file changed, 11 insertions(+), 6 deletions(-)

diff --git a/tests/Makefile b/tests/Makefile
index 769b43423..5c44bceae 100644
--- a/tests/Makefile
+++ b/tests/Makefile
@@ -1,5 +1,5 @@
-TESTS=$(sort $(basename $(wildcard *.c)))
-TARGETS ?= native ia32 aarch64 armv7
+TESTS ?= $(sort $(basename $(wildcard *.c)))
+TARGETS ?= native ia32 aarch64 armv7 riscv
 
 # Suitable values of cross-compiler variables for Debian:
 #
@@ -17,10 +17,11 @@ TARGETS ?= native ia32 aarch64 armv7
 #     gcc-aarch64-linux-gnu libc6-dev-arm64-cross libc6:arm64
 #
 CC = gcc
-CC_IA32=guix environment --pure -s i686-linux --ad-hoc gcc-toolchain -- gcc
-CC_AARCH64=guix environment --pure -s aarch64-linux --ad-hoc gcc-toolchain -- 
gcc
-CC_ARMv7=guix environment --pure -s armhf-linux --ad-hoc gcc-toolchain -- gcc
-CFLAGS = -Wall -O0 -g
+CC_IA32 ?= guix environment --pure -s i686-linux --ad-hoc gcc-toolchain -- gcc
+CC_AARCH64 ?= guix environment --pure -s aarch64-linux --ad-hoc gcc-toolchain 
-- gcc
+CC_ARMv7 ?= guix environment --pure -s armhf-linux --ad-hoc gcc-toolchain -- 
gcc
+CC_RISCV ?= guix environment --pure -s riscv64-linux --ad-hoc gcc-toolchain -- 
gcc
+CFLAGS ?= -Wall -O0 -g
 
 all: $(foreach TARGET,$(TARGETS),$(addprefix test-$(TARGET)-,$(TESTS)))
 
@@ -54,6 +55,10 @@ test-armv7-%: CC = $(CC_ARMv7)
 test-armv7-%: %.c lightening-armv7.o test.h
        $(CC) $(CFLAGS) $(CPPFLAGS) -I.. -o $@ lightening-armv7.o $<
 
+test-riscv-%: CC = $(CC_RISCV)
+test-riscv-%: %.c lightening-riscv.o test.h
+       $(CC) $(CFLAGS) $(CPPFLAGS) -I.. -o $@ lightening-riscv.o $<
+
 .PRECIOUS: $(foreach TARGET,$(TARGETS),$(addprefix test-$(TARGET)-,$(TESTS)))
 .PRECIOUS: $(foreach TARGET,$(TARGETS),lightening-$(TARGET).o)
 

Reply via email to