help-make
[Top][All Lists]
Advanced

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

Target-specific Pattern rule works: Is this a feature?


From: Lutz Kohlrausch
Subject: Target-specific Pattern rule works: Is this a feature?
Date: Mon, 10 Feb 2014 17:40:06 +0100 (CET)

In the Makefiles of a build project here, there is a line with two colons. It 
seems to define what I would call a target-specific pattern rule. I've included 
a simplified example below (see especially line 9).

The two colons divide that line into 3 parts, I'll refer to them as first, 
second and third part.

In the real Makefile, the first part of that line is a variable reference with 
substitution. the second and third part then seem to establish a Pattern based 
rule that is only valid for the targets listed in the first part. The middle 
part is needed to specify what part of the targets' names is to be represented 
by the percent sign.

I have searched for documentation of this feature as I'd like that we use an 
established feature of Gnu Make and not something that works accidentally and 
might go away in future. But I have not found documentation that says this is 
legal. For example for target-specific variable assignments, such documentation 
exists.

So my question is, is this indended to work like we observe here, or are we 
seeing some convenient but inintentional side-effect? Where would I find the 
documentation of this feature?

make --version says GNU Make 3.81


     1  all: test1.copy test2.copy test3.copy
     2  
     3  %.copy:
     4          cp $< $@
     5  
     6  test1 test2 test3:
     7          touch $@
     8  
     9  test1.copy test2.copy: %.copy: %
    10  
    11  test3.copy: /usr/bin/make
    12  
    13  clean:
    14          rm -f test*



reply via email to

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