[dpdk-dev] [PATCHv4 4/5] Makefile: Do post processing on objects that register a driver

Thomas Monjalon thomas.monjalon at 6wind.com
Wed May 25 19:08:19 CEST 2016


2016-05-24 15:41, Neil Horman:
> --- a/mk/internal/rte.compile-pre.mk
> +++ b/mk/internal/rte.compile-pre.mk
> @@ -80,7 +80,8 @@ C_TO_O_STR = $(subst ','\'',$(C_TO_O)) #'# fix syntax highlight
>  C_TO_O_DISP = $(if $(V),"$(C_TO_O_STR)","  HOSTCC $(@)")
>  else
>  C_TO_O = $(CC) -Wp,-MD,$(call obj2dep,$(@)).tmp $(CFLAGS) \
> -	$(CFLAGS_$(@)) $(EXTRA_CFLAGS) -o $@ -c $<
> +	 $(CFLAGS_$(@)) $(EXTRA_CFLAGS) -o $@ -c $<
> +

whitespace change?

>  C_TO_O_STR = $(subst ','\'',$(C_TO_O)) #'# fix syntax highlight
>  C_TO_O_DISP = $(if $(V),"$(C_TO_O_STR)","  CC $(@)")
>  endif
> @@ -88,10 +89,26 @@ 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 \

It is preferred to keep "then" at the end of the previous line.

> +		echo MODGEN $@; \
> +		OBJF=`readlink -f $@`; \
> +		${RTE_OUTPUT}/buildtools/pmdinfogen \$$OBJF \$$OBJF.mod.c; \

Maybe .pmd.c would be more appropriate than .mod.c?
What means mod/MODGEN/MODBUILD?

> +		if [ \$$? -eq 0 ]; \
> +		then \
> +			echo MODBUILD $@; \
> +			$(CC) -c -o \$$OBJF.mod.o \$$OBJF.mod.c; \
> +			$(CROSS)ld -r -o \$$OBJF.o \$$OBJF.mod.o \$$OBJF; \
> +			mv -f \$$OBJF.o \$$OBJF; \
> +		fi; \
> +	fi; \
> +	true" && \

Why "true"?

It deserves to be in a shell script, at least to ease testing.



More information about the dev mailing list