[ Main Page ]

便利なツールやソフト

make

makeとはソースファイルから何か(プログラムなど) を作るときにたいへん便利な ツールです。具体的に言えば、作るものをターゲットとして、 ソースがターゲットより新しければ自動的に 新たにターゲットをソースから作成し、 ターゲットの方が新しければ何もしないという、 やることはとてもシンプルなツールです。
例えば、sample.texからsample.dviを作るとき、

g360059@nc01610~>make sample.dvi
    

と打てば、makeが自動的にsample.dviを作ってくれます。 但し、デフォルトの状態では、texが起動されてしまいます。 そこで、次のような内容をソースと同じところにMakefile として保存すると、texのかわりにplatexが起動されます。
注意 : [tab]はタブを入力してください。

.SUFFIXES:.tex.dvi
.tex.dvi:
[tab]platex $<

そして先に述べたコマンドの入力すればsample.dvi が作られるはずです。もし、ターゲットの方が新しければ

make: `sample.dvi' is up to date.
    

と表示されるだけです。
先のファイルは、デフォルトの振る舞いを設定するものです。 詳しくいうと、makeはまず、自分の持っているターゲットの 作り方を読み込みます。次に カレントディレクトリにMakefileという ファイルがないか探し、あれば読み込みます。 そして、ターゲットの作り方を知った後で ターゲットを作るためのコマンドを実行するのです。 先のファイルの内容を解釈すると、*.texから *.dviを生成することができるが、その方法は以下の通りである、 つまり"platex *.tex"を実行することだ、となります。 ここででてきた$<は、与えられたターゲットのソースファイルの 名前を象徴的に示すものです。
Makeは一般にプログラミングのみで使われると思われているようですが、 複数のファイルからなる大きなTeX文書などをつくるときにも 役に立つのではないでしょうか。 これを読んで興味を持った方は、次のようなページで検索してみましょう。 相談員に聞いてもいいかも知れません。
参考までに、自分のTeXのディレクトリにあるMakefileをあげておきます。 ただし、かなり環境依存なので、いくらか変更する必要があるかも知れません。 <Makefile>
また、このMakefileが読み込んでいるFiles.Makeについても出しておきます。 参考になれば幸です。<Files.make>
Googleで検索
Gnu make 本家

"Speak, thou vast and venerable head," muttered Ahab, "which, though
ungarnished with a beard, yet here and there lookest hoary with mosses; speak,
mighty head, and tell us the secret thing that is in thee.  Of all divers,
thou has dived the deepest.  That head upon which the upper sun now gleams has
moved amid the world's foundations.  Where unrecorded names and navies rust,
and untold hopes and anchors rot; where in her murderous hold this frigate
earth is ballasted with bones of millions of the drowned; there, in that awful
water-land, there was thy most familiar home.  Thou hast been where bell or
diver never went; has slept by many a sailer's side, where sleepless mothers
would give their lives to lay them down.  Thou saw'st the locked lovers when
leaping from their flaming ship; heart to heart they sank beneath the exulting
wave; true to each other, when heaven seemed false to them.  Thou saw'st the
murdered mate when tossed by pirates from the midnight deck; for hours he fell
into the deeper midnight of the insatiate maw; and his murderers still sailed
on unharmed -- while swift lightnings shivered the neighboring ship that would
have borne a righteous husband to outstretched, longing arms.  O head! thou has
seen enough to split the planets and make an infidel of Abraham, and not one
syllable is thine!"
		-- H. Melville, "Moby Dick"

Q:	How many IBM CPU's does it take to do a logical right shift?
A:	33.  1 to hold the bits and 32 to push the register.


Powered by UNIX fortune(6)
[ Main Page ]