Dismiss Notice
Join Physics Forums Today!
The friendliest, high quality science and math community on the planet! Everyone who loves science is here!

What is in all in a Makefile?

  1. Mar 17, 2008 #1

    Eus

    User Avatar

    What is "::" in "all::" in a Makefile?

    Hi Ho!

    Executing GNU Make:

    If Makefile only contains the following lines,

    Code (Text):

    all:
        echo $@
     
    it will produce

    Code (Text):

    echo all
    all
     
    If Makefile only contains the following lines,

    Code (Text):

    all::
        echo $@
     
    it will still produce

    Code (Text):

    echo all
    all
     
    But, if Makefile only contains the following lines,

    Code (Text):

    all:::
        echo $@
     
    it will produce

    Code (Text):

    Makefile:1: *** missing target pattern.  Stop.
     
    all: is just the usual way. all::: is an error.
    all:: is the mystery that I don't know.

    I know, all:| exists for order-only execution.
    But, all:: is not documented in GNU Make texinfo.

    Does any of you know what the use of all:: is?

    Thank you.

    Best regards,
    Eus
     
  2. jcsd
  3. Mar 17, 2008 #2

    mgb_phys

    User Avatar
    Science Advisor
    Homework Helper

    I think it is being intepreted as "all:" followed by an empty target "blank:"
    but "all:::" would have 2 targets "blank:" targets the same.
     
  4. Mar 17, 2008 #3

    D H

    User Avatar
    Staff Emeritus
    Science Advisor

    all: is an ordinary (i.e., single-colon) rule. You can have only one 'all:' rule in a makefile (exception: you can have multiple dependency-only rules for the same target). all:: is a double-colon rule. You can have as many of these as you want in a makefile, but you cannot mix ordinary and double-colon rules.

    'man make' doesn't say much. Use 'info make' instead. This is the make.info section on double-colon rules (type 'info make double-colon' on the UNIX command line):
     
    Last edited: Mar 17, 2008
  5. Mar 18, 2008 #4

    Eus

    User Avatar

    Yes, you are right! Thank you very much for telling me that it is called double-colon rule and it is documented in the texinfo file.

    Best regards,
    Eus
     
Know someone interested in this topic? Share this thread via Reddit, Google+, Twitter, or Facebook

Have something to add?



Similar Discussions: What is in all in a Makefile?
  1. Chroot: Makefile books (Replies: 3)

  2. Makefile confusion (Replies: 34)

Loading...