aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--.gitignore5
-rw-r--r--Makefile64
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/*~