Dinesh Gowda
Dinesh Gowda

Reputation: 1144

Makefile.def vs Makefile.am

I am working on linux binutils-2.29. In the parent directory there is not Makefile.am, but in all the sub directories there is Makefile.am.

In the parent directory these are the Makefiles present:

Makefile  Makefile.def  Makefile.in  Makefile.tpl

In side Makefile.tpl there is a comment which says Makefile is generated from Makefile.tpl by autogen Makefile.def

but inside subdirectories there is not Makefile.def, when I run autoreconf && automake it generates Makefile from Makefile.am

What exactly is the difference between Makefile.def and Makefile.am?

Upvotes: 1

Views: 2184

Answers (1)

syntagma
syntagma

Reputation: 24324

What exactly is the difference between Makefile.def and Makefile.am?

Let's look at GCC, large project which is using binutils as well. Quoting Regenerating GCC Configuration:

The Makefile.in file is sometimes big, and can be generated by automake from a Makefile.am file. Some Makefile.in files (used to generate Makefile in the build tree) are generated by autogen from Makefile.tpl and Makefile.def files. Autogen is a (GUILE scriptable) tool designed to simplify the creation and maintenance of programs that contain large amounts of repetitious text.

So the difference is really about how and where you want to store parts of the input files that autogen will work on. In case of GCC, it Makefile.tpl stores a template (for generating the output Makefile, whereasMakefile.def stores definitions, which will be used by autogen.

For example, inside Makefile.tpl you will find this template for filling HOST_LIB_PATH variable (note it uses host_modules variable):

# This is the list of directories that may be needed in RPATH_ENVVAR
# so that programs built for the host machine work.
HOST_LIB_PATH = [+ FOR host_modules +][+
  IF lib_path +]$(HOST_LIB_PATH_[+module+])[+ ENDIF lib_path +][+
  ENDFOR host_modules +]

And inside Makefile.def there is a definition for host_modules:

host_modules= { module= bfd; bootstrap=true; };
host_modules= { module= opcodes; bootstrap=true; };
// ...

Upvotes: 2

Related Questions