Skip to contentSkip to conversation

Makefile: unconfigured "make toolchain" should run report error

PATCH New Arnout Vandecappelle (Essensium/Mind) 3 participants 4 messages Jun 30, 2017 – Jul 1, 2017 Kbuild

lore
Share & tools
lore
#0 lore raw

PATCH v2 1/1 Makefile: unconfigured "make toolchain" should run report error

As reported by Alessandro Power on StackOverflow [1], the behaviour of "make toolchain" in an unconfigured tree is misleading.

When .config doesn't exist, we don't read in the package .mk files, so "make <package>" doesn't work:

    $ make busybox
    make: *** No rule to make target 'busybox'.  Stop.

However, for "linux" and "toolchain", the corresponding file (or actually directory) already exists. So instead, we get:

    $ make linux
    make: Nothing to be done for 'linux'.

This is confusing, because it looks as if the build succeeded.

The obvious solution is to make linux and toolchain PHONY targets when .config doesn't exist. However, that actually does the reverse, because then a rule _does_ exist for them and since they don't have dependencies, make will consider them to be ready.

Therefore, we also have to provide an explicit rule for them, and explicitly error out. Thise behaviour is still different from other packages, but at least it is much less confusing.

[1] https://stackoverflow.com/questions/44521150

---
v2: Simpler way of erroring out, don't try to make all packages
behave the same (Luca)

---
 Makefile | 8 ++++++++
 1 file changed, 8 insertions(+)
Makefile +8 -0
index 88d98e0405..470aa837ce 100644
@@ -813,6 +813,14 @@ else # ifeq ($(BR2_HAVE_DOT_CONFIG),y)
 
 all: menuconfig
 
+# Some subdirectories are also package names. To avoid that "make linux"
+# on an unconfigured tree produces "Nothing to be done", add an explicit
+# rule for it.
+.PHONY: linux toolchain
+linux toolchain:
+	$(error Please configure Buildroot first (e.g. "make menuconfig"))
+	@exit 1
+
 endif # ifeq ($(BR2_HAVE_DOT_CONFIG),y)
 
 # configuration
Signature · 1 line
2.13.1
#1 lore raw

PATCH v2 1/1 Makefile: unconfigured "make toolchain" should run report error

Hi Arnout,

I might be wrong, but the patch title sounds wrong to me:

Quoted 1 line

Makefile: unconfigured "make toolchain" should run report error

Shouldn't it be:

Makefile: unconfigured "make toolchain" should report an error

?

Quoted 17 lines · Arnout Vandecappelle (Essensium/Mind)

As reported by Alessandro Power on StackOverflow [1], the behaviour of "make toolchain" in an unconfigured tree is misleading.

When .config doesn't exist, we don't read in the package .mk files, so "make <package>" doesn't work:

    $ make busybox
    make: *** No rule to make target 'busybox'.  Stop.

However, for "linux" and "toolchain", the corresponding file (or actually directory) already exists. So instead, we get:

    $ make linux
    make: Nothing to be done for 'linux'.

This is confusing, because it looks as if the build succeeded.

Quoted 7 lines

The obvious solution is to make linux and toolchain PHONY targets when .config doesn't exist. However, that actually does the reverse, because then a rule _does_ exist for them and since they don't have dependencies, make will consider them to be ready.

Therefore, we also have to provide an explicit rule for them, and explicitly error out. Thise behaviour is still different from other

s/Thise/This/

With the above fixed:
Tested by: Luca Ceresoli <[email protected]>
Acked by: Luca Ceresoli <[email protected]>

Signature · 1 line
Luca
#3 lore raw

PATCH v2 1/1 Makefile: unconfigured "make toolchain" should run report error

In reply to Arnout Vandecappelle (Essensium/Mind)

Hello,

Quoted 28 lines · Arnout Vandecappelle (Essensium/Mind)

As reported by Alessandro Power on StackOverflow [1], the behaviour of "make toolchain" in an unconfigured tree is misleading.

When .config doesn't exist, we don't read in the package .mk files, so "make <package>" doesn't work:

    $ make busybox
    make: *** No rule to make target 'busybox'.  Stop.

However, for "linux" and "toolchain", the corresponding file (or actually directory) already exists. So instead, we get:

    $ make linux
    make: Nothing to be done for 'linux'.

This is confusing, because it looks as if the build succeeded.

The obvious solution is to make linux and toolchain PHONY targets when .config doesn't exist. However, that actually does the reverse, because then a rule _does_ exist for them and since they don't have dependencies, make will consider them to be ready.

Therefore, we also have to provide an explicit rule for them, and explicitly error out. Thise behaviour is still different from other packages, but at least it is much less confusing.

[1] https://stackoverflow.com/questions/44521150

Quoted 8 lines

---
v2: Simpler way of erroring out, don't try to make all packages
behave the same (Luca)

---
 Makefile | 8 ++++++++
 1 file changed, 8 insertions(+)

Applied to master, thanks. And yes, I forgot to fix the commit title when applying. Sorry :-/

Thomas

Signature · 3 lines
Thomas Petazzoni, CTO, Free Electrons
Embedded Linux, Kernel and Android engineering
http://free-electrons.com