aboutsummaryrefslogtreecommitdiffstats
path: root/Makefile
diff options
context:
space:
mode:
authorGustav Eek <gustav.eek@fripost.org>2023-11-02 12:28:15 +0100
committerGustav Eek <gustav.eek@fripost.org>2023-11-02 22:43:56 +0100
commit7035ae6e39c2f44df4aba673a2edadb9e130be3d (patch)
tree1198189d1f0d5cc061de0a83e2fb27cc16b7b3f6 /Makefile
parentd1eb887fc2d54203806876237561fa7bf6bdd404 (diff)
Setup. Modify building process
Create an intermediate fripost.sty file and compile resources from that
Diffstat (limited to 'Makefile')
-rw-r--r--Makefile64
1 files changed, 39 insertions, 25 deletions
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/*~