[dpdk-dev,v9,5/7] mk: link infos generated by pmdinfogen
Commit Message
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@tuxdriver.com>
Acked-by: Panu Matilainen <pmatilai@redhat.com>
Acked-by: Remy Horton <remy.horton@intel.com>
Signed-off-by: Thomas Monjalon <thomas.monjalon@6wind.com>
---
mk/internal/rte.compile-pre.mk | 12 ++++++++++++
mk/rte.sdkbuild.mk | 1 +
2 files changed, 13 insertions(+)
@@ -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
@@ -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