On 06/06/2016 14:50, Eduardo Habkost wrote:
>   # Makes the definition constant after the first expansion
>   DOCKER_SRC_COPY = $(eval DOCKER_SRC_COPY := 
> docker-src.$(CUR_TIME))$(DOCKER_SRC_COPY)
>   
>   $(shell echo DEBUG: src_copy: $(DOCKER_SRC_COPY) >&2)
>   
>   $(DOCKER_SRC_COPY):
>       @mkdir $@
>       $(call make-archive-maybe, $(SRC_PATH), $@/qemu.tgz)
> 
> and I still get a failure: https://travis-ci.org/ehabkost/qemu/jobs/135574871
> 
>   $ make -j3 && ${TEST_CMD}
>   DEBUG: cur_time: 2016.13278
>   /home/travis/build/ehabkost/qemu/tests/docker/Makefile.include:37: *** 
> unterminated variable reference.  Stop.
> 
> I am very confused by that code: using "=" to make a variable
> reference itself is not allowed, but in this case no error is
> reported because of the $(eval) trick. I have no idea what will
> happen the second time the variable is expanded. Isn't $(eval)
> going to be expanded again?

No, the second time you'll get the expansion of

DOCKER_SRC_COPY := docker-src.$(CUR_TIME)

> 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.

Paolo

Reply via email to