On Tue, 2018-10-02 at 03:23 +0000, S Tao wrote: > test-test: > $(eval v1=$(shell sh -c "echo 1")) > $(eval v2=$(shell sh -c "echo 2")) > @echo "v1=$(strip $(v1))=" > @echo "v2=$(strip $(v2))=" > ifeq ("$(strip $(v1))", "$(strip $(v2))") > @echo "v1 == v2" > endif > .PHONY: test-test
Using 'eval' and 'shell' functions inside a recipe is an anti-pattern. It can be useful in advanced situations that you likely won't run into until you've been writing complex makefiles for a long time. You should avoid it until that time. Philip's answer is right on as to where you should go to read more about why this doesn't work, but for this: > C) do what everyone has done for 40 years: use shell conditionals, > ala @ if [ "$(v1)" = "$(v2)" ]; then echo...; fi I would go farther and say the ENTIRE rule should be rewritten using the shell without any 'eval' or 'shell' make functions, as in: test-test: @v1=1; \ v2=2; \ if [ $$v1 = $$v2 ]; then echo 'v1 == v2'; fi Of course when written this way this recipe isn't really useful, so it would be better if instead you asked us about the problem you're really trying to solve. Cheers! _______________________________________________ Help-make mailing list Help-make@gnu.org https://lists.gnu.org/mailman/listinfo/help-make