Start fixing the Makefile

This commit is contained in:
Knoch 2023-01-13 18:21:53 +01:00
parent 5731eb3c45
commit 9a99c0aee9
6 changed files with 49 additions and 35 deletions

View File

@ -10,7 +10,7 @@ clean:
@echo Cleaning up temporary files.
@rm -rf public/*
@rm -rf temp/*
@rm -f {main,script-only}.{aux,loc,log,out,pdf,soc,toc}
@rm -f main-{script,exercises,solutions}.{aux,loc,log,out,pdf,soc,toc}
# Compile listings (only needed when listings have changed)
listings: listings/**/*
@ -21,10 +21,9 @@ tasks: exercises/**/*
./compile_tasks
# Compile a preview PDF containing all contents
preview: main.tex
echo "\newcommand\exercisemode{any}" > exercise-mode.tex
preview: main-script.tex
echo "\newcommand\listingsmode{minted}" > listings-mode.tex
pdflatex -shell-escape main.tex
pdflatex -shell-escape main-script.tex
@echo
@echo
@echo Run \'make publication\' to generate PDF and ZIP file for publication.
@ -42,51 +41,61 @@ publication-dir:
mkdir -p temp/
# Compile a printable PDF without exercises
publication-pdf-without-exercises: clean publication-dir main.tex
echo "\newcommand\exercisemode{none}" > exercise-mode.tex
publication-pdf-without-exercises: clean publication-dir main-script.tex
echo "\newcommand\listingsmode{minted}" > listings-mode.tex
pdflatex -shell-escape -jobname=script-only main.tex
pdflatex -shell-escape -jobname=script-only main.tex
pdflatex -shell-escape -jobname=script-only main.tex
mv script-only.pdf public/
pdflatex -shell-escape main-script.tex
pdflatex -shell-escape main-script.tex
pdflatex -shell-escape main-script.tex
mv main-script.pdf public/
# Compile a printable PDF with exercises and without solutions
publication-pdf-with-exercises: clean publication-dir main.tex
echo "\newcommand\exercisemode{exercises}" > exercise-mode.tex
publication-pdf-with-exercises: clean publication-dir main-exercises.tex
echo "\newcommand\listingsmode{minted}" > listings-mode.tex
pdflatex -shell-escape -jobname=script-with-exercises main.tex
pdflatex -shell-escape -jobname=script-with-exercises main.tex
pdflatex -shell-escape -jobname=script-with-exercises main.tex
mv script-with-exercises.pdf public/
pdflatex -shell-escape main-exercises.tex
pdflatex -shell-escape main-exercises.tex
pdflatex -shell-escape main-exercises.tex
mv main-exercises.pdf public/
# Compile a printable PDF with exercises and solutions
publication-pdf-with-solutions: clean publication-dir main.tex
echo "\newcommand\exercisemode{solutions}" > exercise-mode.tex
# Compile a printable PDF with solutions
publication-pdf-with-solutions: clean publication-dir main-solutions.tex
echo "\newcommand\listingsmode{minted}" > listings-mode.tex
pdflatex -shell-escape -jobname=script-with-solutions main.tex
pdflatex -shell-escape -jobname=script-with-solutions main.tex
pdflatex -shell-escape -jobname=script-with-solutions main.tex
mv script-with-solutions.pdf public/
pdflatex -shell-escape main-solutions.tex
pdflatex -shell-escape main-solutions.tex
pdflatex -shell-escape main-solutions.tex
mv main-solutions.pdf public/
# Build a ZIP file without tasks
publication-zip-without-exercises: clean publication-dir
rm -rf temp/*
cp --parents main-script.tex praeamble.tex commands.tex setup.tex content/* graphics/* listings/**/*.{tex,pdf,bib,java,txt} titlepage.tex imprint.tex temp/
cd temp && zip ../public/project-without-exercises * **/* **/**/*
# Build a ZIP file with tasks and without solutions
publication-zip-with-exercises: clean publication-dir main.tex
rm -rf temp/*
cp --parents main.tex praeamble.tex commands.tex setup.tex content/* graphics/* listings/**/*.{tex,pdf,bib,java,txt} temp/
publication-zip-with-exercises: clean publication-dir
rm -rf temp/* exercises/**/_*
cp --parents main-exercises.tex praeamble.tex commands.tex setup.tex graphics/* listings/**/*.{tex,pdf,bib,java,txt} titlepage.tex imprint.tex first-steps-with-latex.tex temp/
cp --parents exercises/**/* temp/
rm -f temp/exercises/**/*.done.{tex,bib}
rm -f temp/exercises/**/*.done.{tex,bib,synctex.gz}
rm -f temp/exercises/**/*.rend.tex
rm -f temp/exercises/**/*.aux
find temp/ -name '*.raw.*' -exec bash -c 'sed "s/\.raw\./\./g" <<<{} | xargs mv {}' \;
find temp/ -name '*.tex' -exec sed -i -e 's/\.raw\./\./g' {} \;
# TODO: Replacement of .raw not working.
sed -e 's/\.raw//g' temp/main-exercises.tex > temp/main-exercises.tex
cd temp && zip ../public/project-with-exercises * **/* **/**/*
# Build a ZIP file with tasks and solutions
publication-zip-with-solutions: clean publication-dir main.tex
rm -rf temp/*
cp --parents main.tex praeamble.tex commands.tex setup.tex content/* graphics/* listings/**/*.{tex,pdf,bib,java,txt} temp/
publication-zip-with-solutions: clean publication-dir
rm -rf temp/* exercises/**/_*
cp --parents main-solutions.tex praeamble.tex commands.tex setup.tex graphics/* listings/**/*.{tex,pdf,bib,java,txt} titlepage.tex imprint.tex first-steps-with-latex.tex temp/
cp --parents exercises/**/* temp/
rm -f temp/exercises/**/*.raw.{tex,bib}
rm -f temp/exercises/**/*.raw.{tex,bib,synctex.gz}
rm -f temp/exercises/**/*.aux
find temp/ -name '*.done.*' -exec bash -c 'sed "s/\.done\./\./g" <<<{} | xargs mv {}' \;
find temp/ -name '*.tex' -exec sed -i -e 's/(raw|done)//g' {} \;
# TODO: Replacement of .done not working.
sed -e 's/\.done//g' temp/main-solutions.tex > temp/main-solutions.tex
cd temp && zip ../public/project-with-solutions * **/* **/**/*

View File

@ -2,6 +2,8 @@
\definecolor{latexblue}{rgb}{0.9,0.925,0.95}
\pagecolor{latexblue}
\todo{Refactor text for new exercise script.}
\chapter*{First steps with \LaTeX}
\addcontentsline{toc}{section}{First steps with \LaTeX}

View File

@ -14,7 +14,7 @@
\renewcommand{\thesubsection}{\arabic{subsection}}
% Title page
\input{content/titlepage.tex}
\input{titlepage.tex}
% or simply
% \maketitle
\thispagestyle{empty}
@ -24,6 +24,8 @@
\tableofcontents
\newpage
\input{first-steps-with-latex.tex}
% Align exercise numbers with chapters
\setcounter{section}{3}

View File

@ -10,7 +10,7 @@
\frenchspacing
% Title page
\input{content/titlepage.tex}
\input{titlepage.tex}
% or simply
% \maketitle
\thispagestyle{empty}
@ -20,7 +20,6 @@
\tableofcontents
\newpage
\input{content/first-steps-with-latex.tex}
\input{content/why-use-latex.tex}
\input{content/basic-functionality.tex}
\input{content/basic-document-structure.tex}

View File

@ -14,7 +14,7 @@
\renewcommand{\thesubsection}{\arabic{subsection}}
% Title page
\input{content/titlepage.tex}
\input{titlepage.tex}
% or simply
% \maketitle
\thispagestyle{empty}
@ -24,6 +24,8 @@
\tableofcontents
\newpage
\input{first-steps-with-latex.tex}
% Align exercise numbers with chapters
\setcounter{section}{3}