title: What is the best approach to use different CFLAGS for the same source files?
body: <p>i need to build the same source tree twice, </p>
  
  <p>1 - with normal cflags to build the project binary<br>
  2 - with cflags plus -fPIC to build a static library that would be some sort of SDK to develop project dynamic modules.</p>
  
  <p>Using only one Makefile, what is the best approach to accomplish this?</p>
  
  <p>It would be nice to do some sort of :</p>
  
  <pre><code>all: $(OBJECTS)
  
  lib_rule: $(OBJECTS)
     CFLAGS += -fPIC
  
  .cpp.o: 
     $(CC) -c $&lt; -o $@ $(CFLAGS)
  </code></pre>
  
  <p>But obviously it can't be done.</p>
  
  <p>Thanks</p>