GNU autotoolsプロジェクトのビルドマニュアルに関する「make distcheck」の問題

GNU autotoolsプロジェクトのビルドマニュアルに関する「make distcheck」の問題

私は小さなプロジェクトを使っautoconfて構築しています。automake

プロジェクトマニュアルにはOpenBSDのデフォルト言語を使用しました。mdoc滞在manこれを使用してインストール可能な形式のマニュアルを作成します。mandocユーティリティ。 - フォーマットされたマニュアルは、一部のシステムでは正しく理解されていないか、まったく理解できないため、実際のmanマニュアルとしてインストールされます。make installmdoc

プロジェクト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圧縮アーカイブを作成できます。tarmdocman

$ 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私はハッキングなしでこれを行うための「正しい」方法を探しています。mdocman

使ってみよう

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ビルドツリーがデプロイツリーとは異なる場所にあっても、デプロイツリーでファイルを見つけることができます。

おすすめ記事