%.html: %.txt
	trans.pl $(TRANSOPTS) $(TRANSFLAGS) $(SW_OPTS) $<

%.ps: %.html
	html2ps $(HTML2PSFLAGS) -D -o $*.ps $<

%.pdf: %.ps
	ps2pdf $<  $*.pdf

TRANSFLAGS = -X Templates/coursepage.html \
	-a course.att \
	-t course.tags

default: *.html

USEFUL = REQUIRED \
	*.att \
	course.tags \
	Templates/coursepage.html \
	Templates/links.html 

*.html: $(USEFUL)

subjects.att: subjects.txt
	subjects < subjects.txt > subjects.att

.PHONY: syllabus
syllabus: schedule

.PHONY: schedule
schedule: *.att
	cd Handouts; make schedule.html

check: 
	make default; \
	cd Assignments; make default; cd ..; \
	cd Handouts; make default; cd ..; \
	cd Labs; make default; cd ..; \
	cd Outlines; make default; cd ..; \
	cd Readings; make default; cd ..; \
	echo Checked
 
pdf: 
	make *.pdf && \
	cd Assignments && make pdf && cd .. && \
	cd Handouts && make pdf && cd .. && \
	cd Labs && make pdf && cd .. && \
	cd Outlines && make pdf && cd .. && \
	cd Readings && make pdf && cd .. && \
	echo "PDFs made."
 
force: 
	trans.pl $(TRANSFLAGS) *.txt && \
	cd Assignments && make force && cd .. && \
	cd Exams && make force && cd .. && \
	cd Handouts && make force && cd .. && \
	cd Labs && make force && cd .. && \
	cd Outlines && make force && cd .. && \
	cd Readings && make force && cd .. && \
	echo Forced
