title: Gcc error: cannot specify -c and -o with multiple files
body: <p>I would like to compile many source files assemble them but do not link them
  I use a makefile like the following</p>
  
  <pre><code>sources = $(wildcard absolut_path_to_source_files/*.c)
  objects = absolut_path_to_source_files_folder
  compile = $(foreach p,$(sources), gcc -c $(p) -o $(objects)/$(patsubst %.c,%.o,$(notdir $(p)) ))
  all:
       $(compile)
  </code></pre>
  
  <p>I get a gcc error that the two flags <code>-c</code> and <code>-o</code> cannot be used at the same time for several source files, </p>
  
  <pre><code>    gcc: fatal error: cannot specify -o with -c, -S or -E with multiple files
      compilation terminated.
  </code></pre>
  
  <p>which is something I don't understand since it is used inside the <code>foreach</code> function which calls gcc for one and only one source file at a time (iteration).</p>