tex.mk: Add support for parsing source code labels

Add support for parsing source code labels to tex.mk (not a beauty, yet).
This commit is contained in:
Jan Lindemann 2001-08-08 19:06:43 +00:00 committed by Jan Lindemann
commit 13d62992ff

View file

@ -16,7 +16,12 @@ 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 %.ger,%.tex,$(patsubst %.tmpl,%,$(wildcard *.tex.tmpl *.ger) $(LOCAL_IMPORTED_TEMPLATES)))
LINETMPL=$(wildcard *.linetmpl)
TEXFROMGER=$(patsubst %.ger,%.tex,$(wildcard *.ger))
#GERFROMLINETMPL=$(patsubst %.linetmpl,%,$(wildcard *.linetmpl))
PRE_TEX = $(patsubst %.ger,%.tex,\
$(patsubst %.tmpl,%,$(wildcard *.tex.tmpl *.ger.tmpl) $(LOCAL_IMPORTED_TEMPLATES)) \
$(GERFROMLINETMPL)) $(TEXFROMGER)
TEXSRC = $(wildcard *.tex) $(IMAGES) $(LOCAL_SRC) $(PRE_TEX)
DATE := $(shell date +'%b, %d, %Y')
TEX_WARN_DONT_EDIT = "\
@ -28,6 +33,21 @@ TEX_WARN_DONT_EDIT = "\
WD = `pwd`
NEWDIRS = $(DISTDIR) $(HTMLDIR) $(DVIDIR)
define replace_linenumbers
@echo replacing line numbers in templates
cat $< | awk ' \
BEGIN { FS=":" } { \
if ($$0 ~ /SUBST_LINE_NUM/) { \
start=$$1; patt=$$2; file=$$3; \
regex=$$4; offset=$$5; rest=$$6; \
grepcmd="grep -n \042" regex "\042 " file; \
grepcmd | getline; \
linenum=$$1; \
print start linenum rest \
} else { print $$0 } } \
' >> $@
endef
define replace_macros
@echo replacing macros in templates
TMPIMAGEDIR="`echo $(IMAGEDIR) | sed -e 's/\//\\\\\//g;'`" ;\
@ -46,7 +66,17 @@ define replace_macros
s/__ICON_CONTENTS__/$(ICON_CONTENTS)/g; \
s/__ICON_PREV__/$(ICON_PREV)/g; \
s/__ICON_NEXT__/$(ICON_NEXT)/g; \
" >> $@
" | awk ' \
BEGIN { FS=":" } { \
if ($$0 ~ /SUBST_LINE_NUM/) { \
start=$$1; patt=$$2; file=$$3; \
regex=$$4; offset=$$5; rest=$$6; \
grepcmd="grep -n \042" regex "\042 " file; \
grepcmd | getline; \
linenum=$$1; \
print start linenum rest \
} else { print $$0 } } \
' >> $@
endef
define replace_umlauts
@ -75,6 +105,9 @@ pdf: dirs $(OUT).pdf.zip
%.eps: %.fig
fig2dev -L eps $< $@
#%.ger: %.ger.linetmpl
# $(replace_linenumbers)
#
%.tex: %.ger
$(replace_umlauts)
@ -140,7 +173,7 @@ $(OUTPUT).dvi: $(TEXSRC)
latex $(MAIN).tex; latex $(MAIN).tex; latex $(MAIN).tex;
cp $(MAIN).dvi $@
$(OUT).dvi.zip: $(OUTPUT).dvi $(wildcard *.eps)
$(OUT).dvi.zip: $(OUTPUT).dvi $(IMAGES)
zip $@ $^
$(OUTPUT).txt: $(OUTPUT).dvi
@ -202,5 +235,6 @@ clean:
rm -rf *.aux *.toc *.dvi *.pdf *.ps *~ *.log *.done *.rep \
*.lol \
$(NEWDIRS) $(PRE_TEX) $(PRE_HTML) $(OUTPUT).txt \
$(LOCAL_IMPORTED_TEMPLATES)
$(LOCAL_IMPORTED_TEMPLATES) \
$(GERFROMLINETMPL) $(TEXFROMGER) $(EPSFROMFIG)