diff options
author | Jakob Kaivo <jkk@ung.org> | 2020-06-30 11:11:54 -0400 |
---|---|---|
committer | Jakob Kaivo <jkk@ung.org> | 2020-06-30 11:11:54 -0400 |
commit | d5ecd8fe69115c8587e16a2110bbb92790050b52 (patch) | |
tree | 5ba7232ad68046d65c57edb6bb599a4ac909ca88 /Makefile | |
parent | 6e97e2feaa49fd741720bf0872a87be876a6747b (diff) |
add some simple tests
Diffstat (limited to 'Makefile')
-rw-r--r-- | Makefile | 15 |
1 files changed, 14 insertions, 1 deletions
@@ -1,15 +1,20 @@ .POSIX: +BINDIR=bin LIBDIR=lib OBJDIR=obj SRCDIR=src INCDIR=include +TESTDIR=test CFLAGS=-I$(INCDIR) -Wall -Wextra -Wpedantic -g OBJECTS=$(OBJDIR)/mapalloc.o +TESTS=$(BINDIR)/overflow $(BINDIR)/underflow $(BINDIR)/zero all: $(LIBDIR)/libmapalloc.a $(LIBDIR)/libmapalloc.so +tests: $(TESTS) + $(OBJDIR)/mapalloc.o: $(SRCDIR)/mapalloc.c $(INCDIR)/mapalloc.h @mkdir -p $(@D) $(CC) -c -o $@ $(CFLAGS) $(SRCDIR)/$(*F).c @@ -22,5 +27,13 @@ $(LIBDIR)/libmapalloc.so: $(OBJECTS) @mkdir -p $(@D) $(CC) -o $@ -shared $(OBJECTS) +$(BINDIR)/overflow: $(TESTDIR)/overflow.c $(LIBDIR)/libmapalloc.a +$(BINDIR)/underflow: $(TESTDIR)/underflow.c $(LIBDIR)/libmapalloc.a +$(BINDIR)/zero: $(TESTDIR)/zero.c $(LIBDIR)/libmapalloc.a + +$(TESTS): + @mkdir -p $(@D) + $(CC) -o $@ $(CFLAGS) $(TESTDIR)/$(@F).c -L$(LIBDIR) -lmapalloc + clean: - $(RM) -rf $(LIBDIR) $(OBJDIR) + $(RM) -rf $(LIBDIR) $(OBJDIR) $(BINDIR) |