-
Notifications
You must be signed in to change notification settings - Fork 1
/
Makefile
74 lines (60 loc) · 1.92 KB
/
Makefile
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
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
AUTHORS = $(shell head -1 LICENSE.txt |cut -d\ -f3-)
SRC = $(notdir $(wildcard src/*))
OBJ = build/obj/ecv.ins build/obj/ecv.dtx
DOC_PDF = build/doc/ecv.pdf
TEMPLATE_PDFS = $(patsubst %.tex,build/doc/%.pdf,$(notdir $(wildcard static/template/*.tex)))
LICENSE = build/dist/COPYING
ARCHIVE = dist/ecv.zip
LICENSE_TEXT = $(shell cat LICENSE.txt)
VPATH = src
LATEX = latexmk -latexoption=-interaction=nonstopmode -latexoption=-halt-on-error -pdf
MAKEDTX = build/tools/makedtx/makedtx.pl
MAKEDTX_ARCHIVE = makedtx-1_2.zip
default: compile
compile: $(OBJ) $(DOC_PDF) $(TEMPLATE_PDFS)
dist : $(ARCHIVE)
$(ARCHIVE) : $(OBJ) $(DOC_PDF) $(TEMPLATE_PDFS) $(LICENSE)
mkdir -p build/dist
cp -r static/* build/dist
cp $(OBJ) $(DOC_PDF) build/dist
mkdir -p build/dist/template
cp $(TEMPLATE_PDFS) build/dist/template
mkdir -p dist
cd build/dist; zip -r ../../$@ *
# Extract makedtx.pl
$(MAKEDTX) : dependencies/$(MAKEDTX_ARCHIVE)
mkdir -p build/tools
cd build/tools; unzip -o ../../$<
cd build/tools/makedtx; latex makedtx.ins
# build dtx and ins files
$(OBJ) : $(SRC) $(MAKEDTX)
mkdir -p build/obj
perl $(MAKEDTX) \
-macrocode ".*" \
-src "($(subst $() $(),|,$(SRC)))=>\1" \
-dir "src" \
-author "$(AUTHORS)" \
-date "2006-$(shell date +%Y)" \
-setambles ".*=>\nopreamble" \
-doc "doc/ecv.tex" \
-preamble "$(LICENSE_TEXT)" \
ecv
sed -e "$$(($$(wc -l < ecv.ins)-1))r patch/msg.txt" ecv.ins
mv $(notdir $(OBJ)) build/obj
# Build template PDFs
build/doc/%.pdf : static/template/%.tex
mkdir -p build/doc
cp $< static/template/Makefile static/template/*.png build/doc
$(MAKE) -C build/doc $(notdir $@)
# Build Documentation PDF from ecv.dtx
$(DOC_PDF) : build/obj/ecv.dtx
mkdir -p build/doc
cp $< build/doc
cd build/doc; $(LATEX) ecv.dtx
$(LICENSE) : LICENSE.txt
mkdir -p build/dist
cp $^ $@
clean:
rm -rf build
rm -rf dist
.PHONY: default compile dist clean