title: Use of %.o : %.c in makefile
body: <p>I have this makefile :</p>
  
  <pre><code>CC = gcc
  CFLAGS = -std=c99 -W -Wall
  CFLAGSS = -std=c99 -W
  LIBS = -lm
  
  prog : main.o double.o coord2D.o coord3D.o
      $(CC) $^ $(LIBS) -o $@
  
  %.o : %.c
      $(CC) $(CFLAGS) $&lt; -c
  
  coord2D.o: coord2D.c coord2D.h double.h
  coord3D.o: coord3D.c coord3D.h double.h
  double.o: double.c double.h
  main.o: main.c double.h coord2D.h coord3D.h
  </code></pre>
  
  <p><strong>My question :</strong><br>
  What does the line "%.o : %.c" do ?  </p>
  
  <p><strong>Where I am :</strong><br>
  I've done a lot of researches but I still don't know exactly how it works.<br>
  From what I've learned, when we type "make":<br>
  - we go to the first rule "prog" which contains the dependency "main.o"<br>
  - because of that, we go to the rule "main.o" which is recognized by "%.o : %.c" because it contains the pattern "main.o : main.c" and compiled.<br>
  - we then go back to "prog", which contains "double.o" and we repeat the steps </p>
  
  <p>Is this how it works ? If so, I have a second question : what if we write "%.o : %.c coord2D.h double.h" ? Will it only take the rule "main.o" in consideration because it's the only one which contains a file ".c" and the two ".h" files ?</p>