Newer
Older
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
# This is a document-specific Makefile. Matters that are specific to
# this doc can be put here. More general LaTeX building targets can
# go in OTSLTXDIR/Makefile, which this one calls.
# By default, we build all .ltx files in this dir
SOURCE=$(wildcard *.ltx)
TARGETS=$(SOURCE:.ltx=.pdf)
### Try to find otsltx directory. We look in the current dir, then
### for a $OTSLTXDIR environment variable, then $OTSDIR/forms/latex,
### then ~/OTS/forms/latex, then /usr/local/src/otsltx
# If there's a local otsltx dir, use it
ifneq ("$(wildcard otsltx)","")
OTSLTXDIR = otsltx
else
# Otherwise maybe one's defined in the environment
ifndef OTSLTXDIR
ifneq ("$(wildcard $(OTSDIR)/forms/latex)","")
OTSLTXDIR = "$(OTSDIR)/forms/latex"
else
ifneq ("$(wildcard ~/OTS/forms/latex)","")
OTSLTXDIR = "~/OTS/forms/latex"
else
ifneq ("$(wildcard /usr/local/src/otsltx)","")
OTSLTXDIR = "/usr/local/src/otsltx"
endif
endif
endif
endif
endif
# If we didn't find the OTS Latex stuff, grab it from GitHub
ifndef OTSLTXDIR
#$(error Cannot find OTSLTX materials. Please install OTSLTX, set OTSLTXDIR, and/or put OTSLTX in this directory.)
$(shell git submodule add https://github.com/OpenTechStrategies/otsltx)
OTSLTXDIR=otsltx
endif
all: DEPS ${TARGETS}
# Handle OTS dependencies
.PHONY: DEPS
DEPS: otsreport.cls ots.sty otslogo.pdf
otsreport.cls: $(OTSLTXDIR)/otsreport.cls
ln -s $(OTSLTXDIR)/otsreport.cls
ots.sty: $(OTSLTXDIR)/ots.sty
ln -s $(OTSLTXDIR)/ots.sty
otslogo.pdf: $(OTSLTXDIR)/otslogo.pdf
ln -s $(OTSLTXDIR)/otslogo.pdf
# Use the OTSLTX Makefile to turn .ltx into .pdf files
%.pdf: %.ltx
$(MAKE) -f ${OTSLTXDIR}/Makefile $@
clean:
rm -f otsreport.cls ots.sty otslogo.pdf
@# Delete PDFs that we do not care enough about to check into the repo
@$(foreach x,${TARGETS}, git status -s ${x} | grep -q "M ${x}" || rm -f ${x};)
$(MAKE) -f ${OTSLTXDIR}/Makefile clean
@# Remove otsltx submodule
git submodule deinit -f otsltx
rm -rf .git/modules/otsltx
git rm -f otsltx