aboutsummaryrefslogtreecommitdiffstats
path: root/Makefile
blob: 5ef668dbc54663ce2ad64192f4eee483258af18c (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
PACKAGE = fripost
AUTHOR = Fripost
LICENSE = gpl

.PHONY: all test install

DTX = $(addsuffix .dtx, $(PACKAGE))
INS = $(addsuffix .ins, $(PACKAGE))
PDF = $(addsuffix .pdf, $(PACKAGE))

all: $(DTX) $(INS) $(PDF)

# Generate package using makedtx and pdflatex

$(DTX): %.dtx: tex/%.sty doc/%.tex
	makedtx -author "$(AUTHOR)" -license $(LICENSE) \
	  -dir $(dir $<) -src "(.*)\.sty=>\1.sty" -doc doc/$*.tex $*

$(INS): %.ins: %.dtx

# Testing

test:
	make -C $@ clean
	make -C $@

# Installation

TEXMFHOME ?= $(HOME)/texmf
DEST_STY := $(TEXMFHOME)/tex/latex/$(PACKAGE)
DEST_PDF := $(TEXMFHOME)/doc

install: $(PACKAGE).sty $(PACKAGE).pdf
	mkdir -p $(DEST_STY) $(DEST_PDF)
	cp $(PACKAGE).sty $(DEST_STY)
	cp $(PACKAGE).pdf $(DEST_PDF)
	texhash $(TEXMFHOME)

uninstall:
	rm -f $(DEST_STY)/* $(DEST_PDF)/$(PACKAGE).pdf
	texhash $(TEXMFHOME)
	rmdir --ignore-fail-on-non-empty -p $(DEST_STY) $(DEST_PDF)

%.sty: %.ins %.dtx
	pdflatex $<

%.pdf: %.dtx
	pdflatex $<

# Clean

clean:
	make -C test clean
	rm -f *.dtx *.ins *.pdf
	rm -f *~ tex/*~ doc/*~