summaryrefslogtreecommitdiff
path: root/rem.mk
blob: 04b435ac19f30dcc4b0d0391fd61a64f6e00b102 (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
# -*- make -*-
# (C) 2013 by Eugeniy Mikhailov, <evgmik@gmail.com>

CLEAN_TARGETS      += clean_rem
REAL_CLEAN_TARGETS += real_clean_rem

dest_dir_rem ?= $(dest_dir)
destination_dirs += $(dest_dir_rem)

rem_files  = $(wildcard *.rem)
html_from_rem = $(rem_files:%.rem=%.html)
html_from_rem_dest_targets = $(html_from_rem:%=$(dest_dir_rem)/%)

html_rem: $(html_from_rem)

$(html_from_rem): %.html : %.rem
	remind -pp5 \
		-iclass_starts='date($(CLASS_YEAR),$(CLASS_STARTING_MONTH),$(CLASS_STARTING_DAY))' \
		-iclass_start_time='$(CLASS_START_TIME)' \
		-iclass_duration='$(CLASS_DURATION)' \
		-iclass_ends='$(CLASS_ENDS)' \
		$< \
		$(CLASS_YEAR)/$(CLASS_STARTING_MONTH)/$(CLASS_STARTING_DAY) \
	| rem2html --stylesheet rem-default.css -title "Calendar"  | \
	sed 's/<head>/<head>\n<meta name="viewport" content="width=device-width, initial-scale=1.0">/' | \
	cat > $@

clean_rem:

real_clean_rem:
ifneq ($(strip $(html_from_rem)),)
	rm -f $(html_from_rem)
endif


install_html_from_rem: $(html_from_rem_dest_targets)

$(html_from_rem_dest_targets): $(dest_dir_rem)/% : % | $(dest_dir_rem)
ifneq ($(strip $(html_from_rem)),)
	$(INSTALL) -m 0644 '$<' '$@'
endif