Skip to contentSkip to conversation

package/linux-tools: change method for including linux-tool sub-makefiles

PATCH New Markus Mayer 3 participants 5 messages Jul 18, 2017 – Jul 19, 2017

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 package/linux-tools: change method for including linux-tool sub-makefiles

Make inclusion ordering of all linux-tool-*.mk sub-makefiles explicit instead of relying on alphabetical sort order. This is done by renaming the Linux tools sub-makefiles to the format linux-tool-*.mk.in. This causes the top-level Makefile to ignore the Linux tools sub-makefiles.

Until now, the main Makefile included all linux-tool-*.mk files, as well as linux-tools.mk, and it relied on alphabetical sorting to include them in the proper order (linux-tool-*.mk before linux-tools.mk).

---

This patch is the result of the discussion that can be found at
http://lists.busybox.net/pipermail/buildroot/2017-July/thread.html#196876

 docs/manual/adding-packages-linux-kernel-spec-infra.txt  |  4 ++--
 ...{linux-tool-cpupower.mk => linux-tool-cpupower.mk.in} |  0
 .../{linux-tool-gpio.mk => linux-tool-gpio.mk.in}        |  0
 .../{linux-tool-iio.mk => linux-tool-iio.mk.in}          |  0
 .../{linux-tool-perf.mk => linux-tool-perf.mk.in}        |  0
 ...inux-tool-selftests.mk => linux-tool-selftests.mk.in} |  0
 package/linux-tools/linux-tools.mk                       | 16 +++++++---------
 7 files changed, 9 insertions(+), 11 deletions(-)
 rename package/linux-tools/{linux-tool-cpupower.mk => linux-tool-cpupower.mk.in} (100%)
 rename package/linux-tools/{linux-tool-gpio.mk => linux-tool-gpio.mk.in} (100%)
 rename package/linux-tools/{linux-tool-iio.mk => linux-tool-iio.mk.in} (100%)
 rename package/linux-tools/{linux-tool-perf.mk => linux-tool-perf.mk.in} (100%)
 rename package/linux-tools/{linux-tool-selftests.mk => linux-tool-selftests.mk.in} (100%)
docs/manual/adding-packages-linux-kernel-spec-infra.txt +2 -2
index 6deb6d4..b948e20 100644
@@ -40,8 +40,8 @@ Unlike other packages, the +linux-tools+ package options appear in the
 +linux+ kernel menu, under the `Linux Kernel Tools` sub-menu, not under
 the `Target packages` main menu.
 
-Then for each linux tool, add a new +.mk+ file named
-+package/linux-tools/linux-tool-foo.mk+. It would basically look like:
+Then for each linux tool, add a new +.mk.in+ file named
++package/linux-tools/linux-tool-foo.mk.in+. It would basically look like:
 
 ------------------------------
 01: ################################################################################
package/linux-tools/linux-tool-cpupower.mk.in renamed from package/linux-tools/linux-tool-cpupower.mk +0 -0
similarity index 100%
rename from package/linux-tools/linux-tool-cpupower.mk
rename to package/linux-tools/linux-tool-cpupower.mk.in
package/linux-tools/linux-tool-gpio.mk.in renamed from package/linux-tools/linux-tool-gpio.mk +0 -0
similarity index 100%
rename from package/linux-tools/linux-tool-gpio.mk
rename to package/linux-tools/linux-tool-gpio.mk.in
package/linux-tools/linux-tool-iio.mk.in renamed from package/linux-tools/linux-tool-iio.mk +0 -0
similarity index 100%
rename from package/linux-tools/linux-tool-iio.mk
rename to package/linux-tools/linux-tool-iio.mk.in
package/linux-tools/linux-tool-perf.mk.in renamed from package/linux-tools/linux-tool-perf.mk +0 -0
similarity index 100%
rename from package/linux-tools/linux-tool-perf.mk
rename to package/linux-tools/linux-tool-perf.mk.in
package/linux-tools/linux-tool-selftests.mk.in renamed from package/linux-tools/linux-tool-selftests.mk +0 -0
similarity index 100%
rename from package/linux-tools/linux-tool-selftests.mk
rename to package/linux-tools/linux-tool-selftests.mk.in
package/linux-tools/linux-tools.mk +7 -9
index 7fa8d19..2827ade 100644
@@ -10,15 +10,13 @@
 #
 # So, all tools refer to $(LINUX_DIR) instead of $(@D).
 
-# Note: we need individual tools .mk files to be included *before* this one
-# to guarantee that each tool has a chance to register itself before we build
-# the list of build and install hooks, below.
-#
-# This is currently guaranteed by the naming of each file:
-# - they get included by the top-level Makefile, with $(sort $(wildcard ...))
-# - make's $(sort) function will aways sort in the C locale
-# - the files names correctly sort out in the C locale so that each tool's
-#   .mk file is included before this one.
+# Note: we need individual tools makefiles to be included *before* we build
+# the list of build and install hooks below to guarantee that each tool has
+# a chance to register itself. Therefore, the makefiles are named
+# linux-tool-*.mk.in, so they won't be picked up by the top-level Makefile,
+# but can be included here, guaranteeing proper ordering.
+
+include $(sort $(wildcard package/linux-tools/*.mk.in))
 
 # We only need the kernel to be extracted, not actually built
 LINUX_TOOLS_PATCH_DEPENDENCIES = linux
Signature · 1 line
2.7.4
#1 lore raw

PATCH 1/1 package/linux-tools: change method for including linux-tool sub-makefiles

Markus, All,

On 2017-07-18 11:11 -0700, Markus Mayer spake thusly:

Quoted 6 lines

Make inclusion ordering of all linux-tool-*.mk sub-makefiles explicit instead of relying on alphabetical sort order. This is done by renaming the Linux tools sub-makefiles to the format linux-tool-*.mk.in. This causes the top-level Makefile to ignore the Linux tools sub-makefiles.

Quoted 6 lines

Until now, the main Makefile included all linux-tool-*.mk files, as well as linux-tools.mk, and it relied on alphabetical sorting to include them in the proper order (linux-tool-*.mk before linux-tools.mk).

Thank you for this new iteration.

I have a small comment, see below...

[--SNIP--]

Quoted 12 lines
package/linux-tools/linux-tools.mk +0 -4
index 7fa8d19..2827ade 100644
@@ -10,15 +10,13 @@
 #
 # So, all tools refer to $(LINUX_DIR) instead of $(@D).
 
-# Note: we need individual tools .mk files to be included *before* this one
-# to guarantee that each tool has a chance to register itself before we build
-# the list of build and install hooks, below.
-#

package/linux-tools/linux-tools.mk line 17

Quoted 10 lines
package/linux-tools/linux-tools.mk +5 -5
-# This is currently guaranteed by the naming of each file:
-# - they get included by the top-level Makefile, with $(sort $(wildcard ...))
-# - make's $(sort) function will aways sort in the C locale
-# - the files names correctly sort out in the C locale so that each tool's
-#   .mk file is included before this one.
+# Note: we need individual tools makefiles to be included *before* we build
+# the list of build and install hooks below to guarantee that each tool has
+# a chance to register itself. Therefore, the makefiles are named
+# linux-tool-*.mk.in, so they won't be picked up by the top-level Makefile,
+# but can be included here, guaranteeing proper ordering.

There are two important and crucial points:

- guaranteeing inclusion ordering,
- guaranteeing single inclusion.

If only the first were needed, then we could simply include the tools here without renaming; they'd be included twice, but that is not a problem for the first point.

But the second point is also important, because we do not want tools to register themselves twice, nor do we want they break their variables by appending stuff already added.

So, I would keep your comment as is, except I'd add a bit on the third and last lines:

# Note: we need individual tools makefiles to be included *before* we build

# the list of build and install hooks below to guarantee that each tool has
# a chance to register itself once, and only once. Therefore, the makefiles
# are named linux-tool-*.mk.in, so they won't be picked up by the top-level
# Makefile, but can be included here, guaranteeing the single inclusion and
# the proper ordering.

(Bonus point: ithe comment all lines up perfectly well, now! ;-] )

No need to respin, I gues, a maintainer can tweak the message when applying.

Thanks! :-)

Regards,
Yann E. MORIN.

Quoted 11 lines
package/linux-tools/linux-tools.mk +1 -0
+include $(sort $(wildcard package/linux-tools/*.mk.in))
 
 # We only need the kernel to be extracted, not actually built
 LINUX_TOOLS_PATCH_DEPENDENCIES = linux
Signature · 6 lines
2.7.4

_______________________________________________
buildroot mailing list
buildroot at busybox.net
http://lists.busybox.net/mailman/listinfo/buildroot
Signature · 6 lines
.-----------------.--------------------.------------------.--------------------.
|  Yann E. MORIN  | Real-Time Embedded | /"\ ASCII RIBBON | Erics' conspiracy: |
| +33 662 376 056 | Software  Designer | \ / CAMPAIGN     |  ___               |
| +33 223 225 172 `------------.-------:  X  AGAINST      |  \e/  There is no  |
| http://ymorin.is-a-geek.org/ | _/*\_ | / \ HTML MAIL    |   v   conspiracy.  |
'------------------------------^-------^------------------^--------------------'
#2 lore raw

PATCH 1/1 package/linux-tools: change method for including linux-tool sub-makefiles

Quoted 60 lines · Yann E. MORIN

Markus, All,

On 2017-07-18 11:11 -0700, Markus Mayer spake thusly:

Quoted 6 lines

Make inclusion ordering of all linux-tool-*.mk sub-makefiles explicit instead of relying on alphabetical sort order. This is done by renaming the Linux tools sub-makefiles to the format linux-tool-*.mk.in. This causes the top-level Makefile to ignore the Linux tools sub-makefiles.

Quoted 6 lines

Until now, the main Makefile included all linux-tool-*.mk files, as well as linux-tools.mk, and it relied on alphabetical sorting to include them in the proper order (linux-tool-*.mk before linux-tools.mk).

Thank you for this new iteration.

I have a small comment, see below...

[--SNIP--]

Quoted 12 lines
package/linux-tools/linux-tools.mk +0 -4
index 7fa8d19..2827ade 100644
@@ -10,15 +10,13 @@
 #
 # So, all tools refer to $(LINUX_DIR) instead of $(@D).
 
-# Note: we need individual tools .mk files to be included *before* this one
-# to guarantee that each tool has a chance to register itself before we build
-# the list of build and install hooks, below.
-#

package/linux-tools/linux-tools.mk line 17

Quoted 10 lines
package/linux-tools/linux-tools.mk +5 -5
-# This is currently guaranteed by the naming of each file:
-# - they get included by the top-level Makefile, with $(sort $(wildcard ...))
-# - make's $(sort) function will aways sort in the C locale
-# - the files names correctly sort out in the C locale so that each tool's
-#   .mk file is included before this one.
+# Note: we need individual tools makefiles to be included *before* we build
+# the list of build and install hooks below to guarantee that each tool has
+# a chance to register itself. Therefore, the makefiles are named
+# linux-tool-*.mk.in, so they won't be picked up by the top-level Makefile,
+# but can be included here, guaranteeing proper ordering.

There are two important and crucial points:

- guaranteeing inclusion ordering,
- guaranteeing single inclusion.

If only the first were needed, then we could simply include the tools here without renaming; they'd be included twice, but that is not a problem for the first point.

But the second point is also important, because we do not want tools to register themselves twice, nor do we want they break their variables by appending stuff already added.

So, I would keep your comment as is, except I'd add a bit on the third and last lines:

Quoted 6 lines

# Note: we need individual tools makefiles to be included *before* we build

# the list of build and install hooks below to guarantee that each tool has
# a chance to register itself once, and only once. Therefore, the makefiles
# are named linux-tool-*.mk.in, so they won't be picked up by the top-level
# Makefile, but can be included here, guaranteeing the single inclusion and
# the proper ordering.

That makes perfect sense to me. Thanks for adding it.

Quoted 4 lines

(Bonus point: ithe comment all lines up perfectly well, now! ;-] )

No need to respin, I gues, a maintainer can tweak the message when applying.

Sure. I'll hold off for now. Should this change for whatever reason, please let me know, and I'll send an updated revision.

Quoted 24 lines

Thanks! :-)

Regards,
Yann E. MORIN.

Quoted 11 lines
package/linux-tools/linux-tools.mk +1 -1
+include $(sort $(wildcard package/linux-tools/*.mk.in))
 
 # We only need the kernel to be extracted, not actually built
 LINUX_TOOLS_PATCH_DEPENDENCIES = linux
--

2.7.4

_______________________________________________
buildroot mailing list
buildroot at busybox.net
http://lists.busybox.net/mailman/listinfo/buildroot

--
.-----------------.--------------------.------------------.--------------------.

|  Yann E. MORIN  | Real-Time Embedded | /"\ ASCII RIBBON | Erics' conspiracy: |
| +33 662 376 056 | Software  Designer | \ / CAMPAIGN     |  ___               |
| +33 223 225 172 `------------.-------:  X  AGAINST      |  \e/  There is no  |
| http://ymorin.is-a-geek.org/ | _/*\_ | / \ HTML MAIL    |   v   conspiracy.  |

'------------------------------^-------^------------------^--------------------'

#3 lore raw

PATCH 1/1 package/linux-tools: change method for including linux-tool sub-makefiles

Markus, All,

On 2017-07-18 12:36 -0700, Markus Mayer spake thusly:

Quoted 70 lines · Yann E. MORIN
Quoted 60 lines

Markus, All,

On 2017-07-18 11:11 -0700, Markus Mayer spake thusly:

Quoted 6 lines

Make inclusion ordering of all linux-tool-*.mk sub-makefiles explicit instead of relying on alphabetical sort order. This is done by renaming the Linux tools sub-makefiles to the format linux-tool-*.mk.in. This causes the top-level Makefile to ignore the Linux tools sub-makefiles.

Quoted 6 lines

Until now, the main Makefile included all linux-tool-*.mk files, as well as linux-tools.mk, and it relied on alphabetical sorting to include them in the proper order (linux-tool-*.mk before linux-tools.mk).

Thank you for this new iteration.

I have a small comment, see below...

[--SNIP--]

Quoted 12 lines
package/linux-tools/linux-tools.mk +0 -4
index 7fa8d19..2827ade 100644
@@ -10,15 +10,13 @@
 #
 # So, all tools refer to $(LINUX_DIR) instead of $(@D).
 
-# Note: we need individual tools .mk files to be included *before* this one
-# to guarantee that each tool has a chance to register itself before we build
-# the list of build and install hooks, below.
-#

package/linux-tools/linux-tools.mk line 17

Quoted 10 lines
package/linux-tools/linux-tools.mk +5 -5
-# This is currently guaranteed by the naming of each file:
-# - they get included by the top-level Makefile, with $(sort $(wildcard ...))
-# - make's $(sort) function will aways sort in the C locale
-# - the files names correctly sort out in the C locale so that each tool's
-#   .mk file is included before this one.
+# Note: we need individual tools makefiles to be included *before* we build
+# the list of build and install hooks below to guarantee that each tool has
+# a chance to register itself. Therefore, the makefiles are named
+# linux-tool-*.mk.in, so they won't be picked up by the top-level Makefile,
+# but can be included here, guaranteeing proper ordering.

There are two important and crucial points:

- guaranteeing inclusion ordering,
- guaranteeing single inclusion.

If only the first were needed, then we could simply include the tools here without renaming; they'd be included twice, but that is not a problem for the first point.

But the second point is also important, because we do not want tools to register themselves twice, nor do we want they break their variables by appending stuff already added.

So, I would keep your comment as is, except I'd add a bit on the third and last lines:

Quoted 6 lines

# Note: we need individual tools makefiles to be included *before* we build

# the list of build and install hooks below to guarantee that each tool has
# a chance to register itself once, and only once. Therefore, the makefiles
# are named linux-tool-*.mk.in, so they won't be picked up by the top-level
# Makefile, but can be included here, guaranteeing the single inclusion and
# the proper ordering.

That makes perfect sense to me. Thanks for adding it.

Quoted 7 lines
Quoted 4 lines

(Bonus point: ithe comment all lines up perfectly well, now! ;-] )

No need to respin, I gues, a maintainer can tweak the message when applying.

Sure. I'll hold off for now. Should this change for whatever reason, please let me know, and I'll send an updated revision.

Since we agree, and with the above ammended at commit time:

Regards,
Yann E. MORIN.

Quoted 24 lines
Quoted 24 lines

Thanks! :-)

Regards,
Yann E. MORIN.

Quoted 11 lines
package/linux-tools/linux-tools.mk +1 -1
+include $(sort $(wildcard package/linux-tools/*.mk.in))
 
 # We only need the kernel to be extracted, not actually built
 LINUX_TOOLS_PATCH_DEPENDENCIES = linux
--

2.7.4

_______________________________________________
buildroot mailing list
buildroot at busybox.net
http://lists.busybox.net/mailman/listinfo/buildroot

--
.-----------------.--------------------.------------------.--------------------.

|  Yann E. MORIN  | Real-Time Embedded | /"\ ASCII RIBBON | Erics' conspiracy: |
| +33 662 376 056 | Software  Designer | \ / CAMPAIGN     |  ___               |
| +33 223 225 172 `------------.-------:  X  AGAINST      |  \e/  There is no  |
| http://ymorin.is-a-geek.org/ | _/*\_ | / \ HTML MAIL    |   v   conspiracy.  |

'------------------------------^-------^------------------^--------------------'

Signature · 6 lines
.-----------------.--------------------.------------------.--------------------.
|  Yann E. MORIN  | Real-Time Embedded | /"\ ASCII RIBBON | Erics' conspiracy: |
| +33 662 376 056 | Software  Designer | \ / CAMPAIGN     |  ___               |
| +33 223 225 172 `------------.-------:  X  AGAINST      |  \e/  There is no  |
| http://ymorin.is-a-geek.org/ | _/*\_ | / \ HTML MAIL    |   v   conspiracy.  |
'------------------------------^-------^------------------^--------------------'
#4 lore raw

PATCH 1/1 package/linux-tools: change method for including linux-tool sub-makefiles

In reply to Markus Mayer

Hello,

Quoted 6 lines · Markus Mayer

Make inclusion ordering of all linux-tool-*.mk sub-makefiles explicit instead of relying on alphabetical sort order. This is done by renaming the Linux tools sub-makefiles to the format linux-tool-*.mk.in. This causes the top-level Makefile to ignore the Linux tools sub-makefiles.

Quoted 7 lines

Until now, the main Makefile included all linux-tool-*.mk files, as well as linux-tools.mk, and it relied on alphabetical sorting to include them in the proper order (linux-tool-*.mk before linux-tools.mk).

---

I've taken into account the improvements suggested by Yann and applied. Thanks!

Thomas

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