* [Qemu-devel] one question on the makefile
@ 2012-06-12 8:33 Wei Yang
2012-06-12 8:50 ` Paolo Bonzini
0 siblings, 1 reply; 3+ messages in thread
From: Wei Yang @ 2012-06-12 8:33 UTC (permalink / raw)
To: qemu-devel; +Cc: Richard Yang
All,
I saw a makefile rule which confused.
This is in the tests/Makefile
.PHONY: $(patsubst %, check-qtest-%, $(QTEST_TARGETS))
$(patsubst %, check-qtest-%, $(QTEST_TARGETS)): check-qtest-%: $(check-qtest-y)
$(call quiet-command,QTEST_QEMU_BINARY=$*-softmmu/qemu-system-$* \
gtester $(GTESTER_OPTIONS) -m=$(SPEED) $(check-qtest-$*-y),"GTESTER $@")
I know the general idea is to create a rule for target such as
check-qtest-x86_64.
There are two colons, usually there is one colon in dependency.
And the result dependency is
check-qtest-x86_64: tests/fdc-test tests/rtc-test tests/cwd-test
It is expanded to the content of check-qtest-x86_64-y.
I searched the googl and makefile manual. Do not find a result.
Could someone give me a hint?
Thanks a lot.
--
Richard Yang
Help You, Help Me
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [Qemu-devel] one question on the makefile
2012-06-12 8:33 [Qemu-devel] one question on the makefile Wei Yang
@ 2012-06-12 8:50 ` Paolo Bonzini
2012-06-12 13:26 ` Richard Yang
0 siblings, 1 reply; 3+ messages in thread
From: Paolo Bonzini @ 2012-06-12 8:50 UTC (permalink / raw)
To: Wei Yang; +Cc: Richard Yang, qemu-devel
Il 12/06/2012 10:33, Wei Yang ha scritto:
> .PHONY: $(patsubst %, check-qtest-%, $(QTEST_TARGETS))
> $(patsubst %, check-qtest-%, $(QTEST_TARGETS)): check-qtest-%: $(check-qtest-y)
> $(call quiet-command,QTEST_QEMU_BINARY=$*-softmmu/qemu-system-$* \
> gtester $(GTESTER_OPTIONS) -m=$(SPEED) $(check-qtest-$*-y),"GTESTER $@")
>
> I know the general idea is to create a rule for target such as
> check-qtest-x86_64.
>
> There are two colons, usually there is one colon in dependency.
Search for "Static pattern rules". Static pattern rules are probably
the single most useful GNU make extension. They greatly limit the
amount of "magic" the make does, so the resulting Makefiles are more
easily debuggable. Here is an extract from the GNU make manual:
=====
TARGETS ...: TARGET-PATTERN: PREREQ-PATTERNS ...
RECIPE
...
The TARGETS list specifies the targets that the rule applies to. The
targets can contain wildcard characters, just like the targets of
ordinary rules (*note Using Wildcard Characters in File Names:
Wildcards.).
The TARGET-PATTERN and PREREQ-PATTERNS say how to compute the
prerequisites of each target. Each target is matched against the
TARGET-PATTERN to extract a part of the target name, called the "stem".
This stem is substituted into each of the PREREQ-PATTERNS to make the
prerequisite names (one from each PREREQ-PATTERN).
=====
$* is also replaced by the stem. In fact in this case, the stem is not
used in the PREREQ-PATTERNS, it is only used in the commands.
Paolo
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [Qemu-devel] one question on the makefile
2012-06-12 8:50 ` Paolo Bonzini
@ 2012-06-12 13:26 ` Richard Yang
0 siblings, 0 replies; 3+ messages in thread
From: Richard Yang @ 2012-06-12 13:26 UTC (permalink / raw)
To: Paolo Bonzini; +Cc: Richard Yang, Wei Yang, qemu-devel
On Tue, Jun 12, 2012 at 10:50:33AM +0200, Paolo Bonzini wrote:
>Il 12/06/2012 10:33, Wei Yang ha scritto:
>> .PHONY: $(patsubst %, check-qtest-%, $(QTEST_TARGETS))
>> $(patsubst %, check-qtest-%, $(QTEST_TARGETS)): check-qtest-%: $(check-qtest-y)
>> $(call quiet-command,QTEST_QEMU_BINARY=$*-softmmu/qemu-system-$* \
>> gtester $(GTESTER_OPTIONS) -m=$(SPEED) $(check-qtest-$*-y),"GTESTER $@")
>>
>> I know the general idea is to create a rule for target such as
>> check-qtest-x86_64.
>>
>> There are two colons, usually there is one colon in dependency.
>
>Search for "Static pattern rules". Static pattern rules are probably
>the single most useful GNU make extension. They greatly limit the
>amount of "magic" the make does, so the resulting Makefiles are more
>easily debuggable. Here is an extract from the GNU make manual:
>
>=====
> TARGETS ...: TARGET-PATTERN: PREREQ-PATTERNS ...
> RECIPE
> ...
>
>The TARGETS list specifies the targets that the rule applies to. The
>targets can contain wildcard characters, just like the targets of
>ordinary rules (*note Using Wildcard Characters in File Names:
>Wildcards.).
>
> The TARGET-PATTERN and PREREQ-PATTERNS say how to compute the
>prerequisites of each target. Each target is matched against the
>TARGET-PATTERN to extract a part of the target name, called the "stem".
>This stem is substituted into each of the PREREQ-PATTERNS to make the
>prerequisite names (one from each PREREQ-PATTERN).
>=====
>
>
>$* is also replaced by the stem. In fact in this case, the stem is not
>used in the PREREQ-PATTERNS, it is only used in the commands.
>
>Paolo
Thanks :)
I learn it.
--
Richard Yang
Help you, Help me
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2012-06-12 13:26 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-06-12 8:33 [Qemu-devel] one question on the makefile Wei Yang
2012-06-12 8:50 ` Paolo Bonzini
2012-06-12 13:26 ` Richard Yang
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).