-
Notifications
You must be signed in to change notification settings - Fork 9
/
Makefile
76 lines (57 loc) · 1.97 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
75
76
TEMPLATES = $(wildcard *.cftemplate)
PURCHASE_AGREEMENTS = $(addsuffix .cform,$(addprefix purchase-agreement-,single-cash single-ip single-mixed double-cash double-ip double-mixed))
FORMS = $(filter-out purchase-agreement.cform,$(TEMPLATES:.cftemplate=.cform)) $(PURCHASE_AGREEMENTS)
COMMONFORM = node_modules/.bin/commonform
CFTEMPLATE = node_modules/.bin/cftemplate
DOCX = $(addprefix build/,$(FORMS:.cform=.docx))
PDF = $(addprefix build/,$(FORMS:.cform=.pdf))
EDITION = $(strip $(shell git tag -l --points-at HEAD))
all: $(DOCX)
pdf: $(PDF)
$(COMMONFORM) $(CFTEMPLATE): package.json
npm i
%.pdf: %.docx
doc2pdf $<
build:
mkdir -p build
build/%.docx: %.cform %.options_with_edition %.sigs.json $(COMMONFORM) build
$(COMMONFORM) render --format docx --signatures $*.sigs.json $(shell cat $*.options_with_edition) < $< > $@
build/%.docx: %.cform %.options_with_edition $(COMMONFORM) build
$(COMMONFORM) render --format docx $(shell cat $*.options_with_edition) < $< > $@
%.cform: $(CFTEMPLATE) %.cftemplate %.options.json
$^ > $@
purchase-agreement-%.sigs.json: purchase-agreement.sigs.json
cp $< $@
purchase-agreement-%.options.json: generate-options.js
node $< $@ > $@
purchase-agreement-%.cftemplate: purchase-agreement.cftemplate
cp $< $@
purchase-agreement-%.options: purchase-agreement.options
cp $< $@
%.options_with_edition: %.options
ifeq ($(EDITION),)
cat $< | sed 's/EDITION/Ironsides Development Draft/' > $@
else
cat $< | sed 's/EDITION/Ironsides $(EDITION)/' > $@
endif
%.options.json:
echo "{}" > $@
.PHONY: lint critique clean docker
lint: $(FORMS) $(COMMONFORM)
for form in $(FORMS); do \
echo ; \
echo $$form; \
$(COMMONFORM) lint < $$form; \
done; \
critique: $(FORMS) $(COMMONFORM)
for form in $(FORMS); do \
echo ; \
echo $$form ; \
$(COMMONFORM) critique < $$form; \
done
clean:
rm -rf $(DOCX) $(PDF) $(FORMS)
docker:
docker build -t ironsides .
docker run -v $(shell pwd)/build:/app/build ironsides
sudo chown -R `whoami`:`whoami` build