Re: Rule formulation

Rob Walker <[email protected]>
Newsgroups gmane.comp.gnu.make.windows
Message-ID <[email protected]>
Just add an empty rule for fileB, like so:

fileB:

-Rob

haues1 wrote:
> Hi,
>
> I am trying to formulate a rule for the following task:
>
> The target "fileA" is created by executing the command
> "Cmd_to_create_fileA", which does NOT require the "fileB". There is no rule
> in GnuMake to create "fileB". Still, I would like to make the creation of
> "fileA" dependent on "fileB", according to the conditons:
>
> Execute "Cmd_to_create_fileA"
> 	1) if fileA exists and fileB exists and fileB is younger than fileA;
> 	2) if fileA exists and fileB does not exist;
> 	3) if fileA does not exist and fileB exists;
> 	4) if fileA does not exist and fileB does not exist;
> or, formulated the other way round, do NOT execute "Cmd_to_create_fileA":
> 	if fileA exists and fileB exists and fileB is older than fileA;
>
> The conditions 1) and 3) are covered by the standard rule:
>
>      fileA: fileB
>             Cmd_to_create_fileA
>
> In cases 2) and 4) gnumake doesn't find a rule to create fileB, and aborts
> with an error like "Don't now how to make fileB". How can I formulate the
> rule, so no error occurs?
>
> Can somebody please help me?
>
> Cheers
> Haues
>
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.