aboutsummaryrefslogtreecommitdiff
path: root/Makefile
diff options
context:
space:
mode:
Diffstat (limited to 'Makefile')
-rw-r--r--Makefile24
1 files changed, 21 insertions, 3 deletions
diff --git a/Makefile b/Makefile
index e6d9d5d..4cc9599 100644
--- a/Makefile
+++ b/Makefile
@@ -1,7 +1,25 @@
-SOURCE := $(wildcard chad/*.c extern/*.c)
+CFLAGS := -std=c23 -fPIC
+CPPFLAGS := -Ichad
+SOURCE.orig := $(wildcard extern/*.c)
+SOURCE := $(SOURCE.orig:extern/%=%)
+OBJECT := $(addprefix object/,$(SOURCE:.c=.o))
-so:
- ${CC} -fPIC -shared ${SOURCE} -o object/libchad.so
+vpath %.c extern
+
+object/%.o: %.c
+ @echo "CC $<"
+ @${COMPILE.c} -o $@ $<
+
+.PHONY: all
+all: object/libchad.a object/libchad.so
+
+object/libchad.a: ${OBJECT}
+ @echo "AR $<"
+ @ar rcs $@ $+
+
+object/libchad.so: ${OBJECT}
+ @echo "SO $<"
+ @${CC} ${CFLAGS} ${CPPFLAGS} -shared $+ -o $@
dist:
-mkdir object/chad/ 2> /dev/null