Item 13: Watch Those Tab Characters!

Having made the transition to Automake, you're not using raw makefiles anymore, so why should you still care about tab characters? Remember that Makefile.am files are simply stylized makefiles. Ultimately, every line in a Makefile.am file will be either consumed directly by Automake and then transformed into true make syntax, or copied directly into the final makefile. This means that tab characters matter within Makefile.am files.

Consider this example from the Automake mailing list:

lib_LTLIBRARIES = libfoo.la
  libfoo_la_SOURCES = foo.cpp
  if WANT_BAR
❶         libfoo_la_SOURCES += a.cpp
  else
❷         libfoo_la_SOURCES += b.cpp
  endif

  AM_CPPFLAGS = -I${top_srcdir}/include
  libfoo_la_LDFLAGS = -version-info 0:0:0

I have been reading ...

Get Autotools now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.