title: collect all .o in subdirectories - makefile
body: <p>I have the following hierarchy:</p>
  
  <pre><code>+ makefile
  |
  + TT_Project1
  |      obj/
  |      makefile
  + TT_Project2
  |      obj/
  |      makefile
  + TT_Project3
  |      obj/
  |      makefile
  </code></pre>
  
  <p>The top level makefile calls recursively all makefiles below it, each compiles the .cpp to .o and places it under <code>/obj</code></p>
  
  <p>I would like to collect all <code>.o</code> in the top level to create a static library. And failing as my output library is too small...</p>
  
  <pre><code>TT := libTT.a
  
  SUBDIRS := $(wildcard */.)
  OBJECTS := $(wildcard $(addsuffix *.o,$(SUBDIRS)/obj))
  
  all: $(TT) $(OBJECTS)
  
  $(TT) : $(OBJECTS)
      ar rcs $(TT) $(OBJECTS)
  
  $(SUBDIRS):
      $(MAKE) -C $@
  </code></pre>
  
  <p>I can clearly see that it's running the makefiles beneath it, and they are placing the <code>*.o</code> under their <code>/obj</code> as expected. But I am failing to grab all the <code>.o</code> I guess... any help is appreciated.</p>