forked from OpenTechStrategies/open-source-archetypes
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMakefile
More file actions
66 lines (55 loc) · 2.02 KB
/
Makefile
File metadata and controls
66 lines (55 loc) · 2.02 KB
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 OTS_DOCTOOLS_DIR/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 ots-doctools directory. We look in the current dir, then
### for a $OTS_DOCTOOLS_DIR environment variable, then $OTSDIR/forms/latex,
### then ~/OTS/forms/latex, then /usr/local/src/ots-doctools
# If there's a local ots-doctools dir, use it
ifneq ("$(wildcard ots-doctools)","")
OTS_DOCTOOLS_DIR = ots-doctools
else
# Otherwise maybe one's defined in the environment
ifndef OTS_DOCTOOLS_DIR
ifneq ("$(wildcard $(OTSDIR)/forms/latex)","")
OTS_DOCTOOLS_DIR = $(OTSDIR)/forms/latex
else
ifneq ("$(wildcard ~/OTS/forms/latex)","")
OTS_DOCTOOLS_DIR = ~/OTS/forms/latex
else
ifneq ("$(wildcard /usr/local/src/ots-doctools)","")
OTS_DOCTOOLS_DIR = /usr/local/src/ots-doctools
endif
endif
endif
endif
endif
# If we didn't find the OTS Latex stuff, grab it from GitHub
ifndef OTS_DOCTOOLS_DIR
$(shell git submodule add https://github.com/OpenTechStrategies/ots-doctools)
OTS_DOCTOOLS_DIR=ots-doctools
endif
all: DEPS ${TARGETS}
# Handle OTS dependencies
.PHONY: DEPS
DEPS: otsreport.cls ots.sty otslogo.pdf
otsreport.cls: $(OTS_DOCTOOLS_DIR)/otsreport.cls
ln -s $(OTS_DOCTOOLS_DIR)/otsreport.cls
ots.sty: $(OTS_DOCTOOLS_DIR)/ots.sty
ln -s $(OTS_DOCTOOLS_DIR)/ots.sty
otslogo.pdf: $(OTS_DOCTOOLS_DIR)/otslogo.pdf
ln -s $(OTS_DOCTOOLS_DIR)/otslogo.pdf
# Use the OTS-DOCTOOLS Makefile to turn .ltx into .pdf files
%.pdf: %.ltx
$(MAKE) -f ${OTS_DOCTOOLS_DIR}/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 ${OTS_DOCTOOLS_DIR}/Makefile clean
@# Remove ots-doctools submodule
git submodule deinit -f ots-doctools
rm -rf .git/modules/ots-doctools
git rm -f ots-doctools