CS 330 Lecture 3 – Make
Agenda
- what ?s
- what does this do?
- graph this
- capturing shell sequences with make
TODO
- Try out Ruby at http://tryruby.org.
- Watch a mini-documentary about Grace Hopper, creator of Cobol, one of the first high-level languages.
- Respond to these on a 1/4 sheet with 3-4 observations or questions.
What Does This Do?
#!/bin/sh if [ `uname` = "Darwin" ]; then clipboard=pbcopy else clipboard=xsel fi echo `pwd`/$1 | $clipboard
#!/usr/bin/env zsh id=$1 vim $(grep -r -l $id *)
#!/usr/bin/env zsh if [[ $# -ne 1 ]]; then echo "Usage: $0 file" >&2 exit 1 fi f=$1 say -f $f -o ${f:r}.aiff
Graph
Compose a graph showing the dependencies between the various files used to create a sign for Bring Your Pet to Class day:
- File
footer.tex
is created by runninggenfooter
, which replaces all instances ofEMAIL
infooter.template
with the contents of fileemail
. - File
sign.pdf
is created by runningpdflatex
onsign.tex
, which includesfooter.tex
,header.tex
, andmural.png
. - File
header.tex
is not generated, but edited manually. - File mural.png assembles
images[1-9].png
into a mural using ImageMagick’smontage
utility.
Represent each file as a node in your graph. Draw an edge from each file to its dependencies.
Code
petsday@uwec.edu
footer.template
Questions? Email #EMAIL.
genfooter
#!/bin/sh
email=`cat email`
sed -e "s/#EMAIL/$email/" footer.template
header.tex
Next Tuesday is Bring Your Pets to Class Day!
sign.tex
\documentclass{article}
\usepackage{graphicx}
\begin{document}
\Large
\begin{center}
\input{header}
\includegraphics[width=0.99\linewidth]{mural}
\input{footer}
\end{center}
\end{document}
makefile
Note to copy and pasters: makefile rules need to be indented with real tabs, not spaces.
sign.pdf: header.tex footer.tex mural.png sign.tex
@echo "$@ is out-of-date. Newer: $?"
pdflatex sign.tex
footer.tex: footer.template email genfooter
@echo "$@ is out-of-date. Newer: $?"
./genfooter > footer.tex
mural.png: image1.png image2.png image3.png image4.png image5.png image6.png image7.png image8.png image9.png
@echo "$@ is out-of-date. Newer: $?"
montage -geometry '400x400+5+5>' -shadow $^ mural.png
Haiku
synonyms
Let’s mechanize it
Let’s forget how to do this
This wheel is perfect
Let’s mechanize it
Let’s forget how to do this
This wheel is perfect