From 4af9b2a86ad5f5b7e59ba882aa527ecead75be0e Mon Sep 17 00:00:00 2001 From: Mosder Date: Wed, 16 Sep 2026 17:14:45 +0200 Subject: fix: fixed macro error in Makefile (also added cleanup to static and shared targets) --- Makefile | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/Makefile b/Makefile index 989edcb..d9775c1 100644 --- a/Makefile +++ b/Makefile @@ -14,22 +14,26 @@ INC_DIR=$(TARGET_PREFIX)/include INC_SUDO:=$(shell test -w $(INC_DIR) || echo sudo) CFLAGS=-std=c99 -Wall -Wextra -Wpedantic -fPIC -I./include -O2 -c -SRCS:=$(shell find src | grep \\.c$) +SRCS:=$(shell find src | grep "\.c$$") +CLEANUP=$(MAKE) clean TESTS_CFLAGS=-std=c99 -Wall -Wextra -Wpedantic -I$(INC_DIR) -Og -ggdb -c TESTS_LDFLAGS=-L$(LIB_DIR) -Wl,-rpath,$(LIB_DIR) -lmoslib -TESTS_SRCS:=$(shell find tests | grep \\.c$) +TESTS_SRCS:=$(shell find tests | grep "\.c$$") +both: CLEANUP=true both: clean shared static - $(MAKE) clean + @$(MAKE) clean shared: clean compile headers $(LIB_SUDO) $(CC) -shared *.o -o $(LIB_DIR)/libmoslib.so $(LIB_SUDO) strip -x $(LIB_DIR)/libmoslib.so + @$(CLEANUP) static: clean compile headers $(LIB_SUDO) $(AR) $(LIB_DIR)/libmoslib.a *.o $(LIB_SUDO) strip -S $(LIB_DIR)/libmoslib.a + @$(CLEANUP) headers: $(INC_SUDO) cp -r include/* $(INC_DIR) @@ -41,7 +45,7 @@ test: clean $(CC) $(TESTS_CFLAGS) $(TESTS_SRCS) $(CC) $(TESTS_LDFLAGS) *.o -o run_tests ./run_tests - $(MAKE) clean + @$(MAKE) clean clean: rm *.o run_tests 2>/dev/null || true -- cgit v1.2.3