[prev in list] [next in list] [prev in thread] [next in thread] 

List:       busybox
Subject:    Re: [PATCH] buildsys: resurrect PLATFORM_LINUX and depend on it for linux-specific applets
From:       Kang-Che Sung <explorer09 () gmail ! com>
Date:       2022-11-07 5:25:06
Message-ID: CADDzAfNik+YykCose7ZoU4+=D2vXtr3TS976BOrpxkHK0nS+ng () mail ! gmail ! com
[Download RAW message or body]

On Sat, Nov 5, 2022 at 12:55 AM Michael Tokarev <mjt@tls.msk.ru> wrote:

> diff --git a/Makefile b/Makefile
> index 503475fe9..ad780c261 100644
> --- a/Makefile
> +++ b/Makefile
> @@ -361,9 +361,16 @@ scripts/basic/%: scripts_basic ;
> 
> # This target generates Kbuild's and Config.in's from *.c files
> PHONY += gen_build_files
> -gen_build_files: $(wildcard $(srctree)/*/*.c) $(wildcard $(srctree)/*/*/*.c) \
> $(wildcard $(srctree)/embed/*) +gen_build_files: $(wildcard $(srctree)/*/*.c) \
> $(wildcard $(srctree)/*/*/*.c) $(wildcard $(srctree)/embed/*) .platform.in \
> $(Q)$(srctree)/scripts/gen_build_files.sh $(srctree) $(objtree) 
> +.platform.in:
> +       $(Q)printf '#ifndef __linux__\nplatform_is_not_linux\n#endif' \
> +           | $(CPP) - | grep -s platform_is_not_linux \
> +         && linux=n || linux=y; \
> +       printf "config PLATFORM_LINUX\n\tbool\n\tdefault $$linux\n" > $@
> +MRPROPER_FILES += .platform.in
> +
> # bbox: we have helpers in applets/
> # we depend on scripts_basic, since scripts/basic/fixdep
> # must be built before any other host prog

What is the reason for preferring #ifndef check rather than #ifdef?
I mean, that would make PLATFORM_LINUX defaults to y if the compiler fails,
and I would expect n in that case.

And I'm curious. Does Busybox's kconfig system supports macros as described in
<https://www.kernel.org/doc/html/latest/kbuild/kconfig-macro-language.html> ?
If the system supports macros, we can put this in the Kconfig file and simplify
a lot of things:

config PLATFORM_LINUX
<tab>bool
<tab>default $(shell, { printf '#ifndef __linux__\n#error \n#endif\n' \
    | $(CPP) - -o /dev/null; } >/dev/null 2>&1 && echo y || echo n)
_______________________________________________
busybox mailing list
busybox@busybox.net
http://lists.busybox.net/mailman/listinfo/busybox


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic