# Makefile for generate html/xhtml/latex from Viki source
#
# Rongjun Mu, Aug. 23, 2004
#
# $Id: makefile,v 1.1.1.1 2004/09/02 16:27:36 murj Exp $
#
### user options ###
#
# output html to this directory, NO extra spaces at the end!
HTMLDIR = ~/public_html/viki
SUBDIRS = lpi vim dpkg dev # sub dirs
CSS_NAME = moon.css # the css file to copy over, located in $(CSS_PATH)
TGZ = murj_viki.tar.gz # backup all your data into this archieve
### in most cases, you need not modify the followings ###
#
# where is the css file located, NO extra spaces at the end!
CSS_PATH = ~/.deplate/css
DEPLATE = deplate
# use this module
MODULE = zh-cn
# deplate common configuration file, not used yet.
DEPLATECONFIG = ~/.deplate/config.rb
export CSS_PATH CSS_NAME DEPLATE MODULE DEPLATECONFIG # make them visible in sub dirs
SRCS := $(wildcard *.viki)
HTML := $(patsubst %.viki, $(HTMLDIR)/%.html, $(wildcard *.viki))
CSS := $(HTMLDIR)/$(CSS_NAME)
MAKEFILE := $(patsubst %, %/Makefile, $(SUBDIRS))
all : html subdirs
html : $(HTML) $(CSS)
tgz: $(TGZ) # package all of your sourcefiles
$(HTMLDIR)/%.html : %.viki
$(DEPLATE) -m $(MODULE) -d $(HTMLDIR) -f html $<
$(CSS) : $(CSS_PATH)/$(CSS_NAME)
-cp --reply=yes $(CSS_PATH)/$(CSS_NAME) $(CSS)
$(TGZ) :
-rm -f $(TGZ)
-tar cvzf $(TGZ) $(SRCS) $(SUBDIRS) makefile Makefile
.PHONY: subdirs $(SUBDIRS)
subdirs: $(MAKEFILE) $(SUBDIRS)
%/Makefile : Makefile
cp --reply=yes Makefile $@;
$(SUBDIRS):
cd $@ && $(MAKE) HTMLDIR=$(HTMLDIR)/$@
clean_all : clean_html clean_sub
clean_html :
-rm -rf $(HTML)
clean_sub :
for DIR in $(SUBDIRS); do \
cd $$DIR && $(MAKE) HTMLDIR=$(HTMLDIR)/$$DIR clean_html && cd ../; \
done