automake subdir-objects is disabled

jaseUK picture jaseUK · Aug 2, 2016 · Viewed 13.8k times · Source

I'm getting the below error with automake. I know you can put AUTOMAKE_OPTIONS = subdir-objects" at the top of Makefile.am. But how can I set this behaviour for all files, so I don't need to do it case by case?

Makefile.am:454: warning: source file 'libs/esl/src/esl_threadmutex.c' is in a subdirectory,
          Makefile.am:454: but option 'subdir-objects' is disabled
          Makefile.am:454: warning: source file 'libs/esl/ivrd.c' is in a subdirectory,
          Makefile.am:454: but option 'subdir-objects' is disabled
          Makefile.am:454: warning: source file 'libs/esl/src/esl_json.c' is in a subdirectory,
          Makefile.am:454: but option 'subdir-objects' is disabled
          Makefile.am:454: warning: source file 'libs/esl/src/esl_buffer.c' is in a subdirectory,
          Makefile.am:454: but option 'subdir-objects' is disabled
          tests/unit/unit.mk:6: warning: source file 'tests/unit/switch_event.c' is in a subdirectory,
          tests/unit/unit.mk:6: but option 'subdir-objects' is disabled
          Makefile.am:854:   'tests/unit/unit.mk' included from here
          tests/unit/unit.mk:13: warning: source file 'tests/unit/switch_hash.c' is in a subdirectory,
          tests/unit/unit.mk:13: but option 'subdir-objects' is disabled
          Makefile.am:854:   'tests/unit/unit.mk' included from here
          Makefile.am:441: warning: source file 'src/tone2wav.c' is in a subdirectory,
          Makefile.am:441: but option 'subdir-objects' is disabled
          Makefile.am: installing 'build/config/depcomp'

Answer

Diego Elio Pettenò picture Diego Elio Pettenò · Aug 3, 2016

It's not something you add "case-by-case", as AUTOMAKE_OPTIONS applies to the whole project. It's also supposedly the only way it should be used in the future, thus the warnings; for now it's opt-in.

You can also set this in configure.ac with AM_INIT_AUTOMAKE, see Autotools Mythbuster (full disclosure: I'm the author) for the full set of automake options you can use.