无法在automake中创建检查程序

时间:2015-03-07 00:54:14

标签: automake

我正在尝试学习automake(John Calcotte的Autotools),我很难创建一个检查程序来测试我的C ++库。该程序的部分列表如下。文中的示例显示了使用测试程序输出的shell脚本创建测试程序。我有一个程序,链接到库,执行时测试库功能。我是否必须使用noinst创建测试程序,然后使用shell脚本执行?任何脚本示例或对示例的引用都会有所帮助。

由于

The errors are:

    src/Makefile.am:27: warning: variable 'check_SOURCES' is defined but no program or
    src/Makefile.am:27: library has 'check' as canonical name (possible typo)


# Create a library
    lib_LIBRARIES      = libslip.a
    libslip_a_SOURCES  = $(sources) $(privateHeaders)


# Header files for testing SLIP

    testHead=TestGlobal.h TestHeader.hp TestIO.h TestMisc.h TestOperators.h TestReader.h TestReplace.h TestSequencer.h TestUtilities.h


# Source files for testing SLIP

    testCPP=Test.cpp TestGlobal.cpp TestHeader.cpp TestIO.cpp TestMisc.cpp  TestOperators.cpp TestReader.cpp TestReplace.cpp TestSequencer.cpp  TestUtilities.cpp


# Test Program
    check_PROGRAMS   = Test
    check_SOURCES    = $(testHead) $(testCPP)
    TESTS            = $(check_PROGRAMS)

1 个答案:

答案 0 :(得分:0)

这只是一个轻微的误解:check_PROGRAMS = Test很好,但与libslip来源一样,Test用作前缀:

Test_SOURCES = TestGlobal.h TestHeader.hp TestIO.h TestMisc.h TestOperators.h \
        TestReader.h TestReplace.h TestSequencer.h TestUtilities.h Test.cpp \
        TestGlobal.cpp TestHeader.cpp TestIO.cpp TestMisc.cpp TestOperators.cpp \
        TestReader.cpp TestReplace.cpp TestSequencer.cpp TestUtilities.cpp

在这种情况下,在SOURCES中包含标题可以。换行符后的每个新行都应以TAB字符开头。当然,如果您愿意,可以继续使用$(testHead)$(testCPP)变量。要与libslip

相关联
Test_LDADD = libslip.a

或简单地说:

LDADD = libslip.a

如果将libslip与此Makefile中的所有程序相关联。 check_PROGRAMS目标隐式noinst

您可能还会发现Autotools Mythbuster是一个有用的资源。

相关问题