title: GNU make ifeq comparison not working
body: <p>I am trying to have a command executed depending on the current target from a list of targets (currently only one entry in that list) before another makefile is executed.</p>
  
  <p>i have this:</p>
  
  <pre><code>$(LIBS):            
  ifeq ($@,libname)
          my command here
  endif
          $(MAKE) -C ./lib/$@
  </code></pre>
  
  <p>the problem is, that the <code>ifeq</code> does not get executed even if the target name is correct. Using an <code>$(info $@)</code> shows exactly the libname but the expression is not evaluated as true.
  I thought maybe there is a problem with expansion of the automatic variable in a conditional so i tried using an <code>eval</code> like this:</p>
  
  <pre><code>$(LIBS):
          $(eval CURRENT_LIB := $@)
  ifeq ($(CURRENT_LIB),libname)
          my command here
  endif
          $(MAKE) -C ./lib/$@
  </code></pre>
  
  <p>info shows that the variable now equals exactly the libname but the ifeq does not get excuted.
  When i enter something like <code>ifeq (libname,libname)</code> it works so the statement is working, but the comparison between variable and text does not evaluate to true even if the two are equal and it should work.
  GNU make version is 4.1</p>
  
  <p>What am i missing here?</p>
  
  <p>Complete Makefile:</p>
  
  <pre><code>CC := g++
  CFLAGS := -v -std=c++0x -pthread -Wall -g -O3
  
  OBJ := mycode.o
  OBJ += moreobjects.o
  #more objects in here
  
  LIBS = libname
  
  .PHONY: libs $(LIBS)
  
  SRC = $(OBJ:%.o=%.cpp)
  DEPFILE := .depend
  
  mytarget: libs $(OBJ)
          $(CC) $(CFLAGS) -o $@ $(OBJ)
  
  -include $(DEPFILE)
  
  %.o: %.cpp
          $(CC) $(CFLAGS) -c $&lt;
          $(CC) -MM -std=c++11 $(SRC) &gt; $(DEPFILE)
  
  libs: $(LIBS)
  
  $(LIBS):
          $(eval CURRENT_LIB := $@)
  ifeq ($(CURRENT_LIB),libname)
          ./lib/$(CURRENT_LIB)/configure
  endif
          $(MAKE) -C ./lib/$@
  
  .PHONY: clean_all
  clean_all: clean
          $(foreach dir,$(LIBS),$(MAKE) clean -C ./lib/$(dir))
  
  
  .PHONY: clean
  clean:
          rm -rf mytarget $(OBJ) $(DEPFILE)
  </code></pre>
  
  <p>Thank You very much!</p>