Adding support for distro targets in Makefile
PATCH 1/1 Adding support for distro targets in Makefile
Fedora adds a directory to its source git tree to provide packaging information[1] specific for its distro. We would like to propagate our 'help' section to the toplevel to be seen by 'make help' as it isn't obvious to users to use 'make dist-help'[2].
Instead of keeping Fedora changes local, I am proposing a generic mechanism for other distros to use if they would like. The change looks for a distro directory and leverages that Makefile if it exists. Otherwise it is ignored.
[1] - https://gitlab.com/cki-project/kernel-ark/-/tree/os-build/redhat
[2] - https://gitlab.com/cki-project/kernel-ark/-/blob/os-build/redhat/Makefile#L809
----
This patch is more of a conversation starter than anything.
I think other distros might find this useful and examples of what we would populate the directory with can be found in [1].
Thoughts?
--- Makefile | 15 +++++++++++++++ 1 file changed, 15 insertions(+)
Makefile +15 -0
@@ -1635,6 +1635,16 @@ distclean: mrproper %pkg: include/config/kernel.release FORCE $(Q)$(MAKE) -f $(srctree)/scripts/Makefile.package $@ +# Distribution of the kernel +# --------------------------------------------------------------------------- + +dist%: FORCE + @if ! test -f $(srctree)/distro/Makefile; then \ + echo 'No distribution targets defined'; \ + exit 1; \ + fi + $(Q)$(MAKE) -C $(srctree)/distro $@ + # Brief documentation of the typical targets used # ---------------------------------------------------------------------------
@@ -1732,6 +1742,11 @@ help: @echo '' @echo 'Kernel packaging:' @$(MAKE) -f $(srctree)/scripts/Makefile.package help + @if test -f $(srctree)/distro/Makefile; then \ + echo ''; \ + echo 'Distro targets:'; \ + $(MAKE) -C $(srctree)/distro dist-help; \ + fi @echo '' @echo 'Documentation targets:' @$(MAKE) -f $(srctree)/Documentation/Makefile dochelp
Signature · 1 line
2.38.1
Quoted 17 lines · Don Zickus
Fedora adds a directory to its source git tree to provide packaging information[1] specific for its distro. We would like to propagate our 'help' section to the toplevel to be seen by 'make help' as it isn't obvious to users to use 'make dist-help'[2].
Instead of keeping Fedora changes local, I am proposing a generic mechanism for other distros to use if they would like. The change looks for a distro directory and leverages that
Makefileif it exists. Otherwise it is ignored.[1] - https://gitlab.com/cki-project/kernel-ark/-/tree/os-build/redhat
[2] - https://gitlab.com/cki-project/kernel-ark/-/blob/os-build/redhat/Makefile#L809Signed-off-by Jonathan Toppins <[email protected]>Signed-off-by Don Zickus <[email protected]>
Quoted 7 lines
----
This patch is more of a conversation starter than anything.I think other distros might find this useful and examples of what we would populate the directory with can be found in [1].
Thoughts?
I do not like to merge any code that is irrelevant to the upstream.
Quoted 40 lines
--- Makefile | 15 +++++++++++++++ 1 file changed, 15 insertions(+)Makefile +15
-1@@ -1635,6 +1635,16 @@ distclean: mrproper %pkg: include/config/kernel.release FORCE $(Q)$(MAKE) -f $(srctree)/scripts/Makefile.package $@ +# Distribution of the kernel +# --------------------------------------------------------------------------- + +dist%: FORCE + @if ! test -f $(srctree)/distro/Makefile; then \ + echo 'No distribution targets defined'; \ + exit 1; \ + fi + $(Q)$(MAKE) -C $(srctree)/distro $@ + # Brief documentation of the typical targets used # ---------------------------------------------------------------------------@@ -1732,6 +1742,11 @@ help: @echo '' @echo 'Kernel packaging:' @$(MAKE) -f $(srctree)/scripts/Makefile.package help + @if test -f $(srctree)/distro/Makefile; then \ + echo ''; \ + echo 'Distro targets:'; \ + $(MAKE) -C $(srctree)/distro dist-help; \ + fi @echo '' @echo 'Documentation targets:' @$(MAKE) -f $(srctree)/Documentation/Makefile dochelp --2.38.1
Signature · 2 lines
Best Regards Masahiro Yamada
Quoted 22 lines · Masahiro Yamada
Quoted 20 lines · Don Zickus
Fedora adds a directory to its source git tree to provide packaging information[1] specific for its distro. We would like to propagate our 'help' section to the toplevel to be seen by 'make help' as it isn't obvious to users to use 'make dist-help'[2].
Instead of keeping Fedora changes local, I am proposing a generic mechanism for other distros to use if they would like. The change looks for a distro directory and leverages that
Makefileif it exists. Otherwise it is ignored.[1] - https://gitlab.com/cki-project/kernel-ark/-/tree/os-build/redhat
[2] - https://gitlab.com/cki-project/kernel-ark/-/blob/os-build/redhat/Makefile#L809Signed-off-by Jonathan Toppins <[email protected]>Signed-off-by Don Zickus <[email protected]>----
This patch is more of a conversation starter than anything.
Quoted 6 lines
Quoted 4 lines
I think other distros might find this useful and examples of what we would populate the directory with can be found in [1].
Thoughts?
I do not like to merge any code that is irrelevant to the upstream.
While not directly relevant to the upstream tree, it is very relevant to the way the tree is being used. More importantly, it allows a "distro agnostic" mechanism without requiring distributions or other developers/users with their own additional make targets to avoid carrying a patch to make it all work.
Justin
Quoted 47 lines
Quoted 39 lines
--- Makefile | 15 +++++++++++++++ 1 file changed, 15 insertions(+)Makefile +15
-1@@ -1635,6 +1635,16 @@ distclean: mrproper %pkg: include/config/kernel.release FORCE $(Q)$(MAKE) -f $(srctree)/scripts/Makefile.package $@ +# Distribution of the kernel +# --------------------------------------------------------------------------- + +dist%: FORCE + @if ! test -f $(srctree)/distro/Makefile; then \ + echo 'No distribution targets defined'; \ + exit 1; \ + fi + $(Q)$(MAKE) -C $(srctree)/distro $@ + # Brief documentation of the typical targets used # ---------------------------------------------------------------------------@@ -1732,6 +1742,11 @@ help: @echo '' @echo 'Kernel packaging:' @$(MAKE) -f $(srctree)/scripts/Makefile.package help + @if test -f $(srctree)/distro/Makefile; then \ + echo ''; \ + echo 'Distro targets:'; \ + $(MAKE) -C $(srctree)/distro dist-help; \ + fi @echo '' @echo 'Documentation targets:' @$(MAKE) -f $(srctree)/Documentation/Makefile dochelp --Quoted 2 lines
2.38.1
--
Best Regards
Masahiro Yamada
Quoted 32 lines · Justin Forbes
Quoted 22 lines · Masahiro Yamada
Quoted 20 lines · Don Zickus
Fedora adds a directory to its source git tree to provide packaging information[1] specific for its distro. We would like to propagate our 'help' section to the toplevel to be seen by 'make help' as it isn't obvious to users to use 'make dist-help'[2].
Instead of keeping Fedora changes local, I am proposing a generic mechanism for other distros to use if they would like. The change looks for a distro directory and leverages that
Makefileif it exists. Otherwise it is ignored.[1] - https://gitlab.com/cki-project/kernel-ark/-/tree/os-build/redhat
[2] - https://gitlab.com/cki-project/kernel-ark/-/blob/os-build/redhat/Makefile#L809Signed-off-by Jonathan Toppins <[email protected]>Signed-off-by Don Zickus <[email protected]>----
This patch is more of a conversation starter than anything.Quoted 6 lines
Quoted 4 lines
I think other distros might find this useful and examples of what we would populate the directory with can be found in [1].
Thoughts?
I do not like to merge any code that is irrelevant to the upstream.
Quoted 7 lines
While not directly relevant to the upstream tree, it is very relevant to the way the tree is being used. More importantly, it allows a "distro agnostic" mechanism without requiring distributions or other developers/users with their own additional make targets to avoid carrying a patch to make it all work.
Justin
This is another contract to downstream code.
Once this is merged, it will be difficult to change it because the upstream community never knows how it is used in downstream.
For example,
$(Q)$(MAKE) -C $(srctree)/distro $@
violates the rule on how Kbuild works
(in the sense of the working directory).
$(Q)$(MAKE) -f $(srctree)/distro/Makefile $@
is more aligned with how O= build works, but
we cannot _fix_ it later since this changes the working directory.
And, I assume people will come back again, for example,
to insert another hook into "make clean" for cleaning distro artifacts.
So, it is better to not merge code like this.
Quoted 47 lines
Quoted 47 lines
Quoted 39 lines
--- Makefile | 15 +++++++++++++++ 1 file changed, 15 insertions(+)Makefile +15
-1@@ -1635,6 +1635,16 @@ distclean: mrproper %pkg: include/config/kernel.release FORCE $(Q)$(MAKE) -f $(srctree)/scripts/Makefile.package $@ +# Distribution of the kernel +# --------------------------------------------------------------------------- + +dist%: FORCE + @if ! test -f $(srctree)/distro/Makefile; then \ + echo 'No distribution targets defined'; \ + exit 1; \ + fi + $(Q)$(MAKE) -C $(srctree)/distro $@ + # Brief documentation of the typical targets used # ---------------------------------------------------------------------------@@ -1732,6 +1742,11 @@ help: @echo '' @echo 'Kernel packaging:' @$(MAKE) -f $(srctree)/scripts/Makefile.package help + @if test -f $(srctree)/distro/Makefile; then \ + echo ''; \ + echo 'Distro targets:'; \ + $(MAKE) -C $(srctree)/distro dist-help; \ + fi @echo '' @echo 'Documentation targets:' @$(MAKE) -f $(srctree)/Documentation/Makefile dochelp --Quoted 2 lines
2.38.1
--
Best Regards
Masahiro Yamada
Signature · 2 lines
Best Regards Masahiro Yamada
Quoted 63 lines · Don Zickus
Fedora adds a directory to its source git tree to provide packaging information[1] specific for its distro. We would like to propagate our 'help' section to the toplevel to be seen by 'make help' as it isn't obvious to users to use 'make dist-help'[2].
Instead of keeping Fedora changes local, I am proposing a generic mechanism for other distros to use if they would like. The change looks for a distro directory and leverages that
Makefileif it exists. Otherwise it is ignored.[1] - https://gitlab.com/cki-project/kernel-ark/-/tree/os-build/redhat
[2] - https://gitlab.com/cki-project/kernel-ark/-/blob/os-build/redhat/Makefile#L809Signed-off-by Jonathan Toppins <[email protected]>Signed-off-by Don Zickus <[email protected]>----
This patch is more of a conversation starter than anything.I think other distros might find this useful and examples of what we would populate the directory with can be found in [1].
Thoughts?
--- Makefile | 15 +++++++++++++++ 1 file changed, 15 insertions(+)Makefile +15
-0@@ -1635,6 +1635,16 @@ distclean: mrproper %pkg: include/config/kernel.release FORCE $(Q)$(MAKE) -f $(srctree)/scripts/Makefile.package $@ +# Distribution of the kernel +# --------------------------------------------------------------------------- + +dist%: FORCE + @if ! test -f $(srctree)/distro/Makefile; then \ + echo 'No distribution targets defined'; \ + exit 1; \ + fi + $(Q)$(MAKE) -C $(srctree)/distro $@ + # Brief documentation of the typical targets used # ---------------------------------------------------------------------------@@ -1732,6 +1742,11 @@ help: @echo '' @echo 'Kernel packaging:' @$(MAKE) -f $(srctree)/scripts/Makefile.package help + @if test -f $(srctree)/distro/Makefile; then \ + echo ''; \ + echo 'Distro targets:'; \ + $(MAKE) -C $(srctree)/distro dist-help; \ + fi @echo '' @echo 'Documentation targets:' @$(MAKE) -f $(srctree)/Documentation/Makefile dochelpSignature · 1 line
2.38.1
Have you tried to wrap upstream main Makefile? E.g. you can add a GNUmakefile that simply forwards all targets to Makefile. It could be used to add new targets, or to extends one or the other target from Makefile.
(Further, you could make use of MAKEFILES variable and force inclusion of a makefile that extends the upstream makefiles "on-the-fly", but as this is quite fragile, I cannot recommend it.)
Kind regards,
Nicolas
Signature · 3 lines
epost|xmpp: [email protected] irc://oftc.net/nsc ↳ gpg: 18ed 52db e34f 860e e9fb c82b 7d97 0932 55a0 ce7f -- frykten for herren er opphav til kunnskap --