teaching machines

CS 330 Lecture 3 – Make

January 30, 2015 by . Filed under cs330, lectures, spring 2015.

Agenda

TODO

What Does This Do?

  1. #!/bin/sh
    
    if [ `uname` = "Darwin" ]; then
      clipboard=pbcopy
    else
      clipboard=xsel
    fi
    
    echo `pwd`/$1 | $clipboard

  2. #!/usr/bin/env zsh
    
    id=$1
    vim $(grep -r -l $id *)

  3. #!/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:

Represent each file as a node in your graph. Draw an edge from each file to its dependencies.

Code

email

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