aboutsummaryrefslogtreecommitdiff
path: root/Makefile
diff options
context:
space:
mode:
authorHarry Jeffery <harry@exec64.co.uk>2015-12-08 16:36:26 +0000
committerHarry Jeffery <harry@exec64.co.uk>2015-12-08 16:39:31 +0000
commitc8f4c755c3df8f8a9a304a55036baa9ea20cf943 (patch)
treef2500f328845043fd15f145b53cf131483150d47 /Makefile
parentad1aca588a29516896e0088c3c207127d732e3ce (diff)
downloadimv-c8f4c755c3df8f8a9a304a55036baa9ea20cf943.tar.gz
Add testing infrastructure
Diffstat (limited to 'Makefile')
-rw-r--r--Makefile13
1 files changed, 11 insertions, 2 deletions
diff --git a/Makefile b/Makefile
index 8088f8e..d589faa 100644
--- a/Makefile
+++ b/Makefile
@@ -1,4 +1,4 @@
-.PHONY: clean install uninstall
+.PHONY: clean check install uninstall
prefix = /usr
@@ -10,6 +10,7 @@ BUILDDIR = build
SOURCES = $(wildcard src/*.c)
OBJECTS = $(patsubst src/%.c,$(BUILDDIR)/%.o,$(SOURCES))
+TESTS = $(patsubst test/%.c,test_%,$(wildcard test/*.c))
VERSION = "v1.1.0"
@@ -27,8 +28,16 @@ $(BUILDDIR)/%.o: src/%.c
@echo "COMPILING $@"
@$(CC) -c $(CFLAGS) -o $@ $<
+test_%: test/%.c src/%.c
+ @echo "BUILDING $@"
+ @$(CC) -o $@ -Isrc -W -Wall -std=gnu11 -lcmocka $^
+
+check: $(TESTS)
+ @echo "RUNNING TESTS"
+ @for t in "$(TESTS)"; do ./$$t; done
+
clean:
- @$(RM) $(TARGET) $(OBJECTS)
+ @$(RM) $(TARGET) $(OBJECTS) $(TESTS)
install: $(TARGET)
install -D -m 0755 $(TARGET) $(DESTDIR)$(prefix)/bin/imv