Skip to content
Snippets Groups Projects
Commit e8429ee1 authored by Jan Wille's avatar Jan Wille
Browse files

reworked makefile and rebuild pdfs

parent 0bdd003c
No related branches found
No related tags found
No related merge requests found
......@@ -3,48 +3,56 @@ NAME = test
LATEX = pdflatex
BIBTEX = biber
SUBDIRS = svg plt crc
OUTDIR = build
TEX_FLAGS = -file-line-error -interaction=nonstopmode
COM_FLAGS = -output-directory=$(OUTDIR) -quiet
GARBAGE_PATTERNS = *.aux *.bbl *.bib *.bcf *.blg *.idx *.ind *.lof *.lot *.log *.xml *.toc
# OUTDIR needs to be at least this, can not be empty:
OUTDIR = .
AUXDIR = .aux
IGNORE = src/%
GARBAGE_PATTERNS = *.aux *.bbl *.bib *.bcf *.blg *.idx *.ind *.lof *.lot *.log *.xml *.toc *.synctex(busy) *.synctex.gz(busy)
SUB_TEX_FILES = $(foreach D,$(SUBDIRS),$(wildcard $(D)/*.tex))
SUB_PDF_FILES = $(join $(dir $(SUB_TEX_FILES)),$(addprefix $(OUTDIR)/,$(notdir $(SUB_TEX_FILES:tex=pdf))))
SUB_SVG_FILES = $(foreach D,$(SUBDIRS),$(wildcard $(D)/*.svg))
SUB_PDF_TEX_FILES = $(join $(dir $(SUB_SVG_FILES)),$(addprefix $(OUTDIR)/,$(notdir $(SUB_SVG_FILES:svg=pdf))))
GARBAGE = $(foreach D,. $(SUBDIRS), $(wildcard $(addprefix $(D)/$(OUTDIR)/,$(GARBAGE_PATTERNS))))
# comment this out to get all outputs:
QUIET = -quiet
TEX_FLAGS = -file-line-error -interaction=nonstopmode -aux-directory=$(dir $@)$(OUTDIR)/$(AUXDIR) -output-directory=$(dir $@)$(OUTDIR)
# this grabs all subfiles it can find
SUB_TEX_FILES = $(filter-out $(IGNORE),$(wildcard **/*.tex))
SUB_SVG_FILES = $(filter-out $(IGNORE),$(wildcard **/*.svg))
# and makes a big list of prerequisits
SUB_FILES = $(SUB_TEX_FILES:tex=pdf) $(SUB_SVG_FILES:svg=pdf_tex)
# get src folder on include path
export TEXINPUTS:=$(CURDIR)\src
all: bib
$(LATEX) $(TEX_FLAGS) $(COM_FLAGS) $(NAME).tex
$(LATEX) -synctex=1 $(TEX_FLAGS) $(COM_FLAGS) $(NAME).tex
copy /Y $(OUTDIR)\$(NAME).pdf .\
bib: $(NAME).pdf $(OUTDIR)\$(NAME).bcf
$(BIBTEX) $(COM_FLAGS) $(NAME)
all: pdf bib
$(LATEX) $(TEX_FLAGS) $(QUIET) $(NAME).tex
$(LATEX) -synctex=1 $(TEX_FLAGS) $(QUIET) $(NAME).tex
$(OUTDIR)\$(NAME).bcf:
$(LATEX) -synctex=1 $(TEX_FLAGS) $(COM_FLAGS) $(NAME).tex
pdf: $(SUB_FILES) $(NAME).pdf
pdf: $(NAME).pdf
bib: $(OUTDIR)/$(AUXDIR)/$(NAME).bcf
$(BIBTEX) -output-directory=$(OUTDIR)/$(AUXDIR) $(QUIET) $(NAME)
$(NAME).pdf: $(NAME).tex $(SUB_PDF_FILES) $(SUB_PDF_TEX_FILES)
$(LATEX) -synctex=1 $(TEX_FLAGS) $(COM_FLAGS) $(NAME).tex
# generel latex call
%.pdf: %.tex
$(LATEX) $(TEX_FLAGS) $(QUIET) $*.tex
$(SUB_PDF_FILES): $(SUB_TEX_FILES)
cd $(subst $(OUTDIR)/,,$(dir $@)) && $(LATEX) $(TEX_FLAGS) $(COM_FLAGS) $(notdir $(@:pdf=tex))
# generell inkscape call
%.pdf_tex: %.svg
inkscape -C --export-latex $*.svg -o $*.pdf
$(SUB_PDF_TEX_FILES): $(SUB_SVG_FILES)
cd $(subst $(OUTDIR)/,,$(dir $@)) && inkscape -C --export-latex $(notdir $(@:pdf=svg)) -o $(and $(OUTDIR),$(OUTDIR)\)$(notdir $@)
# little hack if temp files are not present
%.bcf: $(NAME).tex
if exist $(NAME).pdf del $(NAME).pdf
$(MAKE) pdf
# These are NOT portable!!
clean: tidy
for %%a in ($(foreach D,$(subst /,\,$(SUB_PDF_FILES) $(SUB_PDF_TEX_FILES)) $(subst pdf,synctex.gz,$(subst /,\,$(SUB_PDF_FILES))) $(subst pdf,pdf_tex,$(subst /,\,$(SUB_PDF_TEX_FILES))) $(OUTDIR)\$(NAME).pdf $(OUTDIR)\$(NAME).synctex.gz, "$(D)")) do if exist %%~a del /q %%~a
for %%a in ($(foreach D,. $(SUBDIRS),"$(D)\$(if $(subst .,,$(OUTDIR)),$(OUTDIR),build)")) do if exist %%~a rmdir /s /q %%~a
# if exist $(NAME).pdf del $(NAME).pdf
for %%a in ($(subst /,\,$(SUB_FILES) $(SUB_SVG_FILES:svg=pdf))) do if exist %%~a del /s/q %%~a
if exist $(OUTDIR)\$(NAME).synctex.gz del $(OUTDIR)\$(NAME).synctex.gz
if exist $(OUTDIR)\$(NAME).pdf del $(OUTDIR)\$(NAME).pdf
tidy:
if exist $(or $(word 1, $(subst /,\,$(GARBAGE))), false) del /q $(subst /,\,$(GARBAGE))
for %%a in ($(OUTDIR)\$(AUXDIR) $(subst /,\,$(wildcard **/$(AUXDIR)))) do if exist %%~a rmdir /s/q %%~a
for %%a in ("$(wildcard $(GARBAGE_PATTERNS))") do if exist %%~a del /s/q %%~a
File added
File added
File added
%% Creator: Inkscape 1.0 (4035a4fb49, 2020-05-01), www.inkscape.org
%% PDF/EPS/PS + LaTeX output extension by Johan Engelen, 2010
%% Accompanies image file 'exampleSVG.pdf' (pdf, eps, ps)
%%
%% To include the image in your LaTeX document, write
%% \input{<filename>.pdf_tex}
%% instead of
%% \includegraphics{<filename>.pdf}
%% To scale the image, write
%% \def\svgwidth{<desired width>}
%% \input{<filename>.pdf_tex}
%% instead of
%% \includegraphics[width=<desired width>]{<filename>.pdf}
%%
%% Images with a different path to the parent latex file can
%% be accessed with the `import' package (which may need to be
%% installed) using
%% \usepackage{import}
%% in the preamble, and then including the image with
%% \import{<path to file>}{<filename>.pdf_tex}
%% Alternatively, one can specify
%% \graphicspath{{<path to file>/}}
%%
%% For more information, please see info/svg-inkscape on CTAN:
%% http://tug.ctan.org/tex-archive/info/svg-inkscape
%%
\begingroup%
\makeatletter%
\providecommand\color[2][]{%
\errmessage{(Inkscape) Color is used for the text in Inkscape, but the package 'color.sty' is not loaded}%
\renewcommand\color[2][]{}%
}%
\providecommand\transparent[1]{%
\errmessage{(Inkscape) Transparency is used (non-zero) for the text in Inkscape, but the package 'transparent.sty' is not loaded}%
\renewcommand\transparent[1]{}%
}%
\providecommand\rotatebox[2]{#2}%
\newcommand*\fsize{\dimexpr\f@size pt\relax}%
\newcommand*\lineheight[1]{\fontsize{\fsize}{#1\fsize}\selectfont}%
\ifx\svgwidth\undefined%
\setlength{\unitlength}{69.07548919bp}%
\ifx\svgscale\undefined%
\relax%
\else%
\setlength{\unitlength}{\unitlength * \real{\svgscale}}%
\fi%
\else%
\setlength{\unitlength}{\svgwidth}%
\fi%
\global\let\svgwidth\undefined%
\global\let\svgscale\undefined%
\makeatother%
\begin{picture}(1,0.50095973)%
\lineheight{1}%
\setlength\tabcolsep{0pt}%
\put(0,0){\includegraphics[width=\unitlength,page=1]{exampleSVG.pdf}}%
\put(0.60542618,0.3725692){\color[rgb]{0,0,0}\makebox(0,0)[lt]{\lineheight{1.25}\smash{\begin{tabular}[t]{l}$Z_1$\end{tabular}}}}%
\put(0.28648163,0.04406763){\color[rgb]{0,0,0}\makebox(0,0)[lt]{\lineheight{1.25}\smash{\begin{tabular}[t]{l}$Z_{1.1}$\end{tabular}}}}%
\put(0.30435055,0.30606594){\color[rgb]{0,0,0}\makebox(0,0)[rt]{\lineheight{1.25}\smash{\begin{tabular}[t]{r}$Z_{1.2}$\end{tabular}}}}%
\end{picture}%
\endgroup%
No preview for this file type
......@@ -57,21 +57,21 @@
\pagebreak
\begin{figure}
\centering
\includegraphics[width=0.6\textwidth, page=2]{plt/build/examplePlot.pdf}
\includegraphics[width=0.6\textwidth, page=2]{plt/examplePlot.pdf}
\caption{a nice plot}
\end{figure}
\begin{figure}
\centering
\includegraphics{crc/build/exampleCircuit.pdf}
\includegraphics{crc/exampleCircuit.pdf}
\caption{a circuit diagramm}
\end{figure}
\makeatletter
\begin{figure}
\graphicspath{{svg/build/}} % double curly brackets needet for unknown reason
\input{svg/build/exampleSVG.pdf_tex}
\graphicspath{{svg/}} % double curly brackets needet for unknown reason
\input{svg/exampleSVG.pdf_tex}
\caption{made via inkscape}
\end{figure}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment