Re: [OS-BUILD PATCH] Adding support for distro targets in Makefile

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Wed 23 Nov 2022 10:32:03 GMT, Don Zickus wrote:
> 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
> 
> Signed-off-by: Jonathan Toppins <jtoppins@xxxxxxxxxx>
> Signed-off-by: Don Zickus <dzickus@xxxxxxxxxx>
> 
> ----
> 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(+)
> 
> diff --git a/Makefile b/Makefile
> index 6f846b1f2618f..45fdb18dde46f 100644
> --- a/Makefile
> +++ b/Makefile
> @@ -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

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


-- 
epost|xmpp: nicolas@xxxxxxxxx          irc://oftc.net/nsc
↳ gpg: 18ed 52db e34f 860e e9fb  c82b 7d97 0932 55a0 ce7f
     -- frykten for herren er opphav til kunnskap --

Attachment: signature.asc
Description: PGP signature


[Index of Archives]     [Linux&nblp;USB Development]     [Linux Media]     [Video for Linux]     [Linux Audio Users]     [Yosemite Secrets]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux