title: Printing CFLAGS in GNU make exaclty once if source files have changed
body: <p>Here is a snippet from my makefile:</p>
  
  <pre><code>all: $(TARGET) 
  
  $(C_OBJS): %.o: %.c
      @ echo -n "Compiling " $*.c;
      @ $(CC) -c $(CFLAGS) $*.c -o $*.o
      @ echo " ...... Done"
  
  $(TARGET): $(C_OBJS)
      @ $(AR) rus $@ $(C_OBJS);
  
  print_cflags:
      @ echo "CFLAGS: " $(CFLAGS) "\n"
  </code></pre>
  
  <p>Moving forward, I want to </p>
  
  <ol>
  <li>Print the <code>CFLAGS</code> <strong>once</strong> if compilation takes place.</li>
  <li>Get <code>make: Nothing to be done for "all"</code> message if no modifications has been done from previous build. Printing <code>CFLAGS</code> is optional in this case.</li>
  </ol>
  
  <p>I feel, it can be achieved by keeping a counter inside <code>$(C_OBJS): %.o: %.c</code>But is there any better way to achieve this?
  I understand that this is a very specific question but any help will be appreciated. </p>