Skip to content

Instantly share code, notes, and snippets.

@ad2476
Created February 22, 2017 20:51
Show Gist options
  • Save ad2476/a4a3defa047b724bb3400e4b2490938c to your computer and use it in GitHub Desktop.
Save ad2476/a4a3defa047b724bb3400e4b2490938c to your computer and use it in GitHub Desktop.
Automate compiling cs142 writeup and sending it to CIT printers
.PHONY: all clean print friend
HW = $(shell basename $(CURDIR))
PRINTER = c4
USER = username
FRIEND = yourfriend
DEPS = cover.pdf writeup.pdf hw2.pdf
TARGET = $(HW).pdf
all: $(TARGET)
clean:
rm *.pdf *.aux *.log
friend:
zwrite $(FRIEND) -m "Handin my homework from $(PRINTER) pls"
print: $(TARGET)
scp $(TARGET) $(USER)@ssh.cs.brown.edu:~/course/cs142/$(HW)/
ssh $(USER)@ssh.cs.brown.edu "lpr -P $(PRINTER) ~/course/cs142/$(HW)/$(TARGET)"
$(TARGET): cover.pdf writeup.pdf
gs -dBATCH -dNOPAUSE -q -sDEVICE=pdfwrite -sOutputFile=$@ cover.pdf writeup.pdf
writeup.pdf: writeup.tex
pdflatex writeup.tex && pdflatex writeup.tex
cover.pdf:
wget http://cs.brown.edu/~pff/engn2520/$(HW)/$(HW).pdf -O assign.pdf
gs -dBATCH -dNOPAUSE -q -dSAFER -sDEVICE=pdfwrite -dFirstPage=1 -dLastPage=1 -SOutputFile=$@ assign.pdf
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment