2012-04-25 5 views
0

私はautotoolを使用する初心者ですが、Makefile.amにいくつかのシェルスクリプトを追加したいのですが、以下の方法を使用するとautotoolで作成されたMakefileは期待していません。どのようにして正しいものを作成することができますか。 返信いただきありがとうございます!autotoolを使用して条件付きbinプログラムを作成する方法

PS: これは私のconfigure.inとMakefile.am(部品)である

configure.in:

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

Makefile.am:作成

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

のMakefileのautotool:

........ 
........ 
.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 

答えて

0

Automake条件はそれほど機能しません。 manualを参照してください。ここで

は、それがどのように見えるべきかです:

configure.ac:

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

Makefile.am:

if SAMPLE 
noinst_PROGRAMS = test 
test_SOURCES = test.c 
else 
bin_PROGRAMS = release 
release_SOURCES = main.c 
endif 
関連する問題