開発を楽に?

世の中にはTeX統合開発環境が少しはあるけど、一日でソレの機能を搭載したスクリプトを書いてみようと逃避中。早い話が、Makefile書いて、Tcl/TkでGUIラッパーを書くだけ。


<< Makefile >>
# 最近のMakefile
# for pLaTeX and other tex compilers?

########################################################################################
# ソースファイルの設定
PROJ = hogehoge
SRCS = s1.tex s2.tex s3.tex s4.tex s5.tex s6.tex title.tex
SRCEPS = star51.eps star52.eps star53.eps star54.eps
SRCP = hogehoge.tex
DDVI = $(SRCP:.tex=.dvi)
DPS = $(SRCP:.tex=.ps)
DPDF = $(SRCP:.tex=.pdf)

MAINTARGET = $(DDVI)
########################################################################################
# 環境依存の設定
CDVI = platex
CPS = dvipsk
CPDF = dvipdfmx
RM = rm -f
########################################################################################
# for Archiver
DATE = `date +%Y%m%d`
ARCEXT = tar.bz2
ARCER = tar
ARCOPT = cvfj
ARCNAME = $(PROJ)_$(DATE).$(ARCEXT)
ARCOSRC = $(SRCP:.tex=.wsp)
########################################################################################
# 省略コマンドライン
all: $(MAINTARGET)
c: clean
r: run
h: help
cc: clearclean

pdf: $(DPDF)
dvi: $(DDVI)
ps: $(DPS)
########################################################################################
# コンパイル実体
$(DPDF): $(DDVI)
$(CPDF) $(DDVI)

$(DPS): $(DDVI)
$(CPS) $(DDVI)

$(DDVI): $(SRCS) $(SRCP) $(SRCEPS)
$(CDVI) $(SRCP)
$(CDVI) $(SRCP)
# @$(RM) $(SRCP:.tex=.log) $(SRCP:.tex=.aux) $(SRCP:.tex=.toc)

########################################################################################
# 付加機能実体
clean:
$(RM) $(SRCP:.tex=.log) $(SRCP:.tex=.aux) $(SRCP:.tex=.toc) $(SRCEPS:.eps=.pbm)

clearclean: clean
$(RM) $(DDVI) $(DPS) $(DPDF)

arc: $(SRCS) $(SRCP) Makefile $(SRCEPS)
-$(RM) $(ARCNAME)
$(ARCER) $(ARCOPT) $(ARCNAME) $(SRCS) $(SRCP) Makefile $(ARCOSRC) $(SRCEPS)

########################################################################################
help:
@echo "help : show this help :-)"
@echo "all : $(MAINTARGET)"
@echo "clean : delete object-files"
@echo "arc : archive to $(ARCNAME)"

########################################################################################


<< Tcl/Tk Script >>
#!/bin/sh
# the next line restarts using wish \
exec wish "$0" "$@"
wm title . TeXコンパイラ
#
# 初期値の設定
set nWidth 16

# 本体の開始
# ボタン1 コンパイル
button .b1 -relief groove -width $nWidth \
-text "DVI" \
-command { exec make dvi & }

# ボタン2 PDF作成
button .b2 -relief groove -width $nWidth \
-text "PDF" \
-command { exec make pdf & }

# ボタン3 掃除
button .b3 -relief groove -width $nWidth \
-text "CLEAN" \
-command { exec make clearclean & }

# ボタン5 終了
button .b5 -relief groove -width $nWidth \
-text "EXIT" \
-command { exit }

# ボタン .b1 を詰めて表示する。
#pack .b1 .b2 .b3 .b4 .b5
pack .b1 .b2 .b3 .b5

このチープさがたまらない。>>〜<<を使うとタブは無視されるのね…。Preタグ使う方が良いのかな。結局一緒。面倒なのでDVI閲覧起動は省略。これ以上時間掛けると横道にずれすぎるから。