Skip to contentSkip to conversation

mk: support building with renamed makefile

PATCH Applied Marko Kovacevic 5 participants 6 messages Jan 22, 2018 – Feb 5, 2018

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 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")
---
 mk/internal/rte.extvars.mk | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
mk/internal/rte.extvars.mk +1 -1
index 94f27e9..19594da 100644
@@ -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/.
Signature · 1 line
2.9.5
Acked-by on v1 1/1
#1 lore raw
Quoted 32 lines

-----Original Message-----
From: Kovacevic, Marko
Sent: Monday, January 22, 2018 4:29 PM
To: [email protected]
Cc: [email protected]; Varghese, Vipin <[email protected]>; Kovacevic, Marko <[email protected]>; [email protected]
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")
---
 mk/internal/rte.extvars.mk | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
mk/internal/rte.extvars.mk index renamed from mk/internal/rte.extvars.mk +0 -0

94f27e9..19594da 100644

mk/internal/rte.extvars.mk +0 -0
@@ -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

Quoted 3 lines

# 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'.

#2 lore raw
Quoted 5 lines
Quoted 5 lines

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.

Quoted 8 lines
Quoted 4 lines
Fixes af75078fece3 ("first public release")

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

Applied, thanks

#3 lore raw
In reply to Marko Kovacevic
Quoted 31 lines · Marko Kovacevic

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")
---
 mk/internal/rte.extvars.mk | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
mk/internal/rte.extvars.mk +1 -1
index 94f27e9..19594da 100644
@@ -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/.
Signature · 1 line
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

#4 lore raw

PATCH v2 1/1 mk: support renamed Makefile in external project

In reply to Marko Kovacevic

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")

---
V2
- Changed the call of the make file a litte
due to an issue reported by Olivier.

---
 mk/internal/rte.extvars.mk | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
mk/internal/rte.extvars.mk +1 -1
index 94f27e9..98c8606 100644
@@ -20,7 +20,7 @@ ifeq ("$(origin M)", "command line")
 RTE_EXTMK := $(abspath $(M))
 endif
 endif
-RTE_EXTMK ?= $(RTE_SRCDIR)/Makefile
+RTE_EXTMK ?= $(RTE_SRCDIR)/$(notdir $(firstword $(MAKEFILE_LIST)))
 export RTE_EXTMK
 
 # RTE_SDK_BIN must point to .config, include/ and lib/.
Signature · 1 line
2.9.5
#5 lore raw

Re: [PATCH v2] mk: support renamed Makefile in external project

Quoted 27 lines · Marko Kovacevic

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")

---
V2
- Changed the call of the make file a litte
due to an issue reported by Olivier.

---
 mk/internal/rte.extvars.mk | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
mk/internal/rte.extvars.mk +0 -0
index 94f27e9..98c8606 100644

mk/internal/rte.extvars.mk ifeq ("$(origin M)", "command line") · line 26

Quoted 8 lines
mk/internal/rte.extvars.mk +1 -1
@@ -20,7 +20,7 @@ ifeq ("$(origin M)", "command line")
 RTE_EXTMK := $(abspath $(M))
 endif
 endif
-RTE_EXTMK ?= $(RTE_SRCDIR)/Makefile
+RTE_EXTMK ?= $(RTE_SRCDIR)/$(notdir $(firstword $(MAKEFILE_LIST)))
 export RTE_EXTMK
 
 # RTE_SDK_BIN must point to .config, include/ and lib/.

Since the V1 of the patch was already applied, I think this needs a new patch on top of (i.e. fixing) the V1, rather than a V2 version.

/Bruce