title: Build to static libs and DPDK into an image file
body: <p>I have a project lets call it AB, which looks a follows:</p>
  
  <pre><code>/path/to/&lt;br&gt;
  ---|dpdk-stable-17.05.1/...&lt;br&gt;
  ---|AB/&lt;br&gt;
  ------|main.cpp&lt;br&gt;
  ------|Makefile&lt;br&gt;
  ------|dir1/&lt;br&gt;
  ----------|c1.c&lt;br&gt;
  ----------|c2.c&lt;br&gt;
  ----------|c3.c&lt;br&gt;
  ----------|h1.h&lt;br&gt;
  ----------|Makefile&lt;br&gt;
  ------|dir2/&lt;br&gt;
  ----------|h2.h&lt;br&gt;
  ----------|cpp1.cpp&lt;br&gt;
  ----------|cpp2.cpp&lt;br&gt;
  ----------|Makefile&lt;br&gt;
  </code></pre>
  
  <p>I've compiled the dpdk with make install successfuly.<br>
  I am trying to create dir1.a and dir2.a and to build together with main.cpp and of-course the DPDK libs an "AB" image file.<br></p>
  
  <p>The Makefile in AB (the main makefile) looks as follows:</p>
  
  <pre><code>&gt;DPDK_VER=dpdk-stable-17.05.1
  &gt;
  &gt;RTE_SDK=$(shell pwd | sed -n 's/AB.*//p')/$(DPDK_VER)&lt;br&gt;
  &gt;RTE_TARGET=build
  &gt;
  &gt;include $(RTE_SDK)/mk/rte.vars.mk
  &gt;
  &gt;XXFLAGS := $(CFLAGS) -I../dir1/ -g&lt;br&gt;
  &gt;CXXFLAGS += -std=c++1y -D__STDC_LIMIT_MACROS -D__STDC_FORMAT_MACROS&lt;br&gt;
  &gt;CFLAGS += -g -O0 -std=gnu99 -Wall -Wno-unused-value&lt;br&gt;
  &gt;LDLIBS += -lfuse -lstdc++ --start-group -ldir1 -ldir2
  &gt;
  &gt;LDFLAGS +=  --end-group
  &gt;
  &gt;APP = AB
  &gt;
  &gt;SRCS-y :=  main.cpp
  &gt; 
  &gt;OBJS-y := main.o
  &gt;           
  &gt;SRCS-y := $(patsubst %.cpp,%.c,$(SRCS-y))&lt;br&gt;
  &gt;OBJS-y := $(patsubst %.o,obj/%.o,$(OBJS-y))
  &gt;
  &gt;DIRS-y = &lt;br&gt;
  &gt;DIRS-y += dir1&lt;br&gt;
  &gt;DIRS-y += dir2
  &gt;
  &gt;.PHONY: dirs-y $(DIRS-y)
  &gt;
  &gt;include $(RTE_SDK)/mk/rte.subdir.mk&lt;br&gt;
  &gt;include $(RTE_SDK)/mk/rte.extapp.mk
  &gt;
  &gt;.PHONY: clean&lt;br&gt;
  &gt;clean:&lt;br&gt;
  &gt;   rm -rf *.o build/*.o build/$(APP)
  </code></pre>
  
  <p>The Makefile in dir1 looks:</p>
  
  <pre><code>&gt;DPDK_VER=dpdk-stable-17.05.1
  &gt;
  &gt;RTE_SDK=$(shell pwd | sed -n 's/AB.*//p')/$(DPDK_VER)&lt;BR&gt;
  &gt;RTE_TARGET=build
  
  &gt;include $(RTE_SDK)/mk/rte.vars.mk
  &gt;
  &gt;export RTE_OUTPUT=$(shell pwd)/../build/
  &gt;
  &gt;CXXFLAGS := $(CFLAGS) -g&lt;BR&gt;
  &gt;CXXFLAGS += -std=c++1y -D__STDC_LIMIT_MACROS -D__STDC_FORMAT_MACROS -lgnustl_shared&lt;br&gt;
  &gt;CFLAGS += -g -O0 -std=gnu99 -Wall -Wno-unused-value -I../dir2
  &gt;
  &gt;LIB = dir1.a
  &gt;
  &gt;SRCS-y :=  c1.c c2.c c3.c&lt;br&gt;
  &gt;OBJS-y :=  c1.o c2.o c3.o
  &gt;                           
  &gt;SRCS-y := $(patsubst %.cpp,%.c,$(SRCS-y))&lt;br&gt;
  &gt;OBJS-y := $(patsubst %.o,obj/%.o,$(OBJS-y))
  &gt;
  &gt;include $(RTE_SDK)/mk/rte.extlib.mk
  &gt;
  &gt;.PHONY: all&lt;br&gt;
  &gt;   all
  &gt;
  &gt;.PHONY: clean&lt;br&gt;
  &gt;clean:&lt;br&gt;
  &gt;   rm -rf *.o *.a ../build/lib/$(LIB)'
  </code></pre>
  
  <p>The Makefile in dir2 looks:</p>
  
  <pre><code>&gt;DPDK_VER=dpdk-stable-17.05.1
  &gt;
  &gt;RTE_SDK=$(shell pwd | sed -n 's/AB.*//p')/$(DPDK_VER)&lt;br&gt;
  &gt;RTE_TARGET=build
  &gt;   
  &gt;include $(RTE_SDK)/mk/rte.vars.mk
  &gt;
  &gt;export RTE_OUTPUT=$(shell pwd)/../build/
  &gt;   
  &gt;CXXFLAGS := $(CFLAGS) -g&lt;br&gt;
  &gt;CXXFLAGS += -std=c++1y -D__STDC_LIMIT_MACROS -D__STDC_FORMAT_MACROS -lgnustl_shared -I../dir1 -I.&lt;br&gt;
  &gt;CFLAGS += -g -O0 -std=gnu99 -Wall -Wno-unused-value&lt;br&gt;
  &gt;
  &gt;LIB = dir1.a
  &gt;
  &gt;SRCS-y := cpp1.cpp cpp2.cpp&lt;br&gt;
  &gt;OBJS-y := cpp1.o cpp2.o
  &gt;
  &gt;SRCS-y := $(patsubst %.cpp,%.c,$(SRCS-y))&lt;br&gt;
  &gt;OBJS-y := $(patsubst %.o,obj/%.o,$(OBJS-y))
  &gt;
  &gt;include $(RTE_SDK)/mk/rte.extlib.mk
  &gt;
  &gt;.PHONY: all&lt;br&gt;
  &gt;   all
  &gt;   
  &gt;.PHONY: clean&lt;br&gt;
  &gt;clean:&lt;br&gt;
  &gt;   rm -rf *.o *.a ../build/lib/$(LIB)
  </code></pre>
  
  <p>the <i>make</i> output is:</p>
  
  <blockquote>
    <p>== Build /dir1<br>
     CC c1.o<br>
     CC c2.o<br>
     CC c3.o<br>
     AR dir1.a<br>
     INSTALL-LIB dir1.a<br>
    == Build /dir2<br>
    g++ -m64 -pthread  -march=native -DRTE_MACHINE_CPUFLAG_SSE -DRTE_MACHINE_CPUFLAG_SSE2 -DRTE_MACHINE_CPUFLAG_SSE3 -DRTE_MACHINE_CPUFLAG_SSSE3 -DRTE_MACHINE_CPUFLAG_SSE4_1 -DRTE_MACHINE_CPUFLAG_SSE4_2  -I/path/to/AB/build/include -I/path/to/dpdk-stable-17.05.1/build/include -include /path/to/dpdk-stable-17.05.1/build/include/rte_config.h -g -std=c++1y -D__STDC_LIMIT_MACROS -D__STDC_FORMAT_MACROS -lgnustl_shared -I../dir1 -I.   -c -o cpp1.o cpp2.cpp<br>
    g++ -m64 -pthread  -march=native -DRTE_MACHINE_CPUFLAG_SSE -DRTE_MACHINE_CPUFLAG_SSE2 -DRTE_MACHINE_CPUFLAG_SSE3 -DRTE_MACHINE_CPUFLAG_SSSE3 -DRTE_MACHINE_CPUFLAG_SSE4_1 -DRTE_MACHINE_CPUFLAG_SSE4_2  -I/path/to/AB/build/include -I/path/to/dpdk-stable-17.05.1/build/include -include /path/to/dpdk-stable-17.05.1/build/include/rte_config.h -g -std=c++1y -D__STDC_LIMIT_MACROS -D__STDC_FORMAT_MACROS -lgnustl_shared -I../dir1 -I.   -c -o cpp2.o cpp2.cpp<br>
    <br>
     AR dir2.a<br>
    INSTALL-LIB dir2.a<br>
    /path/to/dpdk-stable-17.05.1/mk/internal/rte.install-post.mk:98: warning: overriding recipe for target <code>_postinstall'&lt;br&gt;
    /path/to/dpdk-stable-17.05.1/mk/internal/rte.install-post.mk:75: warning: ignoring old recipe for target</code>_postinstall'<br>
    /path/to//dpdk-stable-17.05.1/mk/internal/rte.clean-post.mk:61: warning: overriding recipe for target <code>_postclean'&lt;br&gt;
    /path/to//dpdk-stable-17.05.1/mk/internal/rte.clean-post.mk:38: warning: ignoring old recipe for target</code>_postclean'<br>
    /path/to//dpdk-stable-17.05.1/mk/internal/rte.build-post.mk:38: warning: overriding recipe for target <code>_postbuild'&lt;br&gt;
    /path/to/dpdk-stable-17.05.1/mk/internal/rte.build-post.mk:38: warning: ignoring old recipe for target</code>_postbuild'<br>
    /path/to/AB/Makefile:40: warning: overriding recipe for target <code>clean'&lt;br&gt;
    /path/to/dpdk-stable-17.05.1/mk/rte.app.mk:308: warning: ignoring old recipe for target</code>clean'<br>
    g++ -m64 -pthread  -march=native -DRTE_MACHINE_CPUFLAG_SSE -DRTE_MACHINE_CPUFLAG_SSE2 -DRTE_MACHINE_CPUFLAG_SSE3 -DRTE_MACHINE_CPUFLAG_SSSE3 -DRTE_MACHINE_CPUFLAG_SSE4_1 -DRTE_MACHINE_CPUFLAG_SSE4_2  -I/path/to/AB/build/include -I/path/to/dpdk-stable-17.05.1/build/include -include /path/to/dpdk-stable-17.05.1/build/include/rte_config.h -I../dir1/ -g  -std=c++1y -D__STDC_LIMIT_MACROS -D__STDC_FORMAT_MACROS   -c -o main.o /path/to/AB/main.cpp<br>
     LD AB<br>
    == Build /path/to/AB/dir1<br>
    make[2]: <strong>* No rule to make target <code>c1.o', needed by</code>dir1.a'.  >Stop.<br>
    make[1]: *</strong> [dir1] Error 2<br>
    make: *** [all] Error 2</p>
  </blockquote>
  
  <p>The dir.a dir2.a and AB image are all created!<br>
  BUT:<br>
  1) why does the make goes back to Build dir1 at the end and announces that the c1.o is missing for dir1.o?<br>
  2) How to get rid of the "warning: ignoring old recipe for target `XXX'"?<br>
  <br>
  Thanks!</p>