From fe0206ef55219829969b39a77b5e7d4de91935e4 Mon Sep 17 00:00:00 2001 From: Guokai Chen Date: Wed, 20 Apr 2022 13:31:02 +0800 Subject: [PATCH] fix CROSS_COMPILE on non-ELF systems --- Makefile.compile | 1 + Makefile.lib | 4 +++- 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/Makefile.compile b/Makefile.compile index fd3f706c..3d9d6067 100644 --- a/Makefile.compile +++ b/Makefile.compile @@ -5,6 +5,7 @@ AS = $(CROSS_COMPILE)gcc CC = $(CROSS_COMPILE)gcc CXX = $(CROSS_COMPILE)g++ LD = $(CROSS_COMPILE)ld +AR = $(CROSS_COMPILE)ar OBJDUMP = $(CROSS_COMPILE)objdump OBJCOPY = $(CROSS_COMPILE)objcopy READELF = $(CROSS_COMPILE)readelf diff --git a/Makefile.lib b/Makefile.lib index 0e57035a..bf5e8d70 100644 --- a/Makefile.lib +++ b/Makefile.lib @@ -15,10 +15,12 @@ CFLAGS += -fdata-sections -ffunction-sections -fno-builtin ## Paste in "Makefile.compile" here include $(AM_HOME)/Makefile.compile +AR = $(CROSS_COMPILE)ar + ## Compliation rule for objects -> .a (using ar) $(ARCHIVE): $(OBJS) @echo + AR "->" $(shell realpath $@ --relative-to .) - @ar rcs $(ARCHIVE) $(OBJS) + @$(AR) rcs $(ARCHIVE) $(OBJS) clean: rm -rf $(LIB_DIR)/build/