basic makefile ifeq how to

214 views Asked by At

I am just learning about Makefiles and am having trouble with ifeq.

Version = GNU Make 3.82

Here is my simple Makefile:

CHECK := 0
CHECK2 := 0                                                                                     

check :  
    @echo "Check=${CHECK}"
    @echo "Check2=${CHECK2}"    
ifeq (${CHECK2},${CHECK}) 
    @echo "EQUAL"
else
    @echo "NOT EQUAL"
endif

Here is the output:

Check=0
Check2=0                                                                                     
NOT EQUAL

Why am I not seeing "EQUAL"?

Thanks!

1

There are 1 answers

3
Pawel Veselov On BEST ANSWER

Makefiles (and make) are extremely white-spaces sensitive. You seem to have a lot of white spaces in definition of CHECK2 (but not for CHECK), so they are not equal.