-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
42 lines (36 loc) · 1.17 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
#Author: Polonio Davide <poloniodavide@gmail.com>
#License: GPLv3
OUTPUT_NAME= CorsoDiR
LIST_NAME= listOfSections.tex
PATH_OF_CONTENTS= res/sections
PATH_OF_RNW= res/Rnw
MAIN_FILE= main
CC= latexmk
JOB_NAME=-jobname='$(OUTPUT_NAME)'
CCFLAGS= -pdflatex='pdflatex -interaction=nonstopmode' -pdf
SHELL := /bin/bash #Need bash not shell
all: rinclude rparsing compile
rinclude:
for i in $(wildcard $(PATH_OF_RNW)/*.Rnw.include); do \
echo "Compiling $(notdir $$i)..."; \
Rscript -e "library(knitr); knit('$$i', '$$i.generated.tex')"; \
done; \
rparsing:
for i in $(wildcard $(PATH_OF_RNW)/*.Rnw); do \
echo "Compiling $$i..."; \
Rscript -e "library(knitr); knit('$$i', '$$i.generated.tex')"; \
mv $$i.generated.tex $(PATH_OF_CONTENTS); \
done; \
compile:
if [[ -a "res/$(LIST_NAME)" ]]; then echo "Removing res/$(LIST_NAME)"; \
rm res/$(LIST_NAME); fi; \
for i in $(sort $(wildcard $(PATH_OF_CONTENTS)/*.tex)); do \
echo "Adding $$i into $(LIST_NAME)"; \
echo "\input{$$i}" >> res/$(LIST_NAME); \
done; \
$(CC) -C $(JOB_NAME); \
$(CC) $(CCFLAGS) $(JOB_NAME); \
clean:
git clean -Xfd
$(CC) -C $(JOB_NAME)
if [[ -a "$(OUTPUT_NAME)" ]]; then rm -rv $(OUTPUT_NAME)/; fi;