aboutsummaryrefslogtreecommitdiffstats
path: root/lib/Makefile
blob: 3a4e046a9f98f75866ba07925962fd98bfe48677 (plain)
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
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
#!/usr/bin/env make -f
#
# General library Makefile for Fripost meeting minutes and policy
# documents.

SLIDES ?=   # will be compiled with beamer 
MINUTES ?=  # will be compiled with *minutes* template
POLICY ?=   # will be compiled with *by-laws* template
REPORTS ?=   # will be compiled with *report* template
EXCERPTS ?=  # will be compiled with *minutes* template from encrypted source

# Repository root

ROOT ?= $(shell git rev-parse --show-toplevel)

# Targets

.PHONY: all

ALL ?= \
 $(addsuffix .pdf, $(SLIDES)) \
 $(addsuffix .pdf, $(POLICY)) \
 $(addsuffix .pdf, $(MINUTES)) \
 $(addsuffix .pdf, $(REPORTS)) \
 $(addsuffix .pdf, $(EXCERPTS)) \


all: $(ALL)

# Compilation using pandoc

$(addsuffix .pdf, $(SLIDES)): %.pdf: %.md
	pandoc -s -f markdown -t beamer -o $@ < $<

$(addsuffix .pdf, $(MINUTES)): %.pdf: %.md
	pandoc -f markdown -t latex \
	  --template=fripost-minutes \
	  $$(test -f $*.yml && echo --metadata-file=$*.yml) \
	  -o $@ $*.md

$(addsuffix .pdf, $(POLICY)): %.pdf: %.md
	pandoc -f markdown -t latex \
	  --template=fripost-by-laws \
	  $$(test -f $*.yml && echo --metadata-file=$*.yml) \
	  -o $@ $*.md

$(addsuffix .pdf, $(REPORTS)): %.pdf: %.md
	pandoc -f markdown -t latex \
	  --template=fripost-report \
	  $$(test -f $*.yml && echo --metadata-file=$*.yml) \
	  -o $@ $*.md

# Compile encrypted minute excerpt

$(addsuffix .pdf, $(EXCERPTS)): %.pdf: %.md.gpg
	gpg -d < $< | \
	pandoc -f markdown -t latex \
	  --template=fripost-minutes \
	  -o $@

# Refresh markdown if YAML meta data files are touched

.PHONY: refresh

YML := $(basename $(wildcard *.yml))

refresh: $(addsuffix .md, $(YML))

%.md: %.yml
	touch -r $< $@

# Archive

.PHONY: archive

ARCHIVE ?= archive
SUFFIX ?= -$(subst /,,$(dir $(subst $(ROOT),,$(PWD))))
PDF ?= $(basename $(wildcard *.pdf))

archive:
	for p in $(PDF); do \
	   rsync $$p.pdf $(ROOT)/$(ARCHIVE)/$$p$(SUFFIX).pdf; \
	done

# Sync from shared meeting working directory

SRC ?= $(FRIPOST_SYNC_SRC)

sync:
	FRIPOST_SYNC_SRC="$(SRC)" $(ROOT)/lib/sync


# Upload to server

.PHONY: send

SEND ?=  # files to send

send:
	rsync -ruvp --chmod=Dugo+rx,Fugo+r $(SEND)\
	 www.fripost.org:/var/www/fripost.org/minutes
	@echo; echo Now avialable as; \
	for f in $(SEND); do echo " - https://fripost.org/minutes/$$f"; done

# Generate a minute outline from an agenda

outline-minutes:
	$(ROOT)/lib/outline-minutes

# Clean

.PHONY: clean

clean:
	rm -f $(ALL)
	rm -f *~

# Sends to fripost.org for publication