The the following is the Generic Makefile:
PHP=php
all: premake all_subdirs all_curdirpages postmake
premake:
if test -x ./premake.sh; then ./premake.sh; fi
postmake:
if test -x ./postmake.sh; then ./postmake.sh; fi
include Makefile.dep
all_subdirs: $(subdirs)
for dir in $(subdirs); do (cd $$dir; make); done
all_curdirpages: $(pages)
$(filter %.html,$(pages)): %.html: %.tpl
$(PHP) $< > $@
touch timestamp
clean:
for dir in $(subdirs); do (cd $$dir; make clean); done
rm -f *.html timestamp *.gen
.PHONY: all clean all_subdirs all_curdirpages premake postmake $(subdirs) $(dep_phony)
This Makefile is put (symbolic-link) in all sub-directories of the homepage. In other words, all sub-directories use the same Makefile. So, it is called
subdirs=blog secImage
pages=index.html tba.html contact.html
index.html: index.tpl header.tpl footer.tpl rightbar.tpl \
lib/search.tpl lib/acknowledgement.tpl blog/recent/index.html
contact.html: contact.tpl header.tpl footer.tpl rightbar.tpl \
lib/search.tpl lib/acknowledgement.tpl
tba.html: tba.tpl header.tpl footer.tpl
The "subdirs" macro defines the the sub-directories requiring to process, and the "pages" macro defines the HTML pages requiring to generated. The "Makefile.dep" file also defines the dependency of HTML files to the template files (*.tpl).
To build the homepage, I only need to issue the "make" command in the root directory of the homepage source.
No comments:
Post a Comment