[dpdk-dev] [PATCH v9 5/7] mk: link infos generated by pmdinfogen

Thomas Monjalon thomas.monjalon at 6wind.com
Mon Jul 4 03:14:03 CEST 2016


Generate informations to export from objects which register a driver.
The C code generated by dpdk-pmdinfogen is compiled and linked into the
original object file.
This effectively just adds the JSON string into the string table of the
object that defines the PMD to the outside world.

Signed-off-by: Neil Horman <nhorman at tuxdriver.com>
Acked-by: Panu Matilainen <pmatilai at redhat.com>
Acked-by: Remy Horton <remy.horton at intel.com>
Signed-off-by: Thomas Monjalon <thomas.monjalon at 6wind.com>
---
 mk/internal/rte.compile-pre.mk | 12 ++++++++++++
 mk/rte.sdkbuild.mk             |  1 +
 2 files changed, 13 insertions(+)

diff --git a/mk/internal/rte.compile-pre.mk b/mk/internal/rte.compile-pre.mk
index b9bff4a..3967390 100644
--- a/mk/internal/rte.compile-pre.mk
+++ b/mk/internal/rte.compile-pre.mk
@@ -84,10 +84,22 @@ C_TO_O = $(CC) -Wp,-MD,$(call obj2dep,$(@)).tmp $(CFLAGS) \
 C_TO_O_STR = $(subst ','\'',$(C_TO_O)) #'# fix syntax highlight
 C_TO_O_DISP = $(if $(V),"$(C_TO_O_STR)","  CC $(@)")
 endif
+PMDINFO_GEN = $(RTE_SDK_BIN)/buildtools/dpdk-pmdinfogen $@ $@.pmd.c
+PMDINFO_CC = $(CC) $(CFLAGS) -c -o $@.pmd.o $@.pmd.c
+PMDINFO_LD = $(CROSS)ld $(LDFLAGS) -r -o $@.o $@.pmd.o $@
+PMDINFO_TO_O = if grep -q 'RTE_REGISTER_DRIVER(.*)' $<; then \
+	echo "$(if $V,$(PMDINFO_GEN),  PMDINFO $@.pmd.c)" && \
+	$(PMDINFO_GEN) && \
+	echo "$(if $V,$(PMDINFO_CC),  CC $@.pmd.o)" && \
+	$(PMDINFO_CC) && \
+	echo "$(if $V,$(PMDINFO_LD),  LD $@)" && \
+	$(PMDINFO_LD) && \
+	mv -f $@.o $@; fi
 C_TO_O_CMD = 'cmd_$@ = $(C_TO_O_STR)'
 C_TO_O_DO = @set -e; \
 	echo $(C_TO_O_DISP); \
 	$(C_TO_O) && \
+	$(PMDINFO_TO_O) && \
 	echo $(C_TO_O_CMD) > $(call obj2cmd,$(@)) && \
 	sed 's,'$@':,dep_'$@' =,' $(call obj2dep,$(@)).tmp > $(call obj2dep,$(@)) && \
 	rm -f $(call obj2dep,$(@)).tmp
diff --git a/mk/rte.sdkbuild.mk b/mk/rte.sdkbuild.mk
index 5edbf50..b6b66bf 100644
--- a/mk/rte.sdkbuild.mk
+++ b/mk/rte.sdkbuild.mk
@@ -49,6 +49,7 @@ $(1): $(sort $(LOCAL_DEPDIRS-$(1)))
 endef
 
 $(foreach d,$(ROOTDIRS-y),$(eval $(call depdirs_rule,$(d))))
+drivers: | buildtools
 
 #
 # build and clean targets
-- 
2.7.0



More information about the dev mailing list