我正在用 GNU Autotools 编写一个 C++ 包。我正在合并几个外部库以随包一起提供。由于我不想单独安装这些库中的每一个,我改为使用“ libtool 便利库”。目录层次结构大致如下所示:
mypkg/
configure.ac
Makefile.am
src/
Makefile.am
myprogram.cpp
big/
Makefile.am
small1/
Makefile.am
small1.hpp
small1.cpp
small2/
Makefile.am
small2.hpp
small2.cpp
目的是在/usr/local/lib 中只安装libbig.la,而在/usr/local/include 中只安装small1.hpp 和small2.hpp。
一切正常(configure
, make
, make check
),除了在进入 mypkg/src/mybiglib/mysmalllib1 后返回make distcheck
。No rule to make target distclean
更准确地说,这是 make distcheck 的输出:
make[1]: Entering directory `~/mypkg/mypkg-1.3/_build'
Making distclean in src/big/small1
make[2]: Entering directory `~/mypkg/mypkg-1.3/_build/src/big/small1'
rm -rf .libs _libs
test -z "libsmall1.la" || rm -f libsmall1.la
rm -f ./so_locations
rm -f *.o
rm -f *.lo
rm -f *.tab.c
test -z "" || rm -f
test . = "../../../../src/big/small1" || test -z "" || rm -f
rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags
rm -rf ./.deps
rm -f Makefile
make[2]: Leaving directory `~/mypkg/mypkg-1.3/_build/src/big/small1'
Making distclean in src/big/small2
make[2]: Entering directory `~/mypkg/mypkg-1.3/_build/src/big/small2'
... # similar as for small1 above
make[2]: Leaving directory `~/mypkg/mypkg-1.3/_build/src/big/small2'
Making distclean in src/big
make[2]: Entering directory `~/mypkg/mypkg-1.3/_build/src/big'
Making distclean in small1
make[3]: Entering directory `~/mypkg/mypkg-1.3/_build/src/big/small1'
make[3]: *** No rule to make target `distclean'. Stop.
为什么“在small1中制作distclean”会出现两次?该错误似乎来自它第一次运行良好,因此第二次失败的事实?
这是 mypkg/src/big/small1/ 中的 Makefile.am:
AM_CXXFLAGS = -I$(top_srcdir)/src/big @AM_CXXFLAGS@
noinst_LTLIBRARIES = libsmall1.la
libirls_la_SOURCES = small1.cpp
这是 mypkg/src/big/ 中的 Makefile.am:
SUBDIRS = small1 small2
lib_LTLIBRARIES = libbig.la
libeqtlbma_la_SOURCES = small1/small1.hpp \
small2/small2.hpp
nodist_EXTRA_libbig_la_SOURCES = dummy.cxx
libeqtlbma_la_LIBADD = small1/small1.la small2/small2.la
这是 mypkg/src/ 中的 Makefile.am:
AM_CXXFLAGS = -I$(top_srcdir)/src/big -fopenmp @AM_CXXFLAGS@
bin_PROGRAMS = myprogram
myprogram_SOURCES = myprogram.cpp
myprogram_CPPFLAGS = -fopenmp
myprogram_LDFLAGS = -fopenmp
myprogram_LDADD = $(top_builddir)/src/big/libbig.la $(AM_LDFLAGS)
这是 mypkg/ 中的 Makefile.am:
SUBDIRS = src/big/small1 src/big/small2 src/big src
我在哪里忘记了什么?或者我不应该在最后一个 Makefile.am 的 SUBDIRS 中包含“small1/”和“small2/”?
ps:automake v1.13.1;自动配置 v2.69 ;libtool v2.4.2