title: Why is only part of the file list of a variable processed in this Makefile?
body: <p>I have this test Makefile which runs ok. It makes three symbolic links and echoes the link names when I do 'make'.</p>
  
  <pre><code>XXX = x.c y.c z.c
  all : | $(XXX)
      cat $(XXX)
  $(XXX) :
      @echo making XXX
      ln -s ../src/$@ $@
  clean :
      rm -f $(XXX)
  </code></pre>
  
  <p>So I applied this to my real case. As a background I'm trying to use a trick which is making symbolic links for source files in the place where I run make and removing the symbolic links by 'make clear' because the existing Makefile structure (with many included patches) assumes the sources are in the same directory. So I'm taking a easy way without fixing the Makefile tree..</p>
  
  <p>I run under a directory called rtn5_fpga and the sources are in ../src directory. The Makefile sets a couple of variables and includes ../Makefile.base. Here is the ../Makefile.base.</p>
  
  <pre><code>#
  #  Makefile
  #
  
  #
  #  RTEMS_MAKEFILE_PATH is typically set in an environment variable
  #
  
  # optional managers required
  MANAGERS=all
  
  # C source names
  
  CSRCS = init.c
  COBJS_ = $(CSRCS:.c=.o)
  COBJS = $(COBJS_:%=${ARCH}/%)
  
  include $(RTEMS_MAKEFILE_PATH)/Makefile.inc
  include $(RTEMS_CUSTOM)
  include $(PROJECT_ROOT)/make/leaf.cfg
  XCFLAGS = -I../../include -qnolinkcmds -T ../../lib/linkcmds.abtn5
  
  OBJS= $(COBJS) $(CXXOBJS) $(ASOBJS)
  
  all: | $(XXX) ${ARCH} $(PGM) RUNTCL
  
  $(PGM): $(OBJS)
      $(make-exe)
  .DEFAULT_TARGET := all
  
  RUNTCL:
      echo 'system_init' &gt; run.tcl
      echo 'load_image o-optimize/sieve.exe' &gt;&gt; run.tcl
      echo 'run $(_RAM_START)' &gt;&gt; run.tcl
  
  clean:
      -$(RM) -r $(ARCH)
      -$(RM) $(XXX)
  
  XXX = init.c system.h config.h
  
  $(XXX) :
      ln -s ../src/$@  $@
  </code></pre>
  
  <p>This is the result of 'make clean' and 'make'.</p>
  
  <pre><code>ckim@stph45:~/test/rtn5_fpga] make clean
  at Makefile.inc RTEMS_API = @RTEMS_API@
  rm -f a.out core mon.out gmon.out
  rm -f -r 
  rm -f -r  a.out *.o *.BAK Depends-o-optimize.tmp
  rm -f -r o-optimize o-debug
  rm -f -r o-optimize
  rm -f init.c system.h config.h
  ckim@stph45:~/prj/abts/rtems-qt/applications/sieve/rtn5_fpga] make
  at Makefile.inc RTEMS_API = @RTEMS_API@
  test -d o-optimize || mkdir o-optimize
  ln -s ../src/init.c  init.c
  sparc-ab-rtems-gcc --pipe -B/some/dir/path/lib/ -specs bsp_specs -qrtems   -Wall -I../../include -qnolinkcmds -T ../../lib/linkcmds.abtn5 -O4    -mtune=v8 -msoft-float -fcommon -DTARGET_ALDEBARAN       -c   -o o-optimize/init.o init.c
  init.c:15:20: fatal error: system.h: No such file or directory
   #include "system.h"
                      ^
  compilation terminated.
  make: *** [o-optimize/init.o] Error 1
  </code></pre>
  
  <p>The problem is, when making $(XXX) at the bottom of ../Makefile.base, it only makes one symbolic link, not three links. What is the problem?</p>