diff options
author | Harry Jeffery <harry@exec64.co.uk> | 2015-12-08 16:36:26 +0000 |
---|---|---|
committer | Harry Jeffery <harry@exec64.co.uk> | 2015-12-08 16:39:31 +0000 |
commit | c8f4c755c3df8f8a9a304a55036baa9ea20cf943 (patch) | |
tree | f2500f328845043fd15f145b53cf131483150d47 /Makefile | |
parent | ad1aca588a29516896e0088c3c207127d732e3ce (diff) | |
download | imv-c8f4c755c3df8f8a9a304a55036baa9ea20cf943.tar.gz |
Add testing infrastructure
Diffstat (limited to 'Makefile')
-rw-r--r-- | Makefile | 13 |
1 files changed, 11 insertions, 2 deletions
@@ -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 |