Reputation: 21
I have a project lets call it AB, which looks a follows:
/path/to/<br>
---|dpdk-stable-17.05.1/...<br>
---|AB/<br>
------|main.cpp<br>
------|Makefile<br>
------|dir1/<br>
----------|c1.c<br>
----------|c2.c<br>
----------|c3.c<br>
----------|h1.h<br>
----------|Makefile<br>
------|dir2/<br>
----------|h2.h<br>
----------|cpp1.cpp<br>
----------|cpp2.cpp<br>
----------|Makefile<br>
I've compiled the dpdk with make install successfuly.
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.
The Makefile in AB (the main makefile) looks as follows:
>DPDK_VER=dpdk-stable-17.05.1
>
>RTE_SDK=$(shell pwd | sed -n 's/AB.*//p')/$(DPDK_VER)<br>
>RTE_TARGET=build
>
>include $(RTE_SDK)/mk/rte.vars.mk
>
>XXFLAGS := $(CFLAGS) -I../dir1/ -g<br>
>CXXFLAGS += -std=c++1y -D__STDC_LIMIT_MACROS -D__STDC_FORMAT_MACROS<br>
>CFLAGS += -g -O0 -std=gnu99 -Wall -Wno-unused-value<br>
>LDLIBS += -lfuse -lstdc++ --start-group -ldir1 -ldir2
>
>LDFLAGS += --end-group
>
>APP = AB
>
>SRCS-y := main.cpp
>
>OBJS-y := main.o
>
>SRCS-y := $(patsubst %.cpp,%.c,$(SRCS-y))<br>
>OBJS-y := $(patsubst %.o,obj/%.o,$(OBJS-y))
>
>DIRS-y = <br>
>DIRS-y += dir1<br>
>DIRS-y += dir2
>
>.PHONY: dirs-y $(DIRS-y)
>
>include $(RTE_SDK)/mk/rte.subdir.mk<br>
>include $(RTE_SDK)/mk/rte.extapp.mk
>
>.PHONY: clean<br>
>clean:<br>
> rm -rf *.o build/*.o build/$(APP)
The Makefile in dir1 looks:
>DPDK_VER=dpdk-stable-17.05.1
>
>RTE_SDK=$(shell pwd | sed -n 's/AB.*//p')/$(DPDK_VER)<BR>
>RTE_TARGET=build
>include $(RTE_SDK)/mk/rte.vars.mk
>
>export RTE_OUTPUT=$(shell pwd)/../build/
>
>CXXFLAGS := $(CFLAGS) -g<BR>
>CXXFLAGS += -std=c++1y -D__STDC_LIMIT_MACROS -D__STDC_FORMAT_MACROS -lgnustl_shared<br>
>CFLAGS += -g -O0 -std=gnu99 -Wall -Wno-unused-value -I../dir2
>
>LIB = dir1.a
>
>SRCS-y := c1.c c2.c c3.c<br>
>OBJS-y := c1.o c2.o c3.o
>
>SRCS-y := $(patsubst %.cpp,%.c,$(SRCS-y))<br>
>OBJS-y := $(patsubst %.o,obj/%.o,$(OBJS-y))
>
>include $(RTE_SDK)/mk/rte.extlib.mk
>
>.PHONY: all<br>
> all
>
>.PHONY: clean<br>
>clean:<br>
> rm -rf *.o *.a ../build/lib/$(LIB)'
The Makefile in dir2 looks:
>DPDK_VER=dpdk-stable-17.05.1
>
>RTE_SDK=$(shell pwd | sed -n 's/AB.*//p')/$(DPDK_VER)<br>
>RTE_TARGET=build
>
>include $(RTE_SDK)/mk/rte.vars.mk
>
>export RTE_OUTPUT=$(shell pwd)/../build/
>
>CXXFLAGS := $(CFLAGS) -g<br>
>CXXFLAGS += -std=c++1y -D__STDC_LIMIT_MACROS -D__STDC_FORMAT_MACROS -lgnustl_shared -I../dir1 -I.<br>
>CFLAGS += -g -O0 -std=gnu99 -Wall -Wno-unused-value<br>
>
>LIB = dir1.a
>
>SRCS-y := cpp1.cpp cpp2.cpp<br>
>OBJS-y := cpp1.o cpp2.o
>
>SRCS-y := $(patsubst %.cpp,%.c,$(SRCS-y))<br>
>OBJS-y := $(patsubst %.o,obj/%.o,$(OBJS-y))
>
>include $(RTE_SDK)/mk/rte.extlib.mk
>
>.PHONY: all<br>
> all
>
>.PHONY: clean<br>
>clean:<br>
> rm -rf *.o *.a ../build/lib/$(LIB)
the make output is:
== Build /dir1
CC c1.o
CC c2.o
CC c3.o
AR dir1.a
INSTALL-LIB dir1.a
== Build /dir2
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
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
AR dir2.a
INSTALL-LIB dir2.a
/path/to/dpdk-stable-17.05.1/mk/internal/rte.install-post.mk:98: warning: overriding recipe for target_postinstall'<br> /path/to/dpdk-stable-17.05.1/mk/internal/rte.install-post.mk:75: warning: ignoring old recipe for target
_postinstall'
/path/to//dpdk-stable-17.05.1/mk/internal/rte.clean-post.mk:61: warning: overriding recipe for target_postclean'<br> /path/to//dpdk-stable-17.05.1/mk/internal/rte.clean-post.mk:38: warning: ignoring old recipe for target
_postclean'
/path/to//dpdk-stable-17.05.1/mk/internal/rte.build-post.mk:38: warning: overriding recipe for target_postbuild'<br> /path/to/dpdk-stable-17.05.1/mk/internal/rte.build-post.mk:38: warning: ignoring old recipe for target
_postbuild'
/path/to/AB/Makefile:40: warning: overriding recipe for targetclean'<br> /path/to/dpdk-stable-17.05.1/mk/rte.app.mk:308: warning: ignoring old recipe for target
clean'
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
LD AB
== Build /path/to/AB/dir1
make[2]: * No rule to make targetc1.o', needed by
dir1.a'. >Stop.
make[1]: * [dir1] Error 2
make: *** [all] Error 2
The dir.a dir2.a and AB image are all created!
BUT:
1) why does the make goes back to Build dir1 at the end and announces that the c1.o is missing for dir1.o?
2) How to get rid of the "warning: ignoring old recipe for target `XXX'"?
Thanks!
Upvotes: 0
Views: 896
Reputation: 8544
The code is not quite reproducible, but I guess the root cause is that there are two includes in the main Makefile, rte.subdir.mk
and rte.extapp.mk
.
Try to put the main.cpp
into an src
directory and use just rte.subdir.mk
in the main Makefile, moving all application build functionality to src/Makefile
...
Upvotes: 0