[dpdk-dev,v1] mk: support building with renamed makefile

Message ID 20180122105905.6996-1-marko.kovacevic@intel.com (mailing list archive)
State Accepted, archived
Headers

Checks

Context Check Description
ci/checkpatch success coding style OK
ci/Intel-compilation fail Compilation issues

Commit Message

Kovacevic, Marko Jan. 22, 2018, 10:59 a.m. UTC
  The build system made a recursive call to "make" after
creating the build directory. This recursive call used
the hard-coded filename "Makefile", which prevented
builds from working if the file was renamed and make
called using "make -f". Taking the filename from
MAKEFILES_LIST make variable fixes this.

Fixes: af75078fece3 ("first public release")
Cc: stable@dpdk.org

Signed-off-by: Marko Kovacevic <marko.kovacevic@intel.com>
---
 mk/internal/rte.extvars.mk | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
  

Comments

Varghese, Vipin Jan. 29, 2018, 4:14 p.m. UTC | #1
> -----Original Message-----
> From: Kovacevic, Marko
> Sent: Monday, January 22, 2018 4:29 PM
> To: dev@dpdk.org
> Cc: thomas@monjalon.net; Varghese, Vipin <vipin.varghese@intel.com>;
> Kovacevic, Marko <marko.kovacevic@intel.com>; stable@dpdk.org
> Subject: [PATCH v1] mk: support building with renamed makefile
> 
> The build system made a recursive call to "make" after creating the build
> directory. This recursive call used the hard-coded filename "Makefile", which
> prevented builds from working if the file was renamed and make called using
> "make -f". Taking the filename from MAKEFILES_LIST make variable fixes this.
> 
> Fixes: af75078fece3 ("first public release")
> Cc: stable@dpdk.org
> 
> Signed-off-by: Marko Kovacevic <marko.kovacevic@intel.com>
> ---
>  mk/internal/rte.extvars.mk | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/mk/internal/rte.extvars.mk b/mk/internal/rte.extvars.mk index
> 94f27e9..19594da 100644
> --- a/mk/internal/rte.extvars.mk
> +++ b/mk/internal/rte.extvars.mk
> @@ -20,7 +20,7 @@ ifeq ("$(origin M)", "command line")  RTE_EXTMK :=
> $(abspath $(M))  endif  endif -RTE_EXTMK ?= $(RTE_SRCDIR)/Makefile
> +RTE_EXTMK ?= $(RTE_SRCDIR)/$(firstword $(MAKEFILE_LIST))
>  export RTE_EXTMK
> 
>  # RTE_SDK_BIN must point to .config, include/ and lib/.
> --
> 2.9.5

I have validated on Linux environment with custom make file name as 'Makefile.test'.

Acked-by: Vipin Varghese <vipin.varghese@intel.com>
  
Thomas Monjalon Jan. 30, 2018, 11:43 p.m. UTC | #2
> > The build system made a recursive call to "make" after creating the build
> > directory. This recursive call used the hard-coded filename "Makefile", which
> > prevented builds from working if the file was renamed and make called using
> > "make -f". Taking the filename from MAKEFILES_LIST make variable fixes this.
> > 
> > Fixes: af75078fece3 ("first public release")
> > Cc: stable@dpdk.org
> > 
> > Signed-off-by: Marko Kovacevic <marko.kovacevic@intel.com>
> 
> I have validated on Linux environment with custom make file name as 'Makefile.test'.
> 
> Acked-by: Vipin Varghese <vipin.varghese@intel.com>

Applied, thanks
  
Olivier Matz Feb. 5, 2018, 9:29 a.m. UTC | #3
On Mon, Jan 22, 2018 at 10:59:05AM +0000, Marko Kovacevic wrote:
> The build system made a recursive call to "make" after
> creating the build directory. This recursive call used
> the hard-coded filename "Makefile", which prevented
> builds from working if the file was renamed and make
> called using "make -f". Taking the filename from
> MAKEFILES_LIST make variable fixes this.
> 
> Fixes: af75078fece3 ("first public release")
> Cc: stable@dpdk.org
> 
> Signed-off-by: Marko Kovacevic <marko.kovacevic@intel.com>
> ---
>  mk/internal/rte.extvars.mk | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/mk/internal/rte.extvars.mk b/mk/internal/rte.extvars.mk
> index 94f27e9..19594da 100644
> --- a/mk/internal/rte.extvars.mk
> +++ b/mk/internal/rte.extvars.mk
> @@ -20,7 +20,7 @@ ifeq ("$(origin M)", "command line")
>  RTE_EXTMK := $(abspath $(M))
>  endif
>  endif
> -RTE_EXTMK ?= $(RTE_SRCDIR)/Makefile
> +RTE_EXTMK ?= $(RTE_SRCDIR)/$(firstword $(MAKEFILE_LIST))
>  export RTE_EXTMK
>  
>  # RTE_SDK_BIN must point to .config, include/ and lib/.
> -- 
> 2.9.5
> 


Hi,

This commit breaks the build of one of our external module:

 make[5]: /path/to/ext-module//path/to/ext-module/Makefile: No such file or directory                                                                                                                      
 make[5]: *** No rule to make target '/path/to/ext-module//path/to/ext-module/Makefile'.  Stop.                                                                                                            

The reason is that entries in $(MAKEFILE_LIST) can be absolute
paths. See:

 $ cat test.mk
 $(info $(MAKEFILE_LIST))
 all:
 $ make -f test.mk
  test.mk
 $ make -f $PWD/test.mk
  /home/user/test.mk

Maybe something like this could be better (I didn't try):

 RTE_EXTMK ?= $(RTE_SRCDIR)/$(notdir $(firstword $(MAKEFILE_LIST)))


Thanks
Olivier
  

Patch

diff --git a/mk/internal/rte.extvars.mk b/mk/internal/rte.extvars.mk
index 94f27e9..19594da 100644
--- a/mk/internal/rte.extvars.mk
+++ b/mk/internal/rte.extvars.mk
@@ -20,7 +20,7 @@  ifeq ("$(origin M)", "command line")
 RTE_EXTMK := $(abspath $(M))
 endif
 endif
-RTE_EXTMK ?= $(RTE_SRCDIR)/Makefile
+RTE_EXTMK ?= $(RTE_SRCDIR)/$(firstword $(MAKEFILE_LIST))
 export RTE_EXTMK
 
 # RTE_SDK_BIN must point to .config, include/ and lib/.