From 7035ae6e39c2f44df4aba673a2edadb9e130be3d Mon Sep 17 00:00:00 2001 From: Gustav Eek Date: Thu, 2 Nov 2023 12:28:15 +0100 Subject: Setup. Modify building process Create an intermediate fripost.sty file and compile resources from that --- .gitignore | 5 ++++- Makefile | 64 ++++++++++++++++++++++++++++++++++++++------------------------ 2 files changed, 43 insertions(+), 26 deletions(-) diff --git a/.gitignore b/.gitignore index e2b0668..def627a 100644 --- a/.gitignore +++ b/.gitignore @@ -14,6 +14,7 @@ *.snm *.toc *.vrb +*.hd # LaTeX package intermediates @@ -23,10 +24,12 @@ *.sty *.cls +# Enforce these + !tex/*.sty !tex/*.cls !doc/*.tex - +!test/*.tex # LaTeX PDF output diff --git a/Makefile b/Makefile index 5ef668d..ce3a1fa 100644 --- a/Makefile +++ b/Makefile @@ -1,22 +1,25 @@ -PACKAGE = fripost +PKG = fripost +SRC = fripost acronyms attendants AUTHOR = Fripost LICENSE = gpl .PHONY: all test install -DTX = $(addsuffix .dtx, $(PACKAGE)) -INS = $(addsuffix .ins, $(PACKAGE)) -PDF = $(addsuffix .pdf, $(PACKAGE)) +DTX = $(addsuffix .dtx, $(PKG)) +INS = $(addsuffix .ins, $(PKG)) +PDF = $(addsuffix .pdf, $(PKG)) +STY = $(addsuffix .sty, $(PKG)) -all: $(DTX) $(INS) $(PDF) +all: $(DTX) $(INS) $(PDF) $(STY) # Generate package using makedtx and pdflatex -$(DTX): %.dtx: tex/%.sty doc/%.tex +$(DTX) $(INS): doc/$(PKG).tex tmp.sty makedtx -author "$(AUTHOR)" -license $(LICENSE) \ - -dir $(dir $<) -src "(.*)\.sty=>\1.sty" -doc doc/$*.tex $* + -src "tmp\.sty=>$(STY)" -doc $< $(PKG) -$(INS): %.ins: %.dtx +tmp.sty: $(addprefix tex/, $(addsuffix .sty, $(SRC))) + cat $^ > $@ # Testing @@ -24,32 +27,43 @@ test: make -C $@ clean make -C $@ +# Compilation for installation + +%.sty: %.ins %.dtx + pdflatex $< + +%.pdf: %.dtx %.ins + pdflatex $< + # Installation -TEXMFHOME ?= $(HOME)/texmf -DEST_STY := $(TEXMFHOME)/tex/latex/$(PACKAGE) -DEST_PDF := $(TEXMFHOME)/doc +TEXMF ?= $(HOME)/texmf +DST_STY := $(TEXMF)/tex/latex/$(PKG) +DST_PDF := $(TEXMF)/doc -install: $(PACKAGE).sty $(PACKAGE).pdf - mkdir -p $(DEST_STY) $(DEST_PDF) - cp $(PACKAGE).sty $(DEST_STY) - cp $(PACKAGE).pdf $(DEST_PDF) - texhash $(TEXMFHOME) +install: \ + $(addprefix $(DST_STY)/, $(STY)) \ + $(addprefix $(DST_PDF)/, $(PDF)) + texhash $(TEXMF) -uninstall: - rm -f $(DEST_STY)/* $(DEST_PDF)/$(PACKAGE).pdf - texhash $(TEXMFHOME) - rmdir --ignore-fail-on-non-empty -p $(DEST_STY) $(DEST_PDF) +$(DST_STY)/%.sty: %.sty + mkdir -p $(dir $@) + cp $< $@ -%.sty: %.ins %.dtx - pdflatex $< +$(DST_PDF)/%.pdf: %.pdf + mkdir -p $(dir $@) + cp $< $@ -%.pdf: %.dtx - pdflatex $< +uninstall: + rm -f $(DST_STY)/* $(DST_PDF)/$(PKG).pdf + texhash $(TEXMF) + rmdir --ignore-fail-on-non-empty -p $(DST_STY) $(DST_PDF) # Clean clean: make -C test clean - rm -f *.dtx *.ins *.pdf + rm -f tmp.sty + rm -f *.aux *.hd *.log *.out + rm -f *.dtx *.ins *.pdf *.sty rm -f *~ tex/*~ doc/*~ -- cgit v1.2.3