Shailesh Tainwala
Shailesh Tainwala

Reputation: 6507

Figuring out the intended target system of a makefile

I am trying to understand the exact actions being taken by a make file (first time working with builds using make).

I want to know whether the make file is intended to be used by BSD make, GNU make or Windows nmake. 1) How can I do this without reading documentation of all three and understanding their differences?

2) After reading several articles, I have come to the conclusion that make is a utility for the primary purpose of building source code into an executable or a DLL or some form of output, something that IDEs usually allow us to do. Makefile is the means of giving instructions to the make utility. Is this right?

3) What is the relation between make and the platform for which the code will be built?

4) The commands that are issued under a dependency line (target:components) are shell commands?

Thanks in advance.

Upvotes: 0

Views: 106

Answers (1)

Eldar Abusalimov
Eldar Abusalimov

Reputation: 25483

  1. How can I do this without reading documentation of all three and understanding their differences?

    Well, most likely, that you will use GNU Make. I believe, it is relatively simple to distinguish Makefiles written for different versions of Make.

    AFAIK, GNU Make and BSD Make have many differences, at least in their language syntax. For example, in GNU Make a typical conditional directive looks like:

    ifdef VARIABLE
    # ...
    endif
    

    And in BSD Make it is something like this (though I'm not sure):

    .if
    # ...
    .endif
    

    See also:

  2. Makefile is the means of giving instructions to the make utility. Is this right?

    Yep, absolutely right.

  3. What is the relation between make and the platform for which the code will be built?

    Make is just an utility for tracking dependencies between artifacts to be built and running commands in the proper order to satisfy these dependencies. Which exact commands should be used to accomplish the task is up to the user. Thus you can use Make for cross compilation as well.

  4. The commands that are issued under a dependency line (target : components) are shell commands?

    Yes, typically Make spawns a sub-shell which executes the specified recipe.

Upvotes: 1

Related Questions