| 1 |
# SPDX-FileCopyrightText: 2015,2020-2021 Robin Schneider <[email protected]> |
| 2 |
# |
| 3 |
# SPDX-License-Identifier: LPPL-1.3c |
| 4 |
# |
| 5 |
# This work consists of all files listed in manifest.txt. |
| 6 |
# For more details about the licensing, refer to the README.md file. |
| 7 |
|
| 8 |
TEXMFHOME ?= $(shell kpsewhich -var-value TEXMFHOME) |
| 9 |
SHELL := /bin/bash -o nounset -o pipefail -o errexit |
| 10 |
|
| 11 |
RELEASE_OPENPGP_FINGERPRINT ?= C505B5C93B0DB3D338A1B6005FE92C12EE88E1F0 |
| 12 |
DOCLICENSE_VERSION ?= $(shell sed --quiet --regexp-extended 's/.* v([0-9.]+) Support for putting documents under a license\]/\1/p;' doclicense.dtx) |
| 13 |
|
| 14 |
.PHONY: all |
| 15 |
all: build |
| 16 |
|
| 17 |
.PHONY: build |
| 18 |
build: manifest.txt doclicense.sty doclicense.pdf |
| 19 |
|
| 20 |
# Duplicated in ../.github/workflows/ci.yml to have separate sections in the CI |
| 21 |
# output for each step. |
| 22 |
.PHONY: ci |
| 23 |
ci: lint install-symlink build test-package-option-matrix-only-english |
| 24 |
|
| 25 |
.PHONY: install-symlink |
| 26 |
install-symlink: doclicense.sty |
| 27 |
mkdir --parents "$(TEXMFHOME)/tex/latex/" |
| 28 |
test -L "$(TEXMFHOME)/tex/latex/doclicense" || ln --no-target-directory --symbolic "$(shell pwd)" "$(TEXMFHOME)/tex/latex/doclicense" |
| 29 |
|
| 30 |
.PHONY: check |
| 31 |
check: check-copyright-date manifest.txt doclicense.sty lint |
| 32 |
|
| 33 |
# Run before release. |
| 34 |
.PHONY: check-full |
| 35 |
check-full: check test-package-option-matrix |
| 36 |
|
| 37 |
.PHONY: test-package-option-matrix |
| 38 |
test-package-option-matrix: |
| 39 |
./test-package-option-matrix |
| 40 |
|
| 41 |
.PHONY: test-package-option-matrix-only-english |
| 42 |
test-package-option-matrix-only-english: |
| 43 |
./test-package-option-matrix "english" |
| 44 |
|
| 45 |
# CTAN people want this when uploading a release. |
| 46 |
.PHONY: check-copyright-date |
| 47 |
check-copyright-date: README.md doclicense.dtx |
| 48 |
grep --quiet 'SPDX-FileCopyrightText:.*$(shell date +%Y)\s' README.md |
| 49 |
grep --quiet 'SPDX-FileCopyrightText:.*$(shell date +%Y)\s' doclicense.dtx |
| 50 |
|
| 51 |
.PHONY: release-local |
| 52 |
release-local: check-copyright-date |
| 53 |
git tag --sign --local-user "$(RELEASE_OPENPGP_FINGERPRINT)" --message "Released version $(DOCLICENSE_VERSION) of doclicense" "doclicense/v$(DOCLICENSE_VERSION)" |
| 54 |
|
| 55 |
.PHONY: release-publish |
| 56 |
release-publish: |
| 57 |
git push --follow-tags |
| 58 |
|
| 59 |
.PHONY: lint |
| 60 |
lint: doclicense.dtx |
| 61 |
chktex "$<" |
| 62 |
find -regextype posix-egrep -iregex '.*\.(tex|ldf)' -and -not -iname '*-plaintext.tex' -print0 | xargs --null chktex |
| 63 |
[[ -z "$(shell lacheck "$<" *.ldf | grep 'possible unwanted space')" ]] |
| 64 |
reuse --root . lint |
| 65 |
|
| 66 |
.PHONY: clean |
| 67 |
clean: |
| 68 |
rm -rf *.sty *.pdf *.aux *.out *.glo *.gls *.hd *.idx *.ilg *.ind *.log *.toc |
| 69 |
|
| 70 |
doclicense.sty: |
| 71 |
doclicense.pdf: |
| 72 |
|
| 73 |
%.sty: %.ins %.dtx |
| 74 |
tex "$<" |
| 75 |
|
| 76 |
%.pdf: %.dtx doclicense.sty |
| 77 |
lualatex "$<" |
| 78 |
makeindex -s gglo.ist -o doclicense.gls doclicense.glo |
| 79 |
makeindex -s gind doclicense |
| 80 |
lualatex "$<" |
| 81 |
# thumbpdf doclicense |
| 82 |
# lualatex "$<" |
| 83 |
|
| 84 |
# The `cd .. && git archive` trick was needed with 2.29.2 so that evaluation of |
| 85 |
# the `.gitattributes` file worked correctly. |
| 86 |
.FORCE: |
| 87 |
manifest.txt: manifest_header.txt Makefile .FORCE |
| 88 |
cat "$<" > "$@" |
| 89 |
echo "% This work consists of the files:" >> "$@" |
| 90 |
cd .. && git archive --worktree-attributes HEAD doclicense | tar -t -f - | grep -v '/$$' | sort >> "$(shell pwd)/$@" |
| 91 |
echo "% and the derived files:" >> "$@" |
| 92 |
echo doclicense.sty doclicense.pdf | tr ' ' '\n' >> "$@" |