From 13921602809a37405e21bec260f24ac8fc76bfcb Mon Sep 17 00:00:00 2001 From: Rafael Sene Date: Mon, 19 Feb 2024 11:02:38 -0800 Subject: [PATCH] This change introduces a new variable, ENABLE_STATIC, to the build process, allowing the simulators to be compiled statically. This provides the flexibility to generate standalone simulators that are not dependent on shared libraries at runtime, which can be particularly beneficial for deployment in environments where managing dynamic libraries is challenging or for distributing simulators more easily. --- Makefile | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/Makefile b/Makefile index 255224125..9f4295f69 100644 --- a/Makefile +++ b/Makefile @@ -157,6 +157,11 @@ ZLIB_FLAGS = $(shell pkg-config --cflags zlib) ZLIB_LIBS = $(shell pkg-config --libs zlib) C_FLAGS = -I $(SAIL_LIB_DIR) -I c_emulator $(GMP_FLAGS) $(ZLIB_FLAGS) $(SOFTFLOAT_FLAGS) +# Conditional check for ENABLE_STATIC=1 +ifneq (,$(ENABLE_STATIC)) + # If ENABLE_STATIC is set, append specific static linking flags + C_FLAGS += -static -Wl,--as-needed -Wl,-O1 +endif C_LIBS = $(GMP_LIBS) $(ZLIB_LIBS) $(SOFTFLOAT_LIBS) # The C simulator can be built to be linked against Spike for tandem-verification.