[PATCH v1 27/30] configure: Add conditional platform builds

Brett Grandbois brett.grandbois at opengear.com
Mon Jul 30 13:30:59 AEST 2018


I like the direction this is going.  One suggestion I might make is that 
as platforms are effectively independent modules anyway with their own 
registration interface, maybe also have an explicit 'use these platform 
files' configure option?  Then it would be easy for developers to add in 
their custom platforms at build time without having to modify 
configure/makefiles.

So on the command line something like:

configure --enable-explicit-platforms=foo,/some/abs/path/bar.c 
--enable-explicit-platform-libs=baz

eventually turns into something like this:

discover_platform_ro_SOURCES += discover/platform-foo.c /some/abs/path/bar.c

discover_platform_ro_LDFLAGS += -lbaz

After a bit more configure/Makefile magic that I know I'm glossing over, 
but this is just to illustrate the idea for comment.

The libs is of course if your platform module requires something outside 
the main lib list, depending on how far to take this.


On 25/07/18 08:15, Geoff Levand wrote:
> Add configure --enable-platform-XXX options to allow specifying
> which platform support to build.
>
> --enable-platform-auto, the default, will use the host
> triplet to guess which platforms to build.
> --enable-platform-all will build all platforms.
>
> Signed-off-by: Geoff Levand <geoff at infradead.org>
> ---
>   configure.ac         | 38 ++++++++++++++++++++++++++++++++++++++
>   discover/Makefile.am | 11 +++++++----
>   2 files changed, 45 insertions(+), 4 deletions(-)
>
> diff --git a/configure.ac b/configure.ac
> index 408a569..5b7c7b5 100644
> --- a/configure.ac
> +++ b/configure.ac
> @@ -303,6 +303,44 @@ AS_IF(
>   	]
>   )
>   
> +# platform choice
> +AC_ARG_ENABLE(
> +	[platform-all],
> +	[AS_HELP_STRING(
> +		[--enable-platform-all],
> +		[build support for all platforms [default=no]]
> +	)]
> +)
> +AS_IF(
> +	[test "x$enable_platform_all" = "xyes"],
> +	[enable_platform_powerpc="yes"; enable_platform_ps3="yes"]
> +)
> +
> +AC_ARG_ENABLE(
> +	[platform-auto],
> +	[AS_HELP_STRING(
> +		[--enable-platform-auto],
> +		[auto detect platform support to build [default=yes]]
> +	)],
> +	[],
> +	[enable_platform_auto="yes"]
> +)
> +AS_IF(
> +	[test "x$enable_platform_auto" = "xyes"],
> +	[AS_CASE([$host],
> +		[powerpc*-*-*],  [enable_platform_powerpc="yes"],
> +	)]
> +)
> +
> +AC_ARG_ENABLE(
> +	[platform-powerpc],
> +	[AS_HELP_STRING(
> +		[--enable-platform-powerpc],
> +		[build support for powerpc platforms [default=no]]
> +	)]
> +)
> +AM_CONDITIONAL([PLATFORM_POWERPC], [test "x$enable_platform_powerpc" = "xyes"])
> +
>   AC_ARG_ENABLE(
>   	[platform-ps3],
>   	[AS_HELP_STRING(
> diff --git a/discover/Makefile.am b/discover/Makefile.am
> index f9625ec..2b7c794 100644
> --- a/discover/Makefile.am
> +++ b/discover/Makefile.am
> @@ -80,11 +80,11 @@ discover_platform_ro_SOURCES = \
>   	discover/ipmi.h \
>   	discover/dt.c \
>   	discover/dt.h \
> -	discover/hostboot.h \
> -	discover/platform-powerpc.c
> +	discover/hostboot.h
>   
> -discover_platform_ro_CPPFLAGS = \
> -	$(AM_CPPFLAGS)
> +if PLATFORM_POWERPC
> +discover_platform_ro_SOURCES += discover/platform-powerpc.c
> +endif
>   
>   # Build dummy last to put it at the end of the platforms section.
>   discover_platform_ro_SOURCES += discover/platform-dummy.c
> @@ -99,5 +99,8 @@ discover_platform_ro_LDFLAGS = \
>   
>   endif
>   
> +discover_platform_ro_CPPFLAGS = \
> +	$(AM_CPPFLAGS)
> +
>   discover_platform_ro_LINK = \
>   	$(LD) -r -o $@



More information about the Petitboot mailing list