On Mon, Oct 1, 2018 at 8:17 PM S Tao <pr2...@hotmail.com> wrote: > Hi, I wrote a make target "test-test" as below. my intention is to assign > 1/2 to v1/v2 respectively.
However, when I run command "make test-test", I am getting "v1 == v2". Why? You should read GNU make info pages, section 3.7 "How `make' Reads a Makefile". It describes there how GNU make processing is a two phase process and how various places in the makefile syntax are handled in one phase, the other, or both. Your makefile tries to have something done in phase 2 (all expansion processing from a recipe) affect processing in stage 1 (ifeq directives) which cannot work. Do read that section so you understand these phases and how that affects these limitations. > What workaround is available to achieve what I want to do here? Thank you > very much for your helps. > You have three options: A) set v1 and v2 outside of the recipes, so that the ifeq directive can test them. Only works if they're the same for all recipes. B) instead of an ifeq directive which happens in phase 1, use $(if) with text functions like $(findstring) to perform the equality comparison. Depending on what v1 and v2 might contain in the full setup, testing equality can be easy or difficult. C) do what everyone has done for 40 years: use shell conditionals, ala @ if [ "$(v1)" = "$(v2)" ]; then echo...; fi Philip Guenther _______________________________________________ Help-make mailing list Help-make@gnu.org https://lists.gnu.org/mailman/listinfo/help-make