From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([208.118.235.92]:41188) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1SeR7J-0004If-5q for qemu-devel@nongnu.org; Tue, 12 Jun 2012 09:26:45 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1SeR7D-0003sK-NZ for qemu-devel@nongnu.org; Tue, 12 Jun 2012 09:26:40 -0400 Received: from e23smtp06.au.ibm.com ([202.81.31.148]:43907) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1SeR7D-0003pe-62 for qemu-devel@nongnu.org; Tue, 12 Jun 2012 09:26:35 -0400 Received: from /spool/local by e23smtp06.au.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Tue, 12 Jun 2012 13:20:16 +1000 Received: from d23av01.au.ibm.com (d23av01.au.ibm.com [9.190.234.96]) by d23relay03.au.ibm.com (8.13.8/8.13.8/NCO v10.0) with ESMTP id q5CDQLXQ5636484 for ; Tue, 12 Jun 2012 23:26:21 +1000 Received: from d23av01.au.ibm.com (loopback [127.0.0.1]) by d23av01.au.ibm.com (8.14.4/8.13.1/NCO v10.0 AVout) with ESMTP id q5CDQK7l021104 for ; Tue, 12 Jun 2012 23:26:20 +1000 Date: Tue, 12 Jun 2012 21:26:18 +0800 From: Richard Yang Message-ID: <20120612132618.GA2824@richard> References: <4FD702D9.8060204@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <4FD702D9.8060204@redhat.com> Subject: Re: [Qemu-devel] one question on the makefile Reply-To: Richard Yang List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Paolo Bonzini Cc: Richard Yang , Wei Yang , qemu-devel@nongnu.org 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