From 2b39c39421648cdd65987934e5432d5a12d097b0 Mon Sep 17 00:00:00 2001 From: Emil Williams Date: Wed, 18 Feb 2026 00:56:45 +0000 Subject: should work without peru --- Makefile | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'Makefile') diff --git a/Makefile b/Makefile index e6d9d5d..b07c89c 100644 --- a/Makefile +++ b/Makefile @@ -1,7 +1,8 @@ +CFLAGS := -std=c23 SOURCE := $(wildcard chad/*.c extern/*.c) so: - ${CC} -fPIC -shared ${SOURCE} -o object/libchad.so + ${CC} ${CFLAGS} -fPIC -shared ${SOURCE} -o object/libchad.so dist: -mkdir object/chad/ 2> /dev/null -- cgit v1.2.3 From 8035daa04137c5412050a2f30e6748db256a576b Mon Sep 17 00:00:00 2001 From: Emil Williams Date: Wed, 18 Feb 2026 01:24:57 +0000 Subject: better Makefile --- Makefile | 25 +++++++++++++++++++++---- test/.gitignore | 1 + test/test.c | 2 +- 3 files changed, 23 insertions(+), 5 deletions(-) create mode 100644 test/.gitignore (limited to 'Makefile') diff --git a/Makefile b/Makefile index b07c89c..4cc9599 100644 --- a/Makefile +++ b/Makefile @@ -1,8 +1,25 @@ -CFLAGS := -std=c23 -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} ${CFLAGS} -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 diff --git a/test/.gitignore b/test/.gitignore new file mode 100644 index 0000000..9daeafb --- /dev/null +++ b/test/.gitignore @@ -0,0 +1 @@ +test diff --git a/test/test.c b/test/test.c index 8dd4996..4f9df76 100644 --- a/test/test.c +++ b/test/test.c @@ -1,4 +1,4 @@ -// @BAKE @CC -std=c23 ../object/libchad.so +// @BAKE @CC -std=c23 ../object/libchad.a #include "../chad.h" int main () { dictate ( "cogito ergo sum\n" ); -- cgit v1.2.3