Wednesday 15 July 2015

c - subdir-objects option for automake doesn't work -



c - subdir-objects option for automake doesn't work -

after reading autotools mythbuster, have tried write little illustration of non recursive makefile utilize of subdir-objects in order have binary in directory of source files.

here the organization of little test:

/ autogen.sh configure.ac makefile.am src/ main.c

the autogen.sh :

#!/bin/sh echo "running aclocal..." ; aclocal $aclocal_flags || exit 1 echo "running autoheader..." ; autoheader || exit 1 echo "running autoconf..." ; autoconf || exit 1 echo "running automake..." ; automake --add-missing --copy --gnu || exit 1 ./configure "$@"

the configure.ac :

ac_prereq([2.69]) ac_init([test], [0.0.1], [devel@hell.org]) ac_config_srcdir([src/main.c]) ac_config_headers([config.h]) # checks programs. ac_prog_cc am_init_automake([1.14 foreign subdir-objects]) am_maintainer_mode([enable]) ac_output(makefile)

the makefile.am :

maintainercleanfiles = makefile.in aclocal.m4 config.h.in configure depcomp install-sh missing compile bin_programs=toto toto_sources=src/main.c

i compile :

./autogen.sh create

i thought binary toto have been created in src directory alternative subdir-objects seems alternative have no effect , toto binary generated in root directory.

i have tried pass alternative in makefile.am automake_options = subdir-objects wihtout success.

that's not subdir-objects alternative does. puts intermediate build results, *.o object files, in same directory sources built. in particular, should find main.o there instead of in top directory.

the final build result, on other hand, must , specify in automake file. if want toto go in src/ directory too, utilize makefile.am:

maintainercleanfiles = makefile.in aclocal.m4 config.h.in configure depcomp install-sh missing compile bin_programs=src/toto src_toto_sources=src/main.c

c makefile make autotools

No comments:

Post a Comment