From 51e8ffe08086132ebd3e1e4b5a65b20834332f0c Mon Sep 17 00:00:00 2001 From: Charles Date: Thu, 25 Sep 2025 15:10:44 -0400 Subject: [PATCH 1/2] Add an option to build a static library --- Makefile | 3 +++ 1 file changed, 3 insertions(+) diff --git a/Makefile b/Makefile index f33f88ea..c6d6db87 100644 --- a/Makefile +++ b/Makefile @@ -110,6 +110,9 @@ CPPFLAGS += \ -DCONFIG_STATS=$(CONFIG_STATS) \ -DCONFIG_SELF_INIT=$(CONFIG_SELF_INIT) +$(OUT)/libhardened_malloc$(SUFFIX).a: $(OBJECTS) | $(OUT) + ar rcs $@ $^ + $(OUT)/libhardened_malloc$(SUFFIX).so: $(OBJECTS) | $(OUT) $(CC) $(CFLAGS) $(LDFLAGS) -shared $^ $(LDLIBS) -o $@ From 45487891f1712c2ab93cd9fbb2213f843c6fa9e0 Mon Sep 17 00:00:00 2001 From: Charles Date: Thu, 25 Sep 2025 15:24:40 -0400 Subject: [PATCH 2/2] Also remove static library when cleaning --- Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Makefile b/Makefile index c6d6db87..be5d1ed0 100644 --- a/Makefile +++ b/Makefile @@ -141,7 +141,7 @@ tidy: clang-tidy --extra-arg=-std=c++17 $(filter %.cc,$(SOURCES)) -- $(CPPFLAGS) clean: - rm -f $(OUT)/libhardened_malloc.so $(OBJECTS) + rm -f $(OUT)/libhardened_malloc.so $(OUT)/libhardened_malloc.a $(OBJECTS) $(MAKE) -C test/ clean test: $(OUT)/libhardened_malloc$(SUFFIX).so