aboutsummaryrefslogtreecommitdiffstats
path: root/Makefile
diff options
context:
space:
mode:
authorGravatar Peter McGoron 2024-07-08 19:58:22 -0400
committerGravatar Peter McGoron 2024-07-08 19:58:22 -0400
commit4f7847b2c0219995c4fe2d0858b5030e73581a3c (patch)
tree9b84a1fc5698a4f8b97c0580fccf2b26c000d748 /Makefile
parentdelete for hashtables (diff)
Major API reorganization, test infrastructure
The API is now hidden behind functions. The GC struct can have an unstable layout without affecting any compiled binaries (users of Universal Service or collectors hidden behind the API). The collectors can be called directly if desired. The API now allows for different allocation flags. These will be used in future extensions (like weak pointers). For now none are used. Tests are compiled for each collector. I can't think of a good solution that will encompass everything I want to write, but for now this will work on POSIX systems.
Diffstat (limited to '')
-rw-r--r--Makefile51
1 files changed, 39 insertions, 12 deletions
diff --git a/Makefile b/Makefile
index 86991e5..78d7e5b 100644
--- a/Makefile
+++ b/Makefile
@@ -1,21 +1,48 @@
-.PHONY: test clean
+.POSIX:
+.PHONY: tests clean string_tests htable_tests
+.SUFFIXES:
+.SUFFIXES: .c .o .test
+CC=cc
+
+CFLAGS=-Wall -std=c89 -Werror -pedantic -fPIC -g -Iinclude
+
+tests: string_tests htable_tests
COMMON_OBJECTS=uns.o
-CHENEY_C89_OBJECTS=cheney_c89.o c89_relo.o
-CFLAGS=-Wall -std=c89 -Werror -pedantic -fPIC -g -Iinclude
+uns.o: uns.c include/uns.h
+
+libuniversalservice.so: uns.o ${ALL_COLLECTORS}
+ ${CC} -shared uns.o ${ALL_COLLECTORS} -o libuniversalservice.so
-libuniversalservice.so: $(COMMON_OBJECTS) $(CHENEY_C89_OBJECTS)
- $(CC) -shared $(COMMON_OBJECTS) $(CHENEY_C89_OBJECTS) -o libuniversalservice.so
.c.o:
- $(CC) $(CFLAGS) $< -c -o $@
+ ${CC} ${CFLAGS} $< -c -o $@
-test:
-
+## Collectors
+CHENEY_C89_OBJS = cheney_c89.o
+cheney_c89.o: cheney_c89.c include/uns.h include/cheney_c89.h
-###################
-## Clean
-##################
+COLLECTOR_OBJS=${CHENEY_C89_OBJS}
+## Example libraries
+examples/string/uns_string.o: examples/string/uns_string.c \
+ examples/string/uns_string.h \
+ include/uns.h
+
+UNS_STRING_OBJS=examples/string/uns_string.o
+
+examples/hashtable/uns_hashtable.o: examples/hashtable/uns_hashtable.c \
+ examples/hashtable/uns_hashtable.h \
+ include/uns.h
+UNS_HASHTABLE_OBJS=examples/hashtable/uns_hashtable.o
+
+EXAMPLE_OBJS=${UNS_STRING_OBJS} ${UNS_HASHTABLE_OBJS}
+
+## Clean
clean:
- rm -f $(COMMON_OBJECTS) $(CHENEY_C89_OBJECTS) libuniversalservice.so
+ ${RM} -f ${COMMON_OBJECTS} libuniversalservice.so \
+ ${TEST_OBJS} ${COLLECTOR_OBJS} ${EXAMPLE_OBJS}
+
+tests.makefile: gen_tests.sh
+ ./gen_tests.sh > tests.makefile
+include tests.makefile