0

我是使用autotool的初学者,我想在Makefile.am中添加一些shell脚本,当我使用下面的方法时,autotool创建的Makefile不是我所期望的。我怎样才能写来创建正确的。感谢您的回复!

PS:这是我的 configure.in 和 Makefile.am(parts)

配置.in:

if test "$sample" = yes;then
    DEFS="$DEFS -DSAMPLE=1"
    AC_SUBST(SAMPLE, [yes])
fi

生成文件.am:

if test "$SAMPLE" = yes;then
    noinst_PROGRAMS = test
    test_SOURCES = test.c
else
    bin_PROGRAMS = release
    release_SOURCES = main.c
fi

Makefile 自动工具创建:

 ........
 ........
 .PHONY: CTAGS GTAGS all all-am check check-am clean clean-generic \
 clean-libLTLIBRARIES clean-libtool clean-noinstPROGRAMS ctags \
 distclean distclean-compile distclean-generic \
 distclean-libtool distclean-tags distdir dvi dvi-am html \
 html-am info info-am install install-am install-data \
 install-data-am install-dvi install-dvi-am install-exec \
 install-exec-am install-html install-html-am \
 install-includeHEADERS install-info install-info-am \
 install-libLTLIBRARIES install-man install-pdf install-pdf-am \
 install-ps install-ps-am install-strip installcheck \
 installcheck-am installdirs maintainer-clean \
 maintainer-clean-generic mostlyclean mostlyclean-compile \
 mostlyclean-generic mostlyclean-libtool pdf pdf-am ps ps-am \
 tags uninstall uninstall-am uninstall-includeHEADERS \
 uninstall-libLTLIBRARIES

if test "yes" = yes;then
fi
4

1 回答 1

1

Automake 条件不是那样工作的。请参阅手册

这是它的外观:

配置.ac:

AM_CONDITIONAL([SAMPLE], [test "$SAMPLE" = yes])

生成文件.am:

if SAMPLE
noinst_PROGRAMS = test
test_SOURCES = test.c
else
bin_PROGRAMS = release
release_SOURCES = main.c
endif
于 2012-04-29T07:58:37.830 回答