From d7d4343efc95ad1180cc480183b9edcbd2db168b Mon Sep 17 00:00:00 2001 From: Charles Date: Thu, 25 Sep 2025 15:10:44 -0400 Subject: [PATCH 1/3] 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 078a36f5f722325bd9ca0732b139376f3e55935d Mon Sep 17 00:00:00 2001 From: Charles Date: Thu, 25 Sep 2025 15:24:40 -0400 Subject: [PATCH 2/3] 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 From 705d2d8dbcf4b65b5e3d5dc821f425c9a9da6a51 Mon Sep 17 00:00:00 2001 From: Charles Date: Wed, 29 Oct 2025 13:44:26 -0400 Subject: [PATCH 3/3] Use $(AR) --- Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Makefile b/Makefile index be5d1ed0..9b19ed9b 100644 --- a/Makefile +++ b/Makefile @@ -111,7 +111,7 @@ CPPFLAGS += \ -DCONFIG_SELF_INIT=$(CONFIG_SELF_INIT) $(OUT)/libhardened_malloc$(SUFFIX).a: $(OBJECTS) | $(OUT) - ar rcs $@ $^ + $(AR) rcs $@ $^ $(OUT)/libhardened_malloc$(SUFFIX).so: $(OBJECTS) | $(OUT) $(CC) $(CFLAGS) $(LDFLAGS) -shared $^ $(LDLIBS) -o $@