Hmm.. but that doesn't help with setting up the build. That definition is only visible to C code since it is a C pre-processor definition defined in the CFLAGS. It can't really be used to customize the build, at least not in any clean way.
It would have been useful to have a similar, Make=friendly definition as well. On Tue, Feb 22, 2022 at 7:03 PM Gregory Nutt <spudan...@gmail.com> wrote: > Thanks! Now I see it defined tools/Config.mk. Looks like that was added > with #2192. That is exactly what I need! > > I was thrown off because there are applications that ARE using __NUTTX__: > > $ grep -rl __NUTTX__ * > system/adb/Makefile > system/libuv/0001-initial-libuv-port-to-nuttx.patch > system/libuv/libuv/Makefile > system/libuv/tests/Makefile > > There are a couple using __NuttX__, but didn't catch those: > > $ grep -rl __NuttX__ * > netutils/ftpd/ftpd.c > netutils/webclient/webclient.c > > Thanks again. > > > > On Tue, Feb 22, 2022 at 6:43 PM Nathan Hartman <hartman.nat...@gmail.com> > wrote: > >> On Tue, Feb 22, 2022 at 2:14 PM Gregory Nutt <spudan...@gmail.com> wrote: >> >> > One option would be to define __NUTTX_ in tools/Config.mk instead of in >> > each individual apps/Makefile. That would provide a single point >> > definition coordinate all usage. >> >> >> Just one (possible) correction: IIRC it is capitalized as __NuttX__. All >> my >> cross platform applications look for __NuttX__ to detect that they are >> being built this way. The buildroot toolchain does define that, though I >> am >> *not* using the buildroot toolchain and it is somehow defined anyway. I am >> away from my computer at the moment so I cannot check where it is coming >> from, but from memory I think we added something to the NuttX build >> scripts >> some time ago (maybe about 1 or 2 years ago) to cause that to be defined >> with all compilers. (Or perhaps I remember wrong and I added it to our >> in-house boards' Make.defs.) >> >> Nathan >> >