+\begin{frame}[fragile]{Simple Makefile}
+\begin{minted}[showtabs]{make}
+hello_world:
+ echo "hello world" > hello_world
+\end{minted}
+
+\end{frame}
+
+\subsection{General Syntax}
+
+\begin{frame}[fragile]{Simple Makefile}
+\begin{minted}[showtabs]{make}
+TARGETS: PREREQUISITES
+ RECIPE
+\end{minted}
+\begin{itemize}
+\item TARGETS are file names separated by spaces
+\item PREREQUISITES are file names separated by spaces.
+\item RECIPE lines start with a tab, are executed by the shell and
+ describe how to make the TARGETS (generally from the PREREQUISITES)
+\item A TARGET is out of date if it does not exist or if it is older
+ than any of the prerequisites.
+\end{itemize}
+\end{frame}
+
+\subsection{Variables}
+
+\begin{frame}[fragile]{Some Variables}
+\begin{itemize}
+\item Two flavors of variables
+ \begin{itemize}
+ \item \mintinline{make}{FOO=bar} -- recursively expanded variables;
+ references to other variables are expanded at the time this
+ variable is expanded
+ \item \mintinline{make}{FOO:=bar} -- simply expanded variables; the
+ value is assigned at the moment the variable is created
+ \end{itemize}
+\item Variables can come from the environment and can be overridden on
+ the command line: \mintinline{shell}{FOO=blah make} or
+ \mintinline{shell}{make FOO=bleargh}.
+\item \mintinline{make}{$@} -- target name %$
+\item \mintinline{make}{$*} -- current stem %$
+\item \mintinline{make}{$^} -- all prerequisites %$
+\item \mintinline{make}{$<} -- first prerequisite %$
+\item \mintinline{make}{$(FOO)} -- how variables are referenced %$
+\end{itemize}
+\end{frame}
+
+\subsection{Functions}
+
+\begin{frame}[fragile]{Some Functions}
+ \begin{itemize}
+ \item \mintinline{make}{$(patsubst %.sam,%.bam,foo.sam bar.sam)} %$
+ -- returns foo.bam bar.bam.
+ \item \mintinline{make}{$(filter-out %.bam,foo.sam bar.bam)} %$
+ -- returns foo.sam
+ \item \mintinline{make}{$(words foo.sam bar.bam)} %$
+ -- returns the number of words in its argument (2)
+ \item \mintinline{make}{$(wordlist 1,2,foo.sam bar.bam bleargh.foo)} %$
+ -- returns the words in its last argument starting with the 1st
+ and ending with the second.
+ \end{itemize}
+\end{frame}
+
+\subsection{Rules}
+
+\subsubsection{Default Target}
+
+\begin{frame}[fragile]{How does make know what to build?}
+\begin{minted}[showtabs]{make}
+first_target:
+ touch $@
+second_target: first_target
+ touch $@
+\end{minted}
+ \begin{itemize}
+ \item By default, make builds the first target.
+ \item You can specify a specific target to build on the command line
+ (\mintinline{shell}{make first_target}).
+ \item You can change the default target by using the variable
+ \mintinline{make}{.DEFAULT_GOAL := second_target}
+ \end{itemize}
+\end{frame}
+
+
+\subsubsection{Special Targets}
+
+\begin{frame}[fragile]{Special Targets}
+\begin{minted}[showtabs]{make}
+.PHONY: clean
+
+clean:
+ rm -f first_target second_target
+\end{minted}
+ \begin{itemize}
+ \item \mintinline{make}{.PHONY} -- any time make considers this
+ target, it is run unconditionally, even if a file exists.
+ \item \mintinline{make}{.ONESHELL} -- when a target is built, all
+ lines will be given to a single invocation of the shell.
+ \item Lots of other special targets which are not described here.
+ \end{itemize}
+\end{frame}
+
+
+\subsubsection{Pattern Rules}
+
+
+\begin{frame}[fragile]{Special Targets}
+\begin{minted}[showtabs]{make}
+%.fasta: %.fasta.gz
+ gzip -dc $< > $@
+
+%.bam: %.sam
+ samtools view -b -o $@ $<
+\end{minted}
+ \begin{itemize}
+ \item \% is the pattern stem which is accessible by
+ \mintinline{make}{$*} %$ within rules
+ \item The first rule uncompresses fasta files
+ \item The second rule turns sam files into bam files
+ \end{itemize}
+\end{frame}
+