Can autotools makefiles automatically consider header files as dependencies?

I have a project managed by autotools ( sscce tar.gz package here ) with this structure:

./main.c
./foo.c
./foo/foo.h

My configure.ac:

AC_INIT([foo], [1.0], [foo@bar.ba])
AM_INIT_AUTOMAKE([foreign -Wall -Werror])
AC_PROG_CC
AC_CONFIG_HEADERS([config.h])
AC_CONFIG_FILES([Makefile])

AC_OUTPUT

My Makefile.amwere:

bin_PROGRAMS = main
main_SOURCES = main.c foo.c foo.h

It compiled and works fine ... but then I noticed that mine Makefile.amwas wrong. He stated that my main code depended on foo.h, but the real file was foo/foo.h. I modified it, and the compilation worked as expected, as before:

bin_PROGRAMS = main
main_SOURCES = main.c foo.c foo/foo.h

: , ? , foo/foo.h, make . , ...

bin_PROGRAMS = main
main_SOURCES = main.c foo.c

... , .

, :

  • autotools Makefile, foo/foo.h - , make?
  • main_SOURCES?
  • make , , ?
+5
1

automake. , . . , : , depcomp , ( configure) , : . @am__fastdepCC_TRUE@ Makefile.in.

, , , , .deps. , . ( gcc -MD .)

main_SOURCES, Makefile make dist ( , make distcheck).

make , , main_SOURCES. automake , main ( ) ( ). direct - , . make dist :

make: *** No rule to make target `foo.h', needed by `distdir'.  Stop.
+5

All Articles