07.11.2022 08:25, Kang-Che Sung wrote:
On Sat, Nov 5, 2022 at 12:55 AM Michael Tokarev <m...@tls.msk.ru> wrote:
diff --git a/Makefile b/Makefile
+.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" > $@
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.
That's exactly the goal, - to make linux the default, that's the reason
I changed from ifdef linux to ifndef. The idea is to bring as few burden
to the main authors as possible, - if this doesn't work, their favorite
platform wont be affected. See the email I referred to in other message -
http://lists.busybox.net/pipermail/busybox/2011-February/074954.html -
from 11 years ago, - this is when "depends on LINUX" were (mistakenly)
changed to "select LINUX" in the first place, making it effectively
impossible to build busybox on non-linux.
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)
No, - busybox's kconfig is much simpler than that, as far as I can see,
it is a fork off a much earlier kconfig language.
Thanks,
/mjt
_______________________________________________
busybox mailing list
busybox@busybox.net
http://lists.busybox.net/mailman/listinfo/busybox