help-make
[Top][All Lists]
Advanced

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

Re: Request for critique on a small makefile


From: Edward Z. Yang
Subject: Re: Request for critique on a small makefile
Date: Tue, 12 Dec 2006 21:15:20 -0500
User-agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.7.5) Gecko/20041206 Thunderbird/1.0 Mnenhy/0.6.0.104

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Philip Guenther wrote:
> No, more personal habit than rational decision: I used $< in makefile
>  long before I ever used a make that supported $^.  I agree that $^ 
> makes more sense for rules that may have more than one input, such as
>  those for linking executables.

Thanks for the clarification.

> So you didn't add the .exe suffix to the names in the 'programs' 
> variable?  Hmm.  What happens if you run 'make' twice, without 
> modifying any files?  If your makefile is correctly set up, then the 
> second 'make' will do nothing, because the targets are all up to
> date. If the .exe confusion means that your makefile is violating
> Paul's rule #2 then one or both executable will be rebuilt by the
> second make.

Here's the kicker: through some Cygwin magic, a stat call on 'foobar'
will pick up a file named 'foobar.exe'. Thus, running make twice
demonstrates proper behavior: nothing is recompiled.

Maybe I'm violating the rule, maybe I'm not. According to the only
makefile, Paul's 2nd rule is not violated. In practice on Windows
systems, it is being violated, but in a manner that usually prevents
make from getting confused: make clean being the exception. I suppose if
you tried to use a non-GNU make problems would arise though...

Greg Chicares wrote:
> Here's how automake handles it: [snip]

Yeah, I'm sure that would fix the problem, but do I want to do that? I
want to be lazy, therefore, I don't want to have to be sticking
${EXEEXT} variable substitutions willy nilly.

I need to figure out how to use automake/autoconf sometime. However, for
now, learn how to walk before you run. :-)

> %$(EXEEXT):

What is the % for?

Finally, another pedantic issue: do you use braces or parentheses for
variable substitution? Why? (it seems to me that braces are used for
make-defined variables while parentheseses are used for user-defined
variables)

- --
 Edward Z. Yang      Personal: address@hidden
 SN:Ambush Commander Website: http://www.thewritingpot.com/
 GPGKey:0x869C48DA   http://www.thewritingpot.com/gpgpubkey.asc
 3FA8 E9A9 7385 B691 A6FC B3CB A933 BE7D 869C 48DA
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.1 (MingW32)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org

iD8DBQFFf2I4qTO+fYacSNoRArphAJ9tIBnTzqBGGHyvWtjfQBTGognFhQCeOn8Z
6EcC2PTcoPxLg0Yb4b0eJmw=
=9cgq
-----END PGP SIGNATURE-----




reply via email to

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