mk: fix verbose pmdinfogen run

When building with "make V=1" it is expected to see the output of each
compiler command in order to debug them.
Unfortunately the pmdinfogen related commands were always quiet.

It is fixed by defining the commands in some Makefile variables.
They are printed if the verbose mode is enabled.

The other benefit of this rework is to stop compilation after a
failure with pmdinfogen.

The command readlink is removed in this rework because it seems useless.

Fixes: 3d781ca328 ("mk: do post processing on objects that register a driver")

Signed-off-by: Thomas Monjalon <thomas.monjalon@6wind.com>
Acked-by: Neil Horman <nhorman@tuxdriver.com>
This commit is contained in:
Thomas Monjalon 2016-07-07 14:06:38 +02:00
parent f9e02f03c6
commit 387a02d411

View File

@ -84,28 +84,26 @@ 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)/app/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 'PMD_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) && \
sh -c "grep -q \"PMD_REGISTER_DRIVER(.*)\" $<; \
if [ \$$? -eq 0 ]; then \
echo \" PMDINFOGEN\" $@; \
OBJF=`readlink -f $@`; \
$(RTE_SDK_BIN)/app/pmdinfogen \$$OBJF \$$OBJF.pmd.c; \
if [ \$$? -eq 0 ]; \
then \
echo \" PMDINFOBUILD\" $@; \
$(CC) $(CFLAGS) -c -o \$$OBJF.pmd.o \$$OBJF.pmd.c; \
$(CROSS)ld $(LDFLAGS) -r -o \$$OBJF.o \$$OBJF.pmd.o \$$OBJF; \
mv -f \$$OBJF.o \$$OBJF; \
fi; \
fi;" && \
$(PMDINFO_TO_O) && \
echo $(C_TO_O_CMD) > $(call obj2cmd,$(@)) && \
sed 's,'$@':,dep_'$@' =,' $(call obj2dep,$(@)).tmp > $(call obj2dep,$(@)) && \
rm -f $(call obj2dep,$(@)).tmp
# return an empty string if string are equal
compare = $(strip $(subst $(1),,$(2)) $(subst $(2),,$(1)))