title: How do I write a "selective" Makefile?
body: <p>noob question here.</p>
  
  <p>I have a directory with a lot of .c files, they're basicely libc functions that I code myself as an exercice.</p>
  
  <p>I write a little main() in these files to test the functions, and I want to write a Makefile that allow me to compile only the file I want to test, for exemple:</p>
  
  <pre><code>make memset.c
  </code></pre>
  
  <p>And get only the executable of the code wrote in memset.c.</p>
  
  <p>I tried to do something like this:</p>
  
  <pre><code>CC = gcc
  CFLAGS = -Wall -Wextra -pedantic
  
  all : %.o
      $(CC) $(CFLAGS) $&lt;
  %.o : %.c
      $(CC) $(CFLAGS) $&lt; -c -o $@
  </code></pre>
  
  <p>But obviously it doens't work. I don't what to put in place of the "all".
  I know it's very basic, but I didn't manage to do it, and I did research but didn't find an answer to this specific question.</p>
  
  <p>Thanks in advance for your help.</p>