aboutsummaryrefslogtreecommitdiff
path: root/Makefile
diff options
context:
space:
mode:
Diffstat (limited to 'Makefile')
-rw-r--r--Makefile38
1 files changed, 28 insertions, 10 deletions
diff --git a/Makefile b/Makefile
index eceb18d..f30181c 100644
--- a/Makefile
+++ b/Makefile
@@ -5,20 +5,29 @@ INSTALL_SH = ./tools/install.sh
CONTRIB = `find contrib -name 'cpt*' ! -name '*.*'`
SRC = `find src -name 'cpt*' ! -name '*.*'`
BIN = ${SRC} ${CONTRIB}
-LIB = src/cpt-lib
-LIB_IN = ${LIB:=.in}
all: src/cpt-lib
- test "${DOCS}" != yes || ${MAKE} -C docs all
+ @test "${DOCS}" != yes || ${MAKE} -C docs all
src/cpt-lib: src/cpt-lib.in
- sed -e "s|@VERSION@|${VERSION}|g" \
- -e "s|@DOCSTRING@|Call functions from the library|g" < src/cpt-lib.in > $@
+ sed -n '/^Copyright/{s,^, ",;s,$$," \\,;p}' LICENSE | \
+ sed -e '/@LICENSE@/r /dev/stdin' \
+ -e '/@LICENSE@/d' \
+ -e 's|@SYSCONFDIR@|${SYSCONFDIR}|g' \
+ -e "s|@VERSION@|${VERSION}|g" \
+ -e "s|@DOCSTRING@|Call functions from the library|g" src/cpt-lib.in > $@
chmod 755 $@
-test: all tests/etc/cpt-hook
+shellspec: all tests/etc/cpt-hook
shellspec
- cd src; find . ../contrib -name 'cpt*' ! -name '*.*' -exec shellcheck -e 2119 -x -f gcc {} +
+
+shellcheck: all
+ @cd src; find . ../contrib -name 'cpt*' ! -name '*.*' | while read -r file; do \
+ echo SHELLCHECK "$$file"; \
+ shellcheck -e 2119 -x -f gcc "$$file"; \
+ done
+
+test: shellspec shellcheck
tests/etc/cpt-hook:
ln -s ../hook-file $@
@@ -28,6 +37,11 @@ dist: docs/cpt.info
install: all
test "${DOCS}" != yes || ${MAKE} -C docs install
+ [ -f docs/cpt.info ] && \
+ ${INSTALL_SH} -Dm644 docs/cpt.info ${DESTDIR}${INFODIR}/cpt.info ||:
+ [ -f docs/cpt.txt ] && \
+ ${INSTALL_SH} -Dm644 docs/cpt.txt ${DESTDIR}${DOCDIR}/cpt.txt ||:
+ ${INSTALL_SH} -Dm644 CHANGELOG.md ${DESTDIR}${DOCDIR}/CHANGELOG
${INSTALL_SH} -Dm755 -t ${DESTDIR}${BINDIR} ${BIN}
${INSTALL_SH} -Dm644 -t ${DESTDIR}${MAN1} man/*.1
for man in ${CONTRIB}; do \
@@ -36,15 +50,19 @@ install: all
done
uninstall:
- test "${DOCS}" != yes || ${MAKE} -C docs uninstall
for bin in ${BIN}; do \
rm -f ${DESTDIR}${BINDIR}/$${bin##*/}; done
for man in man/*.1; do rm -f ${DESTDIR}${MAN1}/$${man##*/}; done
for man in ${CONTRIB}; do rm -f ${DESTDIR}${MAN1}/$${man##*/}.1; done
+ rm -rf ${DESTDIR}${DOCDIR}
+ rm -f ${DESTDIR}${INFODIR}/cpt.info
clean:
- test "${DOCS}" != yes || ${MAKE} -C docs clean
+ ${MAKE} -C docs clean
rm -rf src/cpt-lib "cpt-${VERSION}.tar.xz" coverage report
rm -f tests/etc/cpt-hook
-.PHONY: all dist clean install uninstall
+allclean: clean
+ rm -f config.mk
+
+.PHONY: all dist allclean clean install uninstall shellspec shellcheck test