ifeq comparison problem
by shogun1234 from LinuxQuestions.org on (#5FEKV)
I think I am confused with ifneq clause in Makefile (make: 4.3/ kernel: 5.6.0-1-rt-amd64, debian bullseye/sid).
I want to check if svn command exists or not so I draft the following in Makefile
Code: $(eval svn_path := $(shell which svn))
$(eval svn_bin := $(shell basename $(svn_path)))
$(warning svn_bin=$(svn_bin)) // this line prints svn_bin=svn
ifneq ($(svn_bin),svn)
echo "svn=$(svn_bin)"
endifMy expectation is ifneq will skip the echo section because I have svn installed and the variable svn_bin is svn so svn = svn, which should skip the echo line. However the result is the execution goes down to echo statement and prints svn=svn. I am really confused.
So I check the doc at [1]. I copy the example, changing ifeq to ifneq; and run the problem. The result does exactly show ifneq then gcc will get printed on console. So I do not know what goes wrong with my code (I expect svn = svn, so the echo statement should not be ran at all).
Any advice? Thanks
[1]. https://www.gnu.org/software/make/ma...l-Example.html


I want to check if svn command exists or not so I draft the following in Makefile
Code: $(eval svn_path := $(shell which svn))
$(eval svn_bin := $(shell basename $(svn_path)))
$(warning svn_bin=$(svn_bin)) // this line prints svn_bin=svn
ifneq ($(svn_bin),svn)
echo "svn=$(svn_bin)"
endifMy expectation is ifneq will skip the echo section because I have svn installed and the variable svn_bin is svn so svn = svn, which should skip the echo line. However the result is the execution goes down to echo statement and prints svn=svn. I am really confused.
So I check the doc at [1]. I copy the example, changing ifeq to ifneq; and run the problem. The result does exactly show ifneq then gcc will get printed on console. So I do not know what goes wrong with my code (I expect svn = svn, so the echo statement should not be ran at all).
Any advice? Thanks
[1]. https://www.gnu.org/software/make/ma...l-Example.html