harshc
harshc

Reputation: 97

understanding data assigned to macros in a makefile

I have searched through this forum but am not able to find an answer to this question, still if I have missed it please excuse me and direct me to the same.

I am trying to understand makefiles and came across the makefile for the tcpreplay utility on Linux. There are lot of macros that have been defined with the value starting an ending in a @. What are these values, how are they used? A snippet:

    ACLOCAL = @ACLOCAL@
    AMTAR = @AMTAR@
    AR = @AR@
    AUTOCONF = @AUTOCONF@
    AUTOGEN = @AUTOGEN@
    AUTOHEADER = @AUTOHEADER@

Upvotes: 2

Views: 96

Answers (1)

Jens
Jens

Reputation: 72657

This is a makefile template, likely for software built with a GNU configure script. When configure is run, the @NAME@ placeholders are replaced with proper values as determined at runtime. E.g. @AR@ will be the name (or path) of the archiver, /usr/bin/ar. You then have a proper Makefile that you can run with a make invokation. If an actual Makefile still contains @NAME@ placeholders, there was an error in running configure.

You are very likely not looking at a file named Makefile but one named Makefile.in. The .in suffix indicating that this is input to configure.

You can find all the gory details in the GNU autoconf manual.

Upvotes: 4

Related Questions