mirror of
ssh://git.janware.com/srv/git/janware/proj/jw-pkg
synced 2026-01-15 03:53:32 +01:00
tex.mk: Add file
This commit is contained in:
parent
46c67d77fc
commit
5ec7cc839c
1 changed files with 124 additions and 0 deletions
124
make/tex.mk
Normal file
124
make/tex.mk
Normal file
|
|
@ -0,0 +1,124 @@
|
|||
# generic utility modules
|
||||
# (c) 2001 jannet it services
|
||||
# contact@jannet.de
|
||||
# $Id$
|
||||
|
||||
CFG_VARS = PROJECT DISTDIR HTMLDIR TARGET_HOST TARGET_DIR \
|
||||
TARGET_DIR_MODE TARGET_FILE_MODE TARGET_USER MAIN
|
||||
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
|
||||
TEXSRC = $(wildcard *.tex *.gif *.bmp Makefile)
|
||||
|
||||
WD = `pwd`
|
||||
NEWDIRS = $(DISTDIR) $(HTMLDIR) $(DVIDIR)
|
||||
|
||||
all: $(ALL)
|
||||
|
||||
tex: $(OUT).tex.zip
|
||||
dvi: $(OUT).dvi.zip
|
||||
ps: $(OUT).ps.zip
|
||||
txt: $(OUT).txt.zip
|
||||
html: $(OUT).html.zip
|
||||
|
||||
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
|
||||
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"
|
||||
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)
|
||||
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_template_head.html > $(HTMLDIR)/index.html
|
||||
for FILE in $(DISTDIR); do SIZE=`ls -lk $$FILE | awk '{print $$5}'`;\
|
||||
echo \<CENTER\>\<A HREF="download/$$FILE"\>$$FILE \(size = $$SIZE Bytes\)\</A\>\</CENTER\> >> $(HTMLDIR)/index.html ;\
|
||||
echo >> $(HTMLDIR)/index.html ;\
|
||||
done
|
||||
cat index_template_tail.html >> $(HTMLDIR)/index.html
|
||||
cp *.gif $(HTMLDIR)
|
||||
touch $@
|
||||
|
||||
$(OUT).html.zip: dirs $(HTMLDIR)
|
||||
@echo "-- creating zipfile with html source files"
|
||||
zip -r $@ $(HTMLDIR)
|
||||
|
||||
$(PROJECT).ps: $(PROJECT).dvi
|
||||
@echo "-- creating postscript file"
|
||||
dvips $<
|
||||
|
||||
$(OUT).ps.zip: $(PROJECT).ps dirs
|
||||
zip $@ $<
|
||||
|
||||
$(PROJECT).pdf: $(PROJECT).ps
|
||||
@echo "-- creating pdf file"
|
||||
ps2pdf $<
|
||||
|
||||
$(OUT).pdf.zip: $(PROJECT).pdf
|
||||
zip $@ $<
|
||||
|
||||
html_install: $(HTMLDIR)
|
||||
@echo "-- installing html to $(TARGET_HOST):$(TARGET_DIR) as user $(TARGET_USER)"
|
||||
ssh -l $(TARGET_USER) $(TARGET_HOST) -C "\
|
||||
mkdir -p $(TARGET_DIR); chmod $(TARGET_DIR_MODE) $(TARGET_DIR)"
|
||||
/usr/bin/rsync -a --delete -v --links -e /usr/bin/ssh $(HTMLDIR)/* $(TARGET_USER)@$(TARGET_HOST):$(TARGET_DIR)
|
||||
ssh -l $(TARGET_USER) $(TARGET_HOST) -C "\
|
||||
cd $(TARGET_DIR); find . -type d | xargs chmod $(TARGET_DIR_MODE); find . -type f | xargs chmod $(TARGET_FILE_MODE)"
|
||||
|
||||
clean:
|
||||
@echo "-- cleaning up ..."
|
||||
rm -rf *.aux *.toc *.dvi *.pdf *.ps *~ *.log *.done $(NEWDIRS)
|
||||
|
||||
Loading…
Add table
Add a link
Reference in a new issue