Commit 450b9b4b authored by Cédric Ware's avatar Cédric Ware
Browse files

Implement packaging-specific makefile.

parent c5ee7681
......@@ -16,6 +16,7 @@
*.rej
*.pdftex
*.pdftex_t
theme-tpt*.zip
example-*.pdf
example-presentation-slide2*
odgs/diag.pdf
......
......@@ -2,19 +2,75 @@
#
# Use this Makefile with GNU make.
#
TOP ?= example-presentation.pdf
TOP_NAME = $(patsubst %.pdf,%,$(TOP))
STYS = $(wildcard texinputs/*.sty)
RELEASE_SCRIPT = debian/make-release
# Package name, and release information through include file.
# FIXME handle relative directories more robustly.
package = theme-tpt
include version.mk
.PHONY: all clean dep preview release
# Default installation directories.
prefix = /usr/local
texmfdir = $(prefix)/texmf
texdir = $(texmfdir)/tex/latex/$(package)
picdir = $(texdir)
docdir = $(texmfdir)/doc/latex/$(package)
# Only for package installation and packaging.
# Usage: make release V=-v<x>.<y>.<z>. If V is not given,
# it will be calculated from the latest version-like tag
# (and incremented unless working copy is clean and at the tag).
TOP ?= example-presentation.pdf
TOP_NAME = $(patsubst %.pdf,%,$(TOP))
# FIXME temporary: ignore poster .sty in $(STYS) until it is updated.
STYS_TMP = $(wildcard texinputs/*.sty)
STYS = $(filter-out %poster.sty, $(STYS_TMP))
LOGOS = $(wildcard texinputs/logo-*)
DOCS_PDF = $(TOP)# FIXME have list of compiled PDFs.
DOCS_TEX = $(patsubst %.pdf,%.tex,$(DOCS_PDF))
DOCS = $(DOCS_PDF) $(DOCS_TEX)
# Program names.
RELEASE_SCRIPT = debian/update-release
MKTEXLSR = mktexlsr
INSTALL = install
PERL = perl
ZIP = zip
.PHONY: install install-tex install-doc install-nomktexlsr
.PHONY: build-doc release deb zip
# Only for package installation and packaging.
# Build documentation (example files): use Makefile above.
# FIXME fix Makefile above, fix relative directories.
build-doc:
$(MAKE) all
# Install. Separate installation of TeX files and compiled docs.
install: install-nomktexlsr
$(MKTEXLSR) $(texmfdir)
install-nomktexlsr: install-tex install-doc
install-tex: $(STYS) $(LOGOS)
$(INSTALL) -d $(texdir)
$(INSTALL) -m 644 $(STYS) $(texdir)
$(INSTALL) -d $(picdir)
$(INSTALL) -m 644 $(LOGOS) $(picdir)
install-doc: build-doc
$(INSTALL) -d $(docdir)
$(INSTALL) -m 644 $(DOCS) $(docdir)
# Create new release.
# Usage: make release V=<x.y.z> D=<yyyy-mm-dd>. If V and D are not given,
# they will be calculated from the latest version-like tag
# (and incremented unless working copy is clean and at the tag).
V =
D =
NEW_RELEASE_V = $(patsubst %,-v %,$(V))
NEW_RELEASE_D = $(patsubst %,-d %,$(D))
release:
perl -i.orig $(RELEASE_SCRIPT) $(V) $(filter-out %poster.sty, $(STYS)) $(TOP_NAME).tex
$(PERL) -i.orig $(RELEASE_SCRIPT) $(NEW_RELEASE_V) $(NEW_RELEASE_D) \
$(STYS) $(TOP_NAME).tex version.mk
# Create zip archive.
zip:
$(ZIP) $(package)-$(RELEASE_VERSION).zip $(STYS) $(LOGOS) $(DOCS)
#! /usr/bin/env perl
#
# Filter calls to some LaTeX macros:
# Filter calls to some LaTeX macros and others:
# \date{...} -> \date{date}
# \ProvidesPackage{...}[...] -> \ProvidesPackage{...}[date version]
# RELEASE_VERSION = ... -> RELEASE_VERSION = version
# RELEASE_DATE = ... -> RELEASE_DATE = date
#
# If you want to filter and replace files instead of stdin,
# invoke with perl -i.
......@@ -55,6 +57,9 @@ while (<>) {
s{^([^%]*)(\\(DTM)?date\s*)\[([^\[\]]*)\]}{${1}${2}\[$date\]}g;
s{(\\ProvidesPackage\s*\{([^{}]*)\}\s*)\[([^\[\]]*)\]
}{$1\[$date_l $version\]}gx;
s{^(RELEASE_VERSION\s*=\s*).*}{${1}$version};
s{^(RELEASE_DATE\s*=\s*).*}{${1}$date};
print;
}
......
# Updated by update-release script.
RELEASE_VERSION = v0.9.0
RELEASE_DATE = 2020-07-28
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment