aboutsummaryrefslogtreecommitdiff
path: root/Makefile
diff options
context:
space:
mode:
authorPaul LeoNerd Evans <leonerd@leonerd.org.uk>2012-03-26 18:49:45 +0100
committerPaul LeoNerd Evans <leonerd@leonerd.org.uk>2012-03-26 18:49:45 +0100
commita3fecd87673a20db9662e6e531cb2312f8bee1b4 (patch)
tree8b3f66c724be80345edf68317384b52aaf466cc2 /Makefile
parent85d44442e9df5f070c0a9a7470acf76f21961d7f (diff)
downloadtermo-a3fecd87673a20db9662e6e531cb2312f8bee1b4.tar.gz
termo-a3fecd87673a20db9662e6e531cb2312f8bee1b4.tar.xz
termo-a3fecd87673a20db9662e6e531cb2312f8bee1b4.zip
Also pack the unit tests into the dist tarball, and allow building them in-target
Diffstat (limited to 'Makefile')
-rw-r--r--Makefile33
1 files changed, 20 insertions, 13 deletions
diff --git a/Makefile b/Makefile
index d4f2928..f20d0a3 100644
--- a/Makefile
+++ b/Makefile
@@ -32,6 +32,9 @@ endif
OBJECTS=termkey.lo driver-csi.lo driver-ti.lo
LIBRARY=libtermkey.la
+TESTSOURCES=$(wildcard t/[0-9]*.c)
+TESTFILES=$(TESTSOURCES:.c=.t)
+
VERSION_MAJOR=0
VERSION_MINOR=13
@@ -60,8 +63,22 @@ demo: $(LIBRARY) demo.lo
demo-async: $(LIBRARY) demo-async.lo
$(LIBTOOL) --mode=link --tag=CC gcc -o $@ $^
+t/%.t: t/%.c $(LIBRARY) t/taplib.lo
+ $(LIBTOOL) --mode=link --tag=CC gcc -o $@ $^
+
+t/taplib.lo: t/taplib.c
+ $(LIBTOOL) --mode=compile --tag=CC gcc $(CFLAGS) -o $@ -c $^
+
+.PHONY: test
+test: $(TESTFILES)
+ prove -e ""
+
+.PHONY: clean-test
+clean-test:
+ $(LIBTOOL) --mode=clean rm -f $(TESTFILES) t/taplib.lo
+
.PHONY: clean
-clean:
+clean: clean-test
$(LIBTOOL) --mode=clean rm -f $(OBJECTS) demo.lo demo-async.lo
$(LIBTOOL) --mode=clean rm -f $(LIBRARY)
$(LIBTOOL) --mode=clean rm -rf demo demo-async
@@ -108,18 +125,6 @@ doc: $(BUILTMAN)
%.3: %.3.sh
sh $< >$@
-TESTSOURCES=$(wildcard t/[0-9]*.c)
-TESTFILES=$(TESTSOURCES:.c=.t)
-
-t/%.t: t/%.c $(LIBRARY) t/taplib.lo
- $(LIBTOOL) --mode=link --tag=CC gcc -o $@ $^
-
-t/taplib.lo: t/taplib.c
- $(LIBTOOL) --mode=compile --tag=CC gcc $(CFLAGS) -o $@ -c $^
-
-test: $(TESTFILES)
- prove -e ""
-
clean: clean-built
clean-built:
@@ -135,6 +140,8 @@ DISTDIR=libtermkey-$(VERSION)
distdir: all
mkdir __distdir
cp *.c *.h LICENSE __distdir
+ mkdir __distdir/t
+ cp t/*.c t/*.h __distdir/t
mkdir __distdir/man
cp man/*.[37] __distdir/man
sed "s,@VERSION@,$(VERSION)," <termkey.pc.in >__distdir/termkey.pc.in