Autotools include path

五迷三道 提交于 2019-12-10 02:54:05

问题


I have a directory structure like

Makefile.am
Configure.ac
         src/
             hello.c
             Makefile.am

         include/
             hello.h

How to specify the include path in Makefile.am of src so that it includes header files from include/ dir as well as c file depends on header file. So if I modify any .h file it force to recompile .cc file.

Defining AM_CPPFLAGS' is giving warning

configure.ac:5: warning: macro `AM_CPPFLAGS' not found in library

回答1:


In src/Makefile.am, write:

AM_CPPFLAGS = -I$(top_srcdir)/include
bin_PROGRAMS = hello
hello_SOURCES = hello.c

There is no need to mark the dependency between hello.c and hello.h, it will be recorded automatically the first time you build your project.



来源:https://stackoverflow.com/questions/7589676/autotools-include-path

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!