aboutsummaryrefslogtreecommitdiffstats
path: root/lib/Makefile
blob: 535809f6476d6776785536e06d0a5421f4ebb620 (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
#!/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

# Targets

.PHONY: all

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

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

# Archive

.PHONY: archive

ARCHIVE ?= archive
ROOT ?= $(shell git rev-parse --show-toplevel)
SUFFIX ?= -$(subst /,,$(dir $(subst $(ROOT),,$(PWD))))
PDF ?= $(basename $(wildcard *.pdf))

print:
	@echo ARCHIVE = $(ARCHIVE) 
	@echo ROOT = $(ROOT) 
	@echo SUFFIX = $(SUFFIX)

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

# 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

# Clean

.PHONY: clean

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

# Sends to fripost.org for publication