help-make
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Potential for problems: GNU make confusing variables with targets and vi


From: Garrett Cooper
Subject: Potential for problems: GNU make confusing variables with targets and vice versa in hash table?
Date: Tue, 15 Jul 2008 16:15:56 -0700

Hello fellow makers:

I misread the manual a while back and appeared to have accidentally
introduced a bug into a .mk file which I just fixed. However, my
results in just poking around with my testcase provided 2 examples of
very weird behavior when stimulating the mistake (Example #1) and its
analog (Example #2):

Example #1 ($(.DEFAULT_GOAL) isn't a target!):

    address@hidden ~ $ make -f test.mk
    echo DEFAULT GOAL foo
    DEFAULT GOAL foo
    echo bar
    bar
    address@hidden ~ $ make -f test.mk all
    echo DEFAULT GOAL foo
    DEFAULT GOAL foo
    echo 'look what I can do!'
    look what I can do!

Example #2 (.PHONY isn't a variable!):

    address@hidden ~ $ make -f test2.mk  all
    echo "I'm not real... just a figment of your imagination"
    I'm not real... just a figment of your imagination
    echo "Is it [phony_baloney] real...?"
    Is it [phony_baloney] real...?
    echo "Hi, my name is all!"
    Hi, my name is all!

Now tell me... does this behavior constitute a bug or is it just
considered "undefined behavior"?

Other important info:

    address@hidden ~ $ make --version; uname -a
    GNU Make 3.81
    Copyright (C) 2006  Free Software Foundation, Inc.
    This is free software; see the source for copying conditions.
    There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A
    PARTICULAR PURPOSE.

    This program built for i686-pc-linux-gnu
    Linux headless-horseman 2.6.23.17 #3 SMP Mon Mar 24 04:34:56 PDT
2008 i686 Intel(R) Xeon(R) CPU 5140 @ 2.33GHz GenuineIntel GNU/Linux

I attached the sample makefiles.

Thanks,
-Garrett

Attachment: test.mk
Description: Binary data

Attachment: test2.mk
Description: Binary data


reply via email to

[Prev in Thread] Current Thread [Next in Thread]