# Makefile for Bioinformática na Escola web site
#
# Compiler: cheetah

all: python html
	rm $(helper_extensions)

.PHONY: all python html clean

site_base = Base.py Util.py

helper_extensions = *.py *.pyc
clean_extensions = *.html

# Both python_objects and html_objects take their names from .tmpl files
# because .py files do not exist yet.
python_objects := $(patsubst %.tmpl, %.py, $(wildcard *.tmpl))

# html_objects ignores templates beginning with an uppercase letter, which
# contain Python base and helper classes.
html_objects := $(patsubst %.tmpl, %.html, $(wildcard [^[:upper:]]*.tmpl))

%.py : %.tmpl
	cheetah compile --nobackup $<

%.html : %.py ${site_base}
	python $< > $@

python : $(python_objects)

html : $(html_objects)

clean:
	rm $(clean_extensions)