2013/03/20

`docdir' is not a legitimate directory for `SCRIPTS'

今天在重新 checkout 一份 source code, 準備編譯時出現這個問題.
由於電腦之前硬碟掛掉, 所以編譯環境有所改變, 所以在懷疑是不是重新安裝過程出了問題.

Google 了一下, 終於找到解決問題方法.


原因是 automake 會限制 docdir 的位置, 如果不符合就會出現問題.
但如果想要強制放置在自己所設定的位置, 可以透過一些方式而繞過這個問題.

下面這是會出現 `docdir' is not a legitimate directory for `SCRIPTS'
# This was added at the suggestion of libtoolize
ACLOCAL_AMFLAGS = -I m4

#
# set doc (keyword) directory
#
docdir = $(prefix)/doc
#
# Documents list
#
doc_SCRIPTS = 

CLEANFILES = $(doc_SCRIPTS)
EXTRA_DIST = $(doc_SCRIPTS)


修改方式如下
# This was added at the suggestion of libtoolize
ACLOCAL_AMFLAGS = -I m4

#
# set doc (keyword) directory
#
docdir = $(prefix)/doc
mydocdir = $(docdir)
#
# Documents list
#
mydoc_SCRIPTS = 

CLEANFILES = $(doc_SCRIPTS)
EXTRA_DIST = $(doc_SCRIPTS)


就是這樣簡單.


參考來源:
To prevent the use from using incorrect locations by mistake -- it usually
makes bi sense to install a program in $(docdir) or a library in $(bindir).

But if the user still want to use those location (because he has his
own good reasons hopefully), he can easily circumvent our checks:

  mydocdir = $(docdir)
  mydoc_LIBRARIES = libfoo.a  # Will be installed in docdir.

This is also documented in the manual ("The Uniform Naming Scheme").


http://gnu-automake.7480.n7.nabble.com/limited-install-locations-for-scripts-td5453.html