我试过类似的东西:
CXXFLAGS = -WAll ... bin_PROGRAMS = test test_SOURCES = main.cpp utility.cpp utility_o_CXXFLAGS = $(CXXFLAGS) -Wno-unused-value
但它不起作用.
编辑:删除了对automake手册的引用,这实际上是误导(感谢Douglas Leeder).
CXXFLAGS = -Wall ... bin_PROGRAMS = test test_SOURCES = main.cpp test_LDADD = libutility.a noinst_LIBRARIES = libutility.a libutility_a_SOURCES = utility.cpp libutility_a_CXXFLAGS = $(CXXFLAGS) -Wno-unused-value