我有一个类似的目录结构
Makefile.am
Configure.ac
src/
hello.c
Makefile.am
include/
hello.h
Run Code Online (Sandbox Code Playgroud)
如何在src的Makefile.am中指定包含路径,使其包含来自include/dir的头文件以及c文件取决于头文件.因此,如果我修改任何.h文件,它会强制重新编译.cc文件.
定义AM_CPPFLAGS'正在发出警告
configure.ac:5: warning: macro `AM_CPPFLAGS' not found in library
Run Code Online (Sandbox Code Playgroud)
adl*_*adl 12
在src/Makefile.am中,写:
AM_CPPFLAGS = -I$(top_srcdir)/include
bin_PROGRAMS = hello
hello_SOURCES = hello.c
Run Code Online (Sandbox Code Playgroud)
无需标记hello.c和hello.h之间的依赖关系,它将在您第一次构建项目时自动记录.