This repository has been archived by the owner on Jun 2, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathMakefile
91 lines (67 loc) · 2.66 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
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
# GPLv3 (c) 2017-2018 Peter Mosmans [Radically Open Security]
#
# Part of docbuilder, the official PenText toolchain
# https://pentext.com
#
# version 1.8
# The pathname on docbuilder where this parent directory can be found
# Note that this can be supplied as parameter on the command line,
# e.g. make VAGRANTMAPPING=mymapping
VAGRANTMAPPING:="repos"
SHELL=/usr/bin/bash
SOURCE=$(shell echo $${PWD\#\#*/})
REPORT=target/report-latest.pdf
QUOTE=target/offerte-latest.pdf
SUMMARY=target/summary-latest.pdf
SSH-CONFIG=.docbuilder.ssh
VAGRANTID=$(shell vagrant global-status|awk '/docbuilder/{print $$1}')
VAGRANTSTATUS=$(shell vagrant global-status|awk '/docbuilder/{print $$4}')
# Targets that will not generate specific files
.PHONY: all clean $(QUOTE) reload $(REPORT) $(SUMMARY) test up
all: report quote summary
# symlink
offerte: quote
quote: $(QUOTE)
# symlink
pdf: report
report: $(REPORT)
verbose: $(SSH-CONFIG)
@ssh -F $(SSH-CONFIG) docbuilder "cd /$(VAGRANTMAPPING)/$(SOURCE)/source && docbuilder.py -cv"
$(REPORT): $(SSH-CONFIG)
@ssh -F $(SSH-CONFIG) docbuilder "cd /$(VAGRANTMAPPING)/$(SOURCE)/source && docbuilder.py -c"
$(QUOTE): $(SSH-CONFIG)
@ssh -F $(SSH-CONFIG) docbuilder "cd /$(VAGRANTMAPPING)/$(SOURCE)/source && docbuilder.py -i offerte.xml -o ../target/offerte-latest.pdf -x ../xslt/generate_offerte.xsl -c"
summary: $(SUMMARY)
$(SUMMARY):
@ssh -F $(SSH-CONFIG) docbuilder "cd /$(VAGRANTMAPPING)/$(SOURCE)/source && docbuilder.py -v -c --xslt ../xslt/summary.xsl -i management_summary.xml -o ../$(SUMMARY)"
$(SSH-CONFIG):
@vagrant ssh-config "$(VAGRANTID)" > $(SSH-CONFIG)
@if [ $$? -ne 0 ]; then echo "SSH not working (try 'make reload')"; exit -1; fi
clean: clear-connection
@-rm $(QUOTE) $(REPORT) 2>/dev/null || true
@echo "Removed $(QUOTE) $(REPORT)"
clear-connection:
@-rm $(SSH-CONFIG) 2>/dev/null || true
@echo "Removed $(SSH-CONFIG)"
reload:
@vagrant reload "$(VAGRANTID)"
test: test-box test-status test-connection test-path
test-box:
@echo Verifying whether docbuilder exists as box...
@if [ -z $(VAGRANTID) ]; then echo Could not find docbuilder box; exit -1; fi
@echo OK
test-status:
@echo Verifying the status of the box...
@if [ ! "$(VAGRANTSTATUS)" == "running" ]; then echo "Box not running (try 'make up')"; exit -1; fi
@echo OK
test-connection: $(SSH-CONFIG)
@echo Verifying connection to the box...
@ssh -F $(SSH-CONFIG) docbuilder id >/dev/null
@if [ $$? -ne 0 ]; then echo "Cannot connect to docbuilder (try 'make clean' first) "; exit -1; fi
@echo OK
test-path: $(SSH-CONFIG)
@echo Verifying paths...
@ssh -F $(SSH-CONFIG) docbuilder "ls /$(VAGRANTMAPPING)/$(SOURCE) 1>/dev/null" || exit -1
@echo OK
up:
@vagrant up "$(VAGRANTID)"