| 1 |
#!/usr/bin/make -f |
| 2 |
# |
| 3 |
# SPDX-FileCopyrightText: Peter Pentchev <[email protected]> |
| 4 |
# SPDX-License-Identifier: BSD-2-Clause |
| 5 |
|
| 6 |
PROG= feature-check |
| 7 |
|
| 8 |
FCHKDATA_PROG?= ${CURDIR}/fcheck-testdata/target/release/fcheck-testdata |
| 9 |
FCHKDATA_DIR?= ${CURDIR}/fcheck-testdata/data |
| 10 |
|
| 11 |
MAN1= feature-check.1 |
| 12 |
MAN1GZ= ${MAN1}.gz |
| 13 |
|
| 14 |
INSTALL?= install |
| 15 |
MKDIR?= mkdir -p |
| 16 |
RM?= rm -f |
| 17 |
FALSE?= false |
| 18 |
|
| 19 |
LOCALBASE?= /usr/local |
| 20 |
PREFIX?= ${LOCALBASE} |
| 21 |
BINDIR?= ${PREFIX}/bin |
| 22 |
MANDIR?= ${PREFIX}/man/man |
| 23 |
DOCSDIR?= ${PREFIX}/share/doc/feature-check |
| 24 |
EXAMPLESDIR?= ${DOCSDIR}/examples |
| 25 |
|
| 26 |
BINOWN?= root |
| 27 |
BINGRP?= wheel |
| 28 |
BINMODE?= 555 |
| 29 |
|
| 30 |
SHAREOWN?= root |
| 31 |
SHAREGRP?= wheel |
| 32 |
SHAREMODE?= 644 |
| 33 |
|
| 34 |
COPY?= -c |
| 35 |
STRIP?= -s |
| 36 |
|
| 37 |
INSTALL_PROGRAM?= ${INSTALL} ${COPY} ${STRIP} -o ${BINOWN} -g ${BINGRP} -m ${BINMODE} |
| 38 |
INSTALL_SCRIPT?= ${INSTALL} ${COPY} -o ${BINOWN} -g ${BINGRP} -m ${BINMODE} |
| 39 |
INSTALL_DATA?= ${INSTALL} ${COPY} -o ${SHAREOWN} -g ${SHAREGRP} -m ${SHAREMODE} |
| 40 |
|
| 41 |
REGEN_PYTHON?= python3 |
| 42 |
|
| 43 |
all: ${PROG} ${MAN1GZ} |
| 44 |
|
| 45 |
clean: |
| 46 |
${RM} ${PROG} ${MAN1GZ} |
| 47 |
|
| 48 |
install: all |
| 49 |
${MKDIR} ${DESTDIR}${BINDIR} |
| 50 |
${INSTALL_SCRIPT} ${PROG} ${DESTDIR}${BINDIR} |
| 51 |
${MKDIR} ${DESTDIR}${MANDIR}1 |
| 52 |
${INSTALL_DATA} ${MAN1GZ} ${DESTDIR}${MANDIR}1 |
| 53 |
${MKDIR} ${DESTDIR}${DOCSDIR} |
| 54 |
${INSTALL_DATA} README.md ${DESTDIR}${DOCSDIR} |
| 55 |
|
| 56 |
test-single: ${TEST_PROG} |
| 57 |
echo "Testing ${TEST_PROG}" |
| 58 |
prove t |
| 59 |
echo "Testing ${TEST_PROG} complete" |
| 60 |
|
| 61 |
test-real: ${PROG} |
| 62 |
${MAKE} test-single TEST_PROG="./${PROG}" |
| 63 |
|
| 64 |
test: test-real |
| 65 |
|
| 66 |
test-all: |
| 67 |
(set -e; for f in \ |
| 68 |
perl5/feature-check.pl \ |
| 69 |
python/3/feature-check.sh \ |
| 70 |
rust/target/debug/feature-check \ |
| 71 |
rust/target/release/feature-check \ |
| 72 |
; do \ |
| 73 |
if [ -f "$$f" ]; then \ |
| 74 |
${MAKE} test-single TEST_PROG="./$$f"; \ |
| 75 |
else \ |
| 76 |
echo "Skipping nonexistent $$f" 1>&2; \ |
| 77 |
fi; \ |
| 78 |
done) |
| 79 |
@echo 'Testing all the feature-check implementations complete' |
| 80 |
|
| 81 |
test-regen: |
| 82 |
${FCHKDATA_PROG} -o python/tests/unit/data.py -f ${FCHKDATA_DIR}/simple.json -v python/tests/unit/data.py.hbs |
| 83 |
(set -e; cd python; ${REGEN_PYTHON} -m tox -e reformat) |
| 84 |
${FCHKDATA_PROG} -o t/04-simple.t -f ${FCHKDATA_DIR}/simple.json -v t/04-simple.t.hbs |
| 85 |
${FCHKDATA_PROG} -o t/bin/fcheck -f ${FCHKDATA_DIR}/simple.json -v t/bin/fcheck.hbs |
| 86 |
chmod 755 t/bin/fcheck |
| 87 |
|
| 88 |
${PROG}: perl5/feature-check.pl |
| 89 |
${INSTALL} -m 755 perl5/feature-check.pl ${PROG} |
| 90 |
|
| 91 |
${MAN1GZ}: ${MAN1} |
| 92 |
gzip -c9 ${MAN1} > ${MAN1GZ}.tmp || (${RM} ${MAN1GZ}.tmp; ${FALSE}) |
| 93 |
mv ${MAN1GZ}.tmp ${MAN1GZ} || (${RM} ${MAN1GZ} ${MAN1GZ}.tmp; ${FALSE}) |
| 94 |
|
| 95 |
.PHONY: all clean test test-real test-single test-all |