# generic utility modules # (c) 2001 jannet it services # contact@jannet.de # $Id$ FMT_OFFLINE = tex dvi ps pdf txt FMT = $(FMT_OFFLINE) html OUT = $(DISTDIR)/$(PROJECT) FMT_OUT = $(patsubst %,$(OUT).%.zip,$(FMT)) FMT_OFFLINE_OUT = $(patsubst %,$(OUT).%.zip,$(FMT_OFFLINE)) ALL = $(FMT_OUT) html_install PRE_HTML = $(patsubst %.tmpl,%,$(wildcard *.html.tmpl)) PRE_TEX = $(patsubst %.tmpl,%,$(wildcard *.tex.tmpl)) TEXSRC = $(wildcard *.tex $(IMAGEDIR)/* $(LOCAL_SRC)) $(PRE_TEX) DATE := $(shell date +'%b, %d, %Y') WD = `pwd` NEWDIRS = $(DISTDIR) $(HTMLDIR) $(DVIDIR) define replace_macros @echo replacing macros in templates cat $< | sed -e "\ s/__DATE__/$(DATE)/g; \ s/__AUTHORS__/$(AUTHORS)/g; \ s/__TITLE__/$(TITLE)/g; \ s/__SUBTITLE__/$(SUBTITLE)/g; \ " > $@ endef all: $(ALL) tex: $(OUT).tex.zip dvi: $(OUT).dvi.zip ps: $(OUT).ps.zip txt: $(OUT).txt.zip html: $(OUT).html.zip %.tex: %.tex.tmpl $(replace_macros) %.html: %.html.tmpl $(replace_macros) cfgtest.done: test -n "$(PROJECT)" # PROJECT test -n "$(DISTDIR)" # DISTDIR test -n "$(HTMLDIR)" # HTMLDIR test -n "$(TARGET_HOST)" # TARGET_HOST test -n "$(TARGET_DIR)" # TARGET_DIR test -n "$(TARGET_DIR_MODE)" # TARGET_DIR_MODE test -n "$(TARGET_FILE_MODE)" # TARGET_FILE_MODE test -n "$(TARGET_USER)" # TARGET_USER test -n "$(MAIN)" # MAIN test -n "$(IMAGEDIR)" # MAIN test -n "$(AUTHORS)" # AUTHORS test -n "$(TITLE)" # TITLE test -n "$(SUBTITLE)" # SUBTITLE touch $@ cfgtest: cfgtest.done %.clean: rm -rf $(OUT).%.zip dirs.done: mkdir -p $(NEWDIRS) touch dirs.done dirs: dirs.done platform: test $(shell uname -s) = Linux xdvi: @echo "-- running latex just once ..." latex $(MAIN).tex xdvi $(MAIN).dvi $(OUT).tex.zip: cfgtest dirs $(TEXSRC) @echo "-- creating zipfile with tex source files" zip $@ $(TEXSRC) 2>/dev/null $(PROJECT).dvi: $(TEXSRC) @echo "-- creating dvi file" echo $(TEXSRC) latex $(MAIN).tex; latex $(MAIN).tex; latex $(MAIN).tex; cp $(MAIN).dvi $@ $(OUT).dvi.zip: $(PROJECT).dvi $(wildcard *.eps) zip $@ $^ $(PROJECT).txt: $(PROJECT).dvi @echo "-- creating plain ascii file" dvi2tty $< -w100 -o $@ $(OUT).txt.zip: $(PROJECT).txt zip $@ $< $(HTMLDIR): $(TEXSRC) $(FMT_OFFLINE_OUT) $(PRE_HTML) test $(MAIN) != index rm -rf $@ mkdir -p $@ latex2html -split 4 -show_section_numbers -dir $(HTMLDIR) $(MAIN).tex for OLD in $(HTMLDIR)/*.html ; do sed "s/file:\/usr\/lib\/latex2html\/icons\///g;" $$OLD>$$OLD.new; mv $$OLD.new $$OLD; done rm $(HTMLDIR)/$(MAIN).html cd $(HTMLDIR); sed "s/$(MAIN).html/index.html/g;" node1.html > node1.html.new ; mv node1.html.new node1.html cp -r $(DISTDIR) $@/download cat index_head.html > $(HTMLDIR)/index.html for FILE in $(wildcard $(DISTDIR)/*); do SIZE=`ls -lk $$FILE | awk '{print $$5}'`;\ echo \