Makefile.in: Variable substitution

Tag: make , autoconf , automake Author: sz619000 Date: 2012-07-08

In Makefile.in I see variable definition where an external variable name is enclosed between two @ symbols

# @configure_input@

package = @PACKAGE_NAME@

Where those external variables come from? Also, I couldn't find in GNU manual what does exactly enclosing a variable between two @ symbols mean? Is it something specific to Makefile.in?

Thank you.

Best Answer

It's an autoconf thing.

When ./configure finishes running, it generates and executes a file called config.status, which is a shell script that has the final value of the variable substitutions (anything declared with AC_SUBST).

Anything that is declared in AC_CONFIG_FILES is processed by config.status, usually by turning foo.in into foo.

When automake processes Makefile.am into Makefile.in, any AC_SUBST variable is automatically made available (using a declaration like FOO = @FOO@), unless it's suppressed by a call to AM_SUBST_NOTMAKE.

Other Answer1

(I am not an expert, but) Yes they are specific to Makefile.in, and configure replaces them when assembling the Makefile, see the Autoconf Manual, section 4.8. For example, @PACKAGE_NAME@ is defined by AC_INIT.

comments:

Also read Jack's answer (and give him that checkmark).