diff options
| -rw-r--r-- | Makefile | 25 | ||||
| -rw-r--r-- | test/.gitignore | 1 | ||||
| -rw-r--r-- | test/test.c | 2 |
3 files changed, 23 insertions, 5 deletions
@@ -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" ); |
