diff mbox series

[1/4] configure: Use discovered make for in-source build

Message ID 20200822212129.97758-2-r.bolshakov@yadro.com (mailing list archive)
State New, archived
Headers show
Series Compatibility make fixes for meson | expand

Commit Message

Roman Bolshakov Aug. 22, 2020, 9:21 p.m. UTC
A recursive make is inovked if in-source build is used but $(MAKE) is
the same as the one used in the original make invocaton.

Some platforms have preference to use gmake, or a make passed as an
option to "configure". Honor the choice.

Signed-off-by: Roman Bolshakov <r.bolshakov@yadro.com>
---
 configure | 2 ++
 1 file changed, 2 insertions(+)

Comments

Daniel P. Berrangé Aug. 24, 2020, 2:31 p.m. UTC | #1
On Sun, Aug 23, 2020 at 12:21:26AM +0300, Roman Bolshakov wrote:
> A recursive make is inovked if in-source build is used but $(MAKE) is
> the same as the one used in the original make invocaton.
> 
> Some platforms have preference to use gmake, or a make passed as an
> option to "configure". Honor the choice.
> 
> Signed-off-by: Roman Bolshakov <r.bolshakov@yadro.com>
> ---
>  configure | 2 ++
>  1 file changed, 2 insertions(+)

Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>


Regards,
Daniel
Eric Blake Aug. 24, 2020, 2:37 p.m. UTC | #2
On 8/22/20 4:21 PM, Roman Bolshakov wrote:
> A recursive make is inovked if in-source build is used but $(MAKE) is
> the same as the one used in the original make invocaton.
> 
> Some platforms have preference to use gmake, or a make passed as an
> option to "configure". Honor the choice.
> 
> Signed-off-by: Roman Bolshakov <r.bolshakov@yadro.com>
> ---
>   configure | 2 ++
>   1 file changed, 2 insertions(+)
> 
> diff --git a/configure b/configure
> index 4e5fe33211..9e0d505067 100755
> --- a/configure
> +++ b/configure
> @@ -38,6 +38,8 @@ then
>   # This file is auto-generated by configure to support in-source tree
>   # 'make' command invocation
>   
> +include build/config-host.mak

Should this use '-include' (also spelled 'sinclude'), to avoid halting 
the build if build/config-host.mak doesn't exist for whatever reason?

> +
>   ifeq ($(MAKECMDGOALS),)
>   recurse: all
>   endif
>
Eric Blake Aug. 24, 2020, 2:43 p.m. UTC | #3
On 8/22/20 4:21 PM, Roman Bolshakov wrote:
> A recursive make is inovked if in-source build is used but $(MAKE) is

invoked

> the same as the one used in the original make invocaton.

invocation

> 
> Some platforms have preference to use gmake, or a make passed as an
> option to "configure". Honor the choice.
> 
> Signed-off-by: Roman Bolshakov <r.bolshakov@yadro.com>
> ---
>   configure | 2 ++
>   1 file changed, 2 insertions(+)
>
Roman Bolshakov Aug. 24, 2020, 10:07 p.m. UTC | #4
On Mon, Aug 24, 2020 at 09:37:07AM -0500, Eric Blake wrote:
> On 8/22/20 4:21 PM, Roman Bolshakov wrote:
> > @@ -38,6 +38,8 @@ then
> >   # This file is auto-generated by configure to support in-source tree
> >   # 'make' command invocation
> > +include build/config-host.mak
> 
> Should this use '-include' (also spelled 'sinclude'), to avoid halting the
> build if build/config-host.mak doesn't exist for whatever reason?
> 

Sure I can do (and thanks for the noticed typos) but I tested that if
the build is interrupted too early (before Makefile is symlinked to
build directory but after GNUmakefile is created) it would fail even if
-include is used:

$ make
changing dir to build for /Library/Developer/CommandLineTools/usr/bin/make ""...
make[1]: Makefile: No such file or directory
make[1]: *** No rule to make target `Makefile'.  Stop.
changing dir to build for /Library/Developer/CommandLineTools/usr/bin/make ""...
make[1]: Makefile: No such file or directory
make[1]: *** No rule to make target `Makefile'.  Stop.
make: *** [all] Error 2

I'm also curious why the switch happens twice... According to the debug
trace, it tries to remake build/config-host.mak using the implicit force
rule:

GNUmakefile:12: update target 'build/config-host.mak' due to: force

Then there should be an explicit empty rule for build/config-host.mak. I
will send a fix for that in v2. Then it would fail like this:

$ make
changing dir to build for /Library/Developer/CommandLineTools/usr/bin/make ""...
make[1]: Makefile: No such file or directory
make[1]: *** No rule to make target `Makefile'.  Stop.
make: *** [all] Error 2

Regards,
Roman

> > +
> >   ifeq ($(MAKECMDGOALS),)
> >   recurse: all
> >   endif
> > 
>
Roman Bolshakov Aug. 25, 2020, 10:16 a.m. UTC | #5
On Tue, Aug 25, 2020 at 01:07:55AM +0300, Roman Bolshakov wrote:
> On Mon, Aug 24, 2020 at 09:37:07AM -0500, Eric Blake wrote:
> > On 8/22/20 4:21 PM, Roman Bolshakov wrote:
> > > @@ -38,6 +38,8 @@ then
> > >   # This file is auto-generated by configure to support in-source tree
> > >   # 'make' command invocation
> > > +include build/config-host.mak
> > 
> > Should this use '-include' (also spelled 'sinclude'), to avoid halting the
> > build if build/config-host.mak doesn't exist for whatever reason?
> > 
> 
> Sure I can do (and thanks for the noticed typos) but I tested that if
> the build is interrupted too early (before Makefile is symlinked to
> build directory but after GNUmakefile is created) it would fail even if
> -include is used:
> 
> $ make
> changing dir to build for /Library/Developer/CommandLineTools/usr/bin/make ""...
> make[1]: Makefile: No such file or directory
> make[1]: *** No rule to make target `Makefile'.  Stop.
> changing dir to build for /Library/Developer/CommandLineTools/usr/bin/make ""...
> make[1]: Makefile: No such file or directory
> make[1]: *** No rule to make target `Makefile'.  Stop.
> make: *** [all] Error 2
> 
> I'm also curious why the switch happens twice... According to the debug
> trace, it tries to remake build/config-host.mak using the implicit force
> rule:
> 
> GNUmakefile:12: update target 'build/config-host.mak' due to: force
> 
> Then there should be an explicit empty rule for build/config-host.mak. I
> will send a fix for that in v2. Then it would fail like this:
> 
> $ make
> changing dir to build for /Library/Developer/CommandLineTools/usr/bin/make ""...
> make[1]: Makefile: No such file or directory
> make[1]: *** No rule to make target `Makefile'.  Stop.
> make: *** [all] Error 2
> 
> > > +
> > >   ifeq ($(MAKECMDGOALS),)
> > >   recurse: all
> > >   endif
> > > 
> > 

Hi Eric,

What if we just print an error if build/config-host.mak can't be found?

ifeq ($(wildcard build/config-host.mak),)
$(error "Incomplete configuration. Please run ./configure")
endif

IMO this is more sane approach than proceeding with partially-configured
not working build without a Makefile in proper place.

Regards,
Roman
Eric Blake Aug. 25, 2020, 2:06 p.m. UTC | #6
On 8/25/20 5:16 AM, Roman Bolshakov wrote:

> 
> Hi Eric,
> 
> What if we just print an error if build/config-host.mak can't be found?
> 
> ifeq ($(wildcard build/config-host.mak),)
> $(error "Incomplete configuration. Please run ./configure")
> endif
> 
> IMO this is more sane approach than proceeding with partially-configured
> not working build without a Makefile in proper place.

Yes, that is definitely a better approach.
diff mbox series

Patch

diff --git a/configure b/configure
index 4e5fe33211..9e0d505067 100755
--- a/configure
+++ b/configure
@@ -38,6 +38,8 @@  then
 # This file is auto-generated by configure to support in-source tree
 # 'make' command invocation
 
+include build/config-host.mak
+
 ifeq ($(MAKECMDGOALS),)
 recurse: all
 endif