1
0
mirror of https://github.com/RIOT-OS/RIOT.git synced 2025-12-28 16:01:18 +01:00
RIOT/sys/Makefile.include
Marian Buschsieweke f0540a9000
sys/event: manage event thread size via build system
This adds a mechanism for modules to declare requirements on the thread
stack size in their `Makefile.dep` and let the build system then
override the default stack size, if any requirements are declared.

The motivation is to allow multiple modules to have special requirements
without causing conflicts, as just adding the following to their
`Makefile.include` would do:

```Makefile
CFLAGS += -DEVENT_THREAD_MEDIUM_STACKSIZE=<MAGIC_NUMBER>
```

Instead, the new mechanism would work by having them both declare in
their `Makefile.dep`:

```Makefile
EVENT_THREAD_MEDIUM_STACKSIZE_MIN +=
```

The build system then picks the maximum number in
`EVENT_THREAD_MEDIUM_STACKSIZE_MIN` and exposes this as stack size, if
any module did declare a minimum requirement.

Co-authored-by: benpicco <benpicco@googlemail.com>
2025-12-09 13:50:56 +01:00

219 lines
6.0 KiB
Makefile

ifneq (,$(filter bhp,$(USEMODULE)))
include $(RIOTBASE)/sys/bhp/Makefile.include
endif
ifneq (,$(filter gnrc_sixlowpan_frag_rb,$(USEMODULE)))
USEMODULE_INCLUDES += $(RIOTBASE)/sys/net/gnrc/network_layer/sixlowpan/frag
endif
ifneq (,$(filter gnrc_lorawan,$(USEMODULE)))
USEMODULE_INCLUDES += $(RIOTBASE)/sys/net/gnrc/link_layer/lorawan/include
endif
ifneq (,$(filter gnrc_sock,$(USEMODULE)))
USEMODULE_INCLUDES += $(RIOTBASE)/sys/net/gnrc/sock/include
endif
ifneq (,$(filter gnrc_sock_async,$(USEMODULE)))
CFLAGS += -DSOCK_HAS_ASYNC
endif
ifneq (,$(filter gnrc_pktbuf,$(USEMODULE)))
include $(RIOTBASE)/sys/net/gnrc/pktbuf/Makefile.include
endif
ifneq (,$(filter gnrc_pktbuf_static,$(USEMODULE)))
include $(RIOTBASE)/sys/net/gnrc/pktbuf_static/Makefile.include
endif
ifneq (,$(filter malloc_thread_safe,$(USEMODULE)))
include $(RIOTBASE)/sys/malloc_thread_safe/Makefile.include
endif
ifneq (,$(filter posix_headers,$(USEMODULE)))
USEMODULE_INCLUDES += $(RIOTBASE)/sys/posix/include
endif
ifneq (,$(filter pthread,$(USEMODULE)))
USEMODULE_INCLUDES += $(RIOTBASE)/sys/posix/pthread/include
endif
ifneq (,$(filter oneway_malloc,$(USEMODULE)))
USEMODULE_INCLUDES += $(RIOTBASE)/sys/oneway-malloc/include
endif
ifneq (,$(filter eui_provider,$(USEMODULE)))
USEMODULE_INCLUDES += $(RIOTBASE)/sys/net/link_layer/eui_provider/include
endif
ifneq (,$(filter app_metadata,$(USEMODULE)))
# Overwrite the application shell formats.
# This is an optional macro that can be used to coordinate
# standardized shell formats, as an example it can point to an RDM
# that specifies semantics.
ifdef APP_SHELL_FMT
CFLAGS += -DAPP_SHELL_FMT=\"$(APP_SHELL_FMT)\"
endif
endif
ifneq (,$(filter auto_init,$(USEMODULE)))
USEMODULE_INCLUDES += $(RIOTBASE)/sys/auto_init/include
endif
ifneq (,$(filter cpp11-compat,$(USEMODULE)))
USEMODULE_INCLUDES += $(RIOTBASE)/sys/cpp11-compat/include
endif
ifneq (,$(filter embunit,$(USEMODULE)))
ifeq ($(OUTPUT),XML)
CFLAGS += -DOUTPUT=OUTPUT_XML
else ifeq ($(OUTPUT),TEXT)
CFLAGS += -DOUTPUT=OUTPUT_TEXT
else ifeq ($(OUTPUT),COMPILER)
CFLAGS += -DOUTPUT=OUTPUT_COMPILER
else ifeq ($(OUTPUT),COLORTEXT)
CFLAGS += -DOUTPUT=OUTPUT_COLORTEXT
else ifeq ($(OUTPUT),COLOR)
CFLAGS += -DOUTPUT=OUTPUT_COLOR
endif
endif
ifneq (,$(filter log_color,$(USEMODULE)))
include $(RIOTBASE)/sys/log_color/Makefile.include
endif
ifneq (,$(filter log_printfnoformat,$(USEMODULE)))
include $(RIOTBASE)/sys/log_printfnoformat/Makefile.include
endif
ifneq (,$(filter newlib,$(USEMODULE)))
include $(RIOTMAKE)/libc/newlib.mk
endif
ifneq (,$(filter picolibc,$(USEMODULE)))
include $(RIOTMAKE)/libc/picolibc.mk
endif
ifneq (,$(filter arduino,$(USEMODULE)))
include $(RIOTBASE)/sys/arduino/Makefile.include
endif
# Add linker flags needed to enable printing of floats
ifneq (,$(filter printf_float,$(USEMODULE)))
# newlib_nano does not enable printing of floats by default, so we need
# to add -u _printf_float to enable it (at the cost of increased ROM size)
# ...
ifneq (,$(filter newlib_nano,$(USEMODULE)))
# ... unless we are not actually using newlib's stdio, in which case we
# rather not add linker flags but let the custom stdio implementation
# (currently only mpaland-printf) handle that.
ifeq (,$(filter mpaland-printf,$(USEPKG)))
LINKFLAGS += -u _printf_float
endif
endif
endif
ifneq (,$(filter scanf_float,$(USEMODULE)))
ifneq (,$(filter newlib_nano,$(USEMODULE)))
LINKFLAGS += -u _scanf_float
endif
endif
# we need to include this before the riotboot include
include $(RIOTBASE)/sys/slot_aux/Makefile.include
ifneq (,$(filter riotboot,$(FEATURES_USED)))
include $(RIOTBASE)/sys/riotboot/Makefile.include
endif
ifneq (,$(filter skald, $(USEMODULE)))
include $(RIOTBASE)/sys/net/ble/skald/Makefile.include
endif
ifneq (,$(filter sock sock_%,$(USEMODULE)))
ifneq (,$(filter ipv4,$(USEMODULE)))
CFLAGS += -DSOCK_HAS_IPV4
endif
ifneq (,$(filter ipv6,$(USEMODULE)))
CFLAGS += -DSOCK_HAS_IPV6
endif
endif
ifneq (,$(filter sock_async_event,$(USEMODULE)))
include $(RIOTBASE)/sys/net/sock/async/event/Makefile.include
endif
ifneq (,$(filter ssp,$(USEMODULE)))
include $(RIOTBASE)/sys/ssp/Makefile.include
endif
ifneq (native,$(CPU))
INCLUDES += -I$(RIOTBASE)/sys/libc/include
endif
ifneq (,$(filter clif, $(USEMODULE)))
INCLUDES += -I$(RIOTBASE)/sys/clif/include
endif
ifneq (,$(filter zptr,$(USEMODULE)))
include $(RIOTBASE)/sys/zptr/Makefile.include
endif
ifneq (,$(filter test_utils_result_output,$(USEMODULE)))
include $(RIOTBASE)/sys/test_utils/result_output/Makefile.include
endif
ifneq (,$(filter test_utils_netdev_ieee802154_minimal,$(USEMODULE)))
CFLAGS += -DCONFIG_NETDEV_REGISTER_SIGNAL
endif
ifneq (,$(filter ztimer,$(USEMODULE)))
include $(RIOTBASE)/sys/ztimer/Makefile.include
endif
ifneq (,$(filter prng,$(USEMODULE)))
include $(RIOTBASE)/sys/random/Makefile.include
endif
ifneq (,$(filter psa_crypto,$(USEMODULE)))
include $(RIOTBASE)/sys/psa_crypto/Makefile.include
endif
ifneq (,$(filter test_utils_netdev_eth_minimal,$(USEMODULE)))
CFLAGS += -DCONFIG_NETDEV_REGISTER_SIGNAL
endif
ifneq (,$(filter shell_lock,$(USEMODULE)))
include $(RIOTBASE)/sys/shell_lock/Makefile.include
endif
PSEUDOMODULES += shell_democommands
ifneq (,$(filter rust_riotmodules,$(USEMODULE)))
include $(RIOTBASE)/sys/rust_riotmodules/Makefile.include
endif
ifneq (,$(filter tiny_strerror,$(USEMODULE)))
include $(RIOTBASE)/sys/tiny_strerror/Makefile.include
endif
ifneq (,$(filter preprocessor_%,$(USEMODULE)))
include $(RIOTBASE)/sys/preprocessor/Makefile.include
endif
ifneq (,$(filter gcoap,$(USEMODULE)))
include $(RIOTBASE)/sys/net/application_layer/gcoap/Makefile.include
endif
ifneq (,$(filter nanocoap,$(USEMODULE)))
include $(RIOTBASE)/sys/net/application_layer/nanocoap/Makefile.include
endif
ifneq (,$(filter unicoap,$(USEMODULE)))
include $(RIOTBASE)/sys/net/application_layer/unicoap/Makefile.include
endif
ifneq (,$(filter event,$(USEMODULE)))
include $(RIOTBASE)/sys/event/Makefile.include
endif