From busybox Mon Nov 07 05:38:16 2022 From: Michael Tokarev Date: Mon, 07 Nov 2022 05:38:16 +0000 To: busybox Subject: Re: [PATCH] buildsys: resurrect PLATFORM_LINUX and depend on it for linux-specific applets Message-Id: <4d236173-3eed-4341-68a3-7565c428e9d5 () msgid ! tls ! msk ! ru> X-MARC-Message: https://marc.info/?l=busybox&m=166779912415889 07.11.2022 08:25, Kang-Che Sung wrote: > On Sat, Nov 5, 2022 at 12:55 AM Michael Tokarev 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 > ? > If the system supports macros, we can put this in the Kconfig file and simplify > a lot of things: > > config PLATFORM_LINUX > bool > 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