aboutsummaryrefslogtreecommitdiff
path: root/Makefile
diff options
context:
space:
mode:
Diffstat (limited to 'Makefile')
-rw-r--r--Makefile12
1 files 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