
私は小さなプロジェクトを使っautoconf
て構築しています。automake
プロジェクトマニュアルにはOpenBSDのデフォルト言語を使用しました。mdoc
滞在、man
これを使用してインストール可能な形式のマニュアルを作成します。mandoc
ユーティリティ。 - フォーマットされたマニュアルは、一部のシステムでは正しく理解されていないか、まったく理解できないため、実際のman
マニュアルとしてインストールされます。make install
mdoc
プロジェクトdoc
ディレクトリには現在、次のファイルがありますMakefile.am
(マニュアルはというユーティリティ用ですshell
)。
dist_man1_MANS= shell.man
EXTRA_DIST= shell.mdoc
shell.man: shell.mdoc
$(mandoc) -T man shell.mdoc >shell.man
$(mandoc)
フォーマッタのフルパスに正しく拡張されますmandoc
(この変数はスクリプトによって設定されますconfigure
)。
これにより、make dist
プロジェクトの残りのプロジェクト配布ファイルとともに、ソースマニュアルと生成されたマニュアルを含むshell.man
圧縮アーカイブを作成できます。tar
mdoc
man
$ tar tzf shell-toolbox-20180401.tar.gz
...
shell-toolbox-20180401/doc/Makefile.am
shell-toolbox-20180401/doc/shell.man
shell-toolbox-20180401/doc/Makefile.in
shell-toolbox-20180401/doc/shell.mdoc
このtar
アーカイブは、後でプロジェクトとそのマニュアルを正常に構築してインストールするために使用できます。今まではそんなに良くなった。
しかし、私が走るとmake distcheck
(私はそれが絶対に動作することを確認したいからです):
$ make distcheck
...
checking for a BSD-compatible install... /usr/bin/install -c
checking whether build environment is sane... yes
checking for a thread-safe mkdir -p... /usr/local/bin/gmkdir -p
checking for gawk... gawk
checking whether make sets $(MAKE)... yes
checking whether make supports nested variables... yes
checking for mandoc... /usr/bin/mandoc
checking that generated files are newer than configure... done
configure: creating ./config.status
config.status: creating Makefile
config.status: creating src/Makefile
config.status: creating doc/Makefile
config.status: creating src/shell
Making all in src
Making all in doc
/usr/bin/mandoc -T man shell.mdoc >shell.man
mandoc: shell.mdoc: ERROR: No such file or directory
*** Error 3 in shell-toolbox-20180401/_build/sub/doc (Makefile:459 'shell.man')
*** Error 1 in shell-toolbox-20180401/_build/sub (Makefile:345 'all-recursive')
*** Error 1 in /home/myself/local/build/shell-toolbox (Makefile:576 'distcheck')
mdoc
マニュアルをビルドするときには、ビルドディレクトリにソースファイルがないようです:
$ ls shell-toolbox-20180401/_build/sub/doc
total 32
-rw-r--r-- 1 myself myself 14989 Apr 1 21:35 Makefile
-rw-r--r-- 1 myself myself 0 Apr 1 21:35 shell.man
長さ0のshell.man
ファイルは、失敗したmandoc
実行で生成されます。
ソースコードは解凍されたアーカイブにありますが、_build/sub/doc
ディレクトリにコピーされませんでした。
$ ls -l shell-toolbox-20180401/doc
total 48
-r--r--r-- 1 myself myself 178 Apr 1 21:23 Makefile.am
-r--r--r-- 1 myself myself 13925 Apr 1 21:23 Makefile.in
-r--r--r-- 1 myself myself 3443 Apr 1 21:27 shell.man
-r--r--r-- 1 myself myself 3319 Apr 1 18:54 shell.mdoc
質問:フォーマットされたマニュアルを作成する前にソースコードをビルドディレクトリに正しくコピーするには、automake
どのような魔法を適用する必要がありますか?make distcheck
私はハッキングなしでこれを行うための「正しい」方法を探しています。mdoc
man
使ってみよう
man1_SOURCES= shell.mdoc
しかし、これは人々をautomake
不平にする。
doc/Makefile.am:2: warning: variable 'man1_SOURCES' is defined but no program or
doc/Makefile.am:2: library has 'man1' as canonical name (possible typo)
このエラーを発生させる別の方法は手動で行うことです。VPATH ビルド(これは基本的にこれを行うときに起こるものですmake distcheck
):
$ make distclean
$ mkdir t
$ cd t
$ ../configure
checking for a BSD-compatible install... /usr/bin/install -c
checking whether build environment is sane... yes
checking for a thread-safe mkdir -p... /usr/local/bin/gmkdir -p
checking for gawk... gawk
checking whether make sets $(MAKE)... yes
checking whether make supports nested variables... yes
checking for mandoc... /usr/bin/mandoc
checking that generated files are newer than configure... done
configure: creating ./config.status
config.status: creating Makefile
config.status: creating src/Makefile
config.status: creating doc/Makefile
config.status: creating src/shell
$ make
Making all in src
Making all in doc
/usr/bin/mandoc -T man shell.mdoc >shell.man
mandoc: shell.mdoc: ERROR: No such file or directory
*** Error 3 in doc (Makefile:459 'shell.man')
*** Error 1 in /home/myself/local/build/shell-toolbox/t (Makefile:345 'all-recursive')
$ ls -l doc
total 32
-rw-r--r-- 1 myself myself 14589 Apr 1 22:42 Makefile
-rw-r--r-- 1 myself myself 0 Apr 1 22:42 shell.man
答え1
解決策:VPATHビルドを実行するときに手動ソースを正しく取得するには、ファイルの関連セクションの規則が次のようになりMakefile.am
ます。
shell.man: $(srcdir)/shell.mdoc
$(mandoc) -T man $(srcdir)/shell.mdoc >shell.man
$(srcdir)/shell.mdoc
を指定すると、make
ビルドツリーがデプロイツリーとは異なる場所にあっても、デプロイツリーでファイルを見つけることができます。
答え2
すでに承認されている答えがありますが、次の規則がVPATHビルドに適している可能性があり、より小さいという追加の利点があると思います。
shell.man: shell.mdoc
$(mandoc) -T man $< >$@
答え3
automake
さまざまな目標の前後に実行するためのサポートと-local
ルール。-hook
明らかにそうではないので、distcheck-local
他のアイデアは次のものをMakefile.am
使用したdist-hook
後に何かを実行することですdist
。
dist-hook:
cp something $(distdir)/somewhere