[Top][All Lists]

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

Re: How to refer to the first target?

From: Peng Yu
Subject: Re: How to refer to the first target?
Date: Wed, 21 Apr 2010 10:25:48 -0500

On Thu, Nov 26, 2009 at 3:44 PM, Allan Odgaard
<address@hidden> wrote:
> On 26 Nov 2009, at 22:29, Peng Yu wrote:
>>> [...]
>> This solution seems awkward to me. There maybe not be a good pattern that
>> catch both a and b. Should gnu make have a more natural solution to this
>> problem?
> I had the problem with ANTLR which is a parser-generator and generates
> multiple files.
> I ended up with a solution a la:
>    grammar.cpp: grammar.g
>        antlr …
>    lexer.cpp: grammar.cpp
>        touch $@
> Here antlr generates both grammar.cpp + lexer.cpp, but as far as make knows,
> lexer.cpp is generated from grammar.cpp which is what depends on grammar.g.

Although this works for a program that generated only a small number
of file, it is still cumbersome for a program that generated thousands
of files, right?

Suppose 'program.exe' generate output1, output2,...,output100000,

The rules will look like.

output1: program.exe

output2: output1
   touch $@


output100000: output1
   touch $@

Also, when I delete file 'b' but not file 'a' after I run make once,
the target 'b' will not be updated correctly.

.PHONY: all

all: a b


b: a
        touch $@

reply via email to

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