From d596255dbe558145c535740db62f1b84d95df4a4 Mon Sep 17 00:00:00 2001 From: Ekaitz Zarraga Date: Thu, 13 May 2021 17:52:28 +0200 Subject: [PATCH] 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)