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: Greg Chicares
Subject: Re: Request for critique on a small makefile
Date: Wed, 13 Dec 2006 04:22:41 +0000
User-agent: Thunderbird 1.5.0.4 (Windows/20060516)

On 2006-12-13 2:15 UTC, Edward Z. Yang wrote:
> 
> 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.

With discipline, you can be lazy and still write safe, portable code.
I try to use techniques like $(EXEEXT) that have solved real problems
for others. Writing '.PHONY' where appropriate is another example:
it's verbose, but not terribly, and it guards against a real problem.

However, looking at this again, it seems that I was being careless:

>>> %$(EXEEXT):
> 
> What is the % for?

It's a pattern rule. For example, '%.c' matches 'foo.c' and 'bar.c'.
My intention was to write one rule for all '.exe' targets.

Almost all my work is done on msw, where $(EXEEXT) isn't empty. The
issue I see now is that it becomes a match-anything rule if $(EXEEXT)
happens to be empty--so if I type
  make cleann
with a double 'n' by accident, it'll try to link a program named
'cleann'.

> 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)

AFAIK there's no difference and it's just personal preference.





reply via email to

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