aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--Makefile20
1 files changed, 17 insertions, 3 deletions
diff --git a/Makefile b/Makefile
index 3ea46ec..b8acc24 100644
--- a/Makefile
+++ b/Makefile
@@ -24,6 +24,9 @@ MANUAL = manual.txt
# automatically included
EXTRA_DIST =
+# unit tests and related files here, in the 'unittests' subfolder
+UNITTESTS =
+
#------------------------------------------------------------------------------#
@@ -237,7 +240,7 @@ SHARED_HEADER ?= $(shell test ! -e $(LIBRARY_NAME).h || echo $(LIBRARY_NAME).h)
SHARED_LIB = $(SHARED_SOURCE:.c=.$(SHARED_EXTENSION))
SHARED_TCL_LIB = $(wildcard lib$(LIBRARY_NAME).tcl)
-.PHONY = install libdir_install single_install install-doc install-examples install-manual clean distclean dist etags $(LIBRARY_NAME)
+.PHONY = install libdir_install single_install install-doc install-examples install-manual install-unittests clean distclean dist etags $(LIBRARY_NAME)
all: $(SOURCES:.c=.$(EXTENSION)) $(SHARED_LIB)
@@ -260,7 +263,7 @@ install: libdir_install
# The meta and help files are explicitly installed to make sure they are
# actually there. Those files are not optional, then need to be there.
-libdir_install: $(SOURCES:.c=.$(EXTENSION)) $(SHARED_LIB) install-doc install-examples install-manual
+libdir_install: $(SOURCES:.c=.$(EXTENSION)) $(SHARED_LIB) install-doc install-examples install-manual install-unittests
$(INSTALL_DIR) $(DESTDIR)$(objectsdir)/$(LIBRARY_NAME)
$(INSTALL_DATA) $(LIBRARY_NAME)-meta.pd \
$(DESTDIR)$(objectsdir)/$(LIBRARY_NAME)
@@ -281,7 +284,7 @@ libdir_install: $(SOURCES:.c=.$(EXTENSION)) $(SHARED_LIB) install-doc install-ex
$(DESTDIR)$(objectsdir)/$(LIBRARY_NAME)
# install library linked as single binary
-single_install: $(LIBRARY_NAME) install-doc install-examples install-manual
+single_install: $(LIBRARY_NAME) install-doc install-examples install-manual install-unittests
$(INSTALL_DIR) $(DESTDIR)$(objectsdir)/$(LIBRARY_NAME)
$(INSTALL_PROGRAM) $(LIBRARY_NAME).$(EXTENSION) $(DESTDIR)$(objectsdir)/$(LIBRARY_NAME)
$(STRIP) $(DESTDIR)$(objectsdir)/$(LIBRARY_NAME)/$(LIBRARY_NAME).$(EXTENSION)
@@ -308,6 +311,12 @@ install-manual:
$(INSTALL_DATA) manual/$$file $(DESTDIR)$(objectsdir)/$(LIBRARY_NAME)/manual; \
done
+install-unittests:
+ test -z "$(strip $(UNITTESTS))" || \
+ $(INSTALL_DIR) $(DESTDIR)$(objectsdir)/$(LIBRARY_NAME)/unittests && \
+ for file in $(UNITTESTS); do \
+ $(INSTALL_DATA) unittests/$$file $(DESTDIR)$(objectsdir)/$(LIBRARY_NAME)/unittests; \
+ done
clean:
-rm -f -- $(SOURCES:.c=.o) $(SOURCES_LIB:.c=.o) $(SHARED_SOURCE:.c=.o)
@@ -373,6 +382,11 @@ dist: $(DISTDIR)
for file in $(MANUAL); do \
$(INSTALL_DATA) manual/$$file $(DISTDIR)/manual; \
done
+ test -z "$(strip $(UNITTESTS))" || \
+ $(INSTALL_DIR) $(DISTDIR)/unittests && \
+ for file in $(UNITTESTS); do \
+ $(INSTALL_DATA) unittests/$$file $(DISTDIR)/unittests; \
+ done
tar --exclude-vcs -czpf $(DISTDIR).tar.gz $(DISTDIR)
# make a Debian source package