aboutsummaryrefslogtreecommitdiffstats
path: root/Makefile
diff options
context:
space:
mode:
Diffstat (limited to 'Makefile')
-rw-r--r--Makefile15
1 files changed, 12 insertions, 3 deletions
diff --git a/Makefile b/Makefile
index 72f191b..4a543c8 100644
--- a/Makefile
+++ b/Makefile
@@ -43,8 +43,9 @@ HDR =\
LOBJ = $(OBJ:.o=.lo)
-all: libcontacts.a libcontacts.$(LIBEXT)
+all: libcontacts.a libcontacts.$(LIBEXT) test
$(OBJ): $($@:.o=.c) $(HDR)
+test.o: test.c $(HDR)
libcontacts.a: $(OBJ)
-rm -f -- $@
@@ -60,6 +61,14 @@ libcontacts.$(LIBEXT): $(LOBJ)
.c.lo:
$(CC) -fPIC -c -o $@ $< $(CFLAGS) $(CPPFLAGS)
+test: test.o libcontacts.a
+ $(CC) -o $@ test.o libcontacts.a $(LDFLAGS)
+
+check: test
+ @rm -rf -- .testdir
+ ./test
+ @rm -rf -- .testdir
+
install: libcontacts.a libcontacts.$(LIBEXT)
mkdir -p -- "$(DESTDIR)$(PREFIX)/lib"
mkdir -p -- "$(DESTDIR)$(PREFIX)/include"
@@ -77,9 +86,9 @@ uninstall:
-rm -f -- "$(DESTDIR)$(PREFIX)/include/libcontacts.h"
clean:
- -rm -f -- *.o *.a *.lo *.so *.dylib *.dll *.su
+ -rm -rf -- *.o *.a *.lo *.so *.dylib *.dll *.su test .testdir
.SUFFIXES:
.SUFFIXES: .c .o .lo
-.PHONY: all install uninstall clean
+.PHONY: all check install uninstall clean