Received: from eggs.gnu.org ([2001:4830:134:3::10]:42298) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1b9w2r-0004KV-HF for qemu-devel@nongnu.org; Mon, 06 Jun 2016 11:02:26 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1b9w2n-0003sT-9B for qemu-devel@nongnu.org; Mon, 06 Jun 2016 11:02:24 -0400 Received: from mx1.redhat.com ([209.132.183.28]:44412) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1b9w2n-0003sP-3O for qemu-devel@nongnu.org; Mon, 06 Jun 2016 11:02:21 -0400 Date: Mon, 6 Jun 2016 12:02:18 -0300 From: Eduardo Habkost Message-ID: <20160606150218.GG19055@thinpad.lan.raisama.net> References: <20160602191305.GB31052@thinpad.lan.raisama.net> <20160603012327.GB29298@ad.usersys.redhat.com> <20160603182601.GS19055@thinpad.lan.raisama.net> <20160606065824.GA9676@ad.usersys.redhat.com> <20160606114724.GB19055@thinpad.lan.raisama.net> <20160606115423.GC19055@thinpad.lan.raisama.net> <20160606125034.GE19055@thinpad.lan.raisama.net> <20160606141528.GF19055@thinpad.lan.raisama.net> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: Subject: Re: [Qemu-devel] [PULL 04/16] Makefile: Rules for docker testing List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Paolo Bonzini Cc: Fam Zheng , peter.maydell@linaro.org, qemu-devel@nongnu.org On Mon, Jun 06, 2016 at 04:32:50PM +0200, Paolo Bonzini wrote: > On 06/06/2016 16:15, Eduardo Habkost wrote: > >> > No, the second time you'll get the expansion of > >> > > >> > DOCKER_SRC_COPY := docker-src.$(CUR_TIME) > > And why it isn't enough to simply write the above line in the > > Makefile without any eval trick? > > Because 1) initially the idea was to delay the $(mkdir) too 2) Too many > $(shell) end up slowing down make. Now I see: you wanted to delay the shell command, but evaluate it only once. But I don't see why it makes sense here, because the variable is being expanded immediately after it is defined (in the "$(DOCKER_SRC_COPY):" line), and CUR_TIME is already defined using ":=". > > >>> > > Why did you use this trick instead of just relying on ":=" to > >>> > > expand the shell command only once? > >> > > >> > I think initially the $(mkdir) was in DOCKER_SRC_COPY too. Also, too > >> > many $(shell) end up slowing down make. > > And how exactly does the eval trick helps avoiding slowing down > > make, that wouldn't happen if using just: > > DOCKER_SRC_COPY = docker-src.$(CUR_TIME) > > ? Oops, I mean: DOCKER_SRC_COPY := docker-src.$(CUR_TIME) > > If you define CUR_TIME with "=", the DOCKER_SRC_COPY value changes every > second. If you define CUR_TIME with ":=", again you have a useless > $(shell). Why a useless shell? > > In this particular case I agree that it's probably premature optimization. In this particular case it doesn't seem to be an optimization at all. -- Eduardo