summaryrefslogtreecommitdiff
path: root/beamer_lecture.mk
blob: 66c7da0362fdd31503dfbdb4aecdbf9d80c44bd0 (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
# -*- make -*-
# (C) 2014 by Eugeniy Mikhailov, <evgmik@gmail.com>

# lecturedir = $(shell basename $(CURDIR))
# lecture_num = $(lecturedir:lecture%=%)

ifneq ($(strip $(lecture_num)),)
CLEAN_TARGETS      += 
REAL_CLEAN_TARGETS += real_clean_beamer_lecture_headers real_clean_toc

beamer_lecture_presentation_tex = lecture$(lecture_num)_presentation.tex
beamer_lecture_handout_tex = lecture$(lecture_num)_handouts.tex


beamer_lecture_tex =  $(beamer_lecture_presentation_tex) $(beamer_lecture_handout_tex)
beamer_lecture_pdf = $(beamer_lecture_tex:%.tex=%.pdf)

tex_independent = $(beamer_lecture_tex)
beamer_lecture_includes = $(wildcard body/*.tex)

beamer_lecture_inputs += $(beamer_lecture_includes:%=\\\\input{%})
toc_t2t_incl ?= toc.t2t
toc_md_incl ?= toc.md_incl


toc: $(toc_t2t_incl) $(toc_md_incl)

toc_t2t: $(toc_t2t_incl)
$(toc_t2t_incl): $(tex_includes) $(beamer_lecture_tex)
	../bin/lecture_toc_creator.sh > $@

toc_md: $(toc_md_incl)
$(toc_md_incl): $(tex_includes) $(beamer_lecture_tex)
	../bin/lecture_toc_md_creator.sh > $@

real_clean_toc:
ifneq ($(strip $(toc_t2t_incl)),)
	rm -f $(toc_t2t_incl)
endif
ifneq ($(strip $(toc_md_incl)),)
	rm -f $(toc_md_incl)
endif

real_clean_beamer_lecture_headers:
	rm -f $(beamer_lecture_tex)

dest_dir_beamer_lecture: 
	$(INSTALL) -d -m 0755 $(dest_dir)

pdf_beamer_lecture_tex: $(beamer_lecture_pdf)

install_pdf_beamer_lecture_tex: dest_dir_beamer_lecture pdf_beamer_lecture_tex
ifneq ($(strip $(beamer_lecture_pdf)),)
	$(INSTALL) -m 0644 $(beamer_lecture_pdf) $(dest_dir)/
endif


$(beamer_lecture_handout_tex):
	cat ../tex_preambule/lecture_handout.textemplate \
		|       sed s/%%%date%%%/"${tex_date}"/ \
		|       sed s!%%%body_includes%%%!"${beamer_lecture_inputs}"! \
		>  $@
				
$(beamer_lecture_presentation_tex):
	cat ../tex_preambule/lecture_presentation.textemplate \
		|       sed s/%%%date%%%/"${tex_date}"/ \
		|       sed s!%%%body_includes%%%!"${beamer_lecture_inputs}"! \
		>  $@

# end of lecture_num if conditon
endif