1
0
mirror of https://github.com/RIOT-OS/RIOT.git synced 2024-12-29 04:50:03 +01:00

sys/posix: make posix module provide only headers.

The build system contains several instances of
 INCLUDES += -I$(RIOTBASE)/sys/posix/include

This is bypassing the module management system, by directly accesing
headers without depending on a module. The module is the posix module.

That line is also added when one of the posix_* modules is requested.

According to the docs, the posix module provides headers only, but in
reality there is also inet.c.

This patch:

- Moves `inet.c` into `posix_inet`, leaving `posix` as a headers-only
  module.
- Rename `posix` as `posix_headers` to make it clear the module only
  includes headers.
- Makes `posix_*` modules depend on `posix_headers`, thus removing the
  explicit `INCLUDES+=...` in `sys/Makefile.include`.
- Ocurrences of `INCLUDES+=...` are replaced by an explicit dependency
  on `posix_headers`.
This commit is contained in:
Juan Carrano 2018-11-09 15:04:45 +01:00
parent f7cdbdaab0
commit 6b766c3cd3
20 changed files with 35 additions and 31 deletions

View File

@ -68,7 +68,7 @@ ifneq (,$(filter gnrc_uhcpc,$(USEMODULE)))
endif
ifneq (,$(filter uhcpc,$(USEMODULE)))
USEMODULE += posix
USEMODULE += posix_inet
endif
ifneq (,$(filter nordic_softdevice_ble,$(USEPKG)))
@ -388,7 +388,7 @@ ifneq (,$(filter posix_sockets,$(USEMODULE)))
USEMODULE += bitfield
USEMODULE += random
USEMODULE += vfs
USEMODULE += posix
USEMODULE += posix_headers
USEMODULE += xtimer
endif
@ -407,17 +407,23 @@ endif
ifneq (,$(filter shell_commands,$(USEMODULE)))
ifneq (,$(filter fib,$(USEMODULE)))
USEMODULE += posix
USEMODULE += posix_inet
endif
endif
ifneq (,$(filter posix_semaphore,$(USEMODULE)))
USEMODULE += sema
USEMODULE += xtimer
USEMODULE += posix_headers
endif
ifneq (,$(filter posix_time,$(USEMODULE)))
USEMODULE += xtimer
USEMODULE += posix_headers
endif
ifneq (,$(filter posix_inet,$(USEMODULE)))
USEMODULE += posix_headers
endif
ifneq (,$(filter lwip_sixlowpan,$(USEMODULE)))
@ -499,6 +505,7 @@ endif
ifneq (,$(filter fib,$(USEMODULE)))
USEMODULE += universal_address
USEMODULE += xtimer
USEMODULE += posix_headers
endif
ifneq (,$(filter oonf_rfc5444,$(USEMODULE)))
@ -695,6 +702,7 @@ ifneq (,$(filter devfs,$(USEMODULE)))
endif
ifneq (,$(filter vfs,$(USEMODULE)))
USEMODULE += posix_headers
ifeq (native, $(BOARD))
USEMODULE += native_vfs
endif
@ -702,11 +710,11 @@ endif
ifneq (,$(filter sock_dns,$(USEMODULE)))
USEMODULE += sock_util
USEMODULE += posix
USEMODULE += posix_headers
endif
ifneq (,$(filter sock_util,$(USEMODULE)))
USEMODULE += posix
USEMODULE += posix_inet
USEMODULE += fmt
USEMODULE += sock_udp
endif

View File

@ -77,7 +77,7 @@ ifneq (,$(filter ndn-riot,$(USEPKG)))
USEMODULE += cipher_modes
endif
ifneq (,$(findstring posix,$(USEMODULE)))
ifneq (,$(findstring posix_headers,$(USEMODULE)))
USEMODULE += newlib_syscalls_default
endif

2
dist/Makefile vendored
View File

@ -33,7 +33,7 @@ QUIET ?= 1
# Modules to include:
#USEMODULE += shell
#USEMODULE += posix
#USEMODULE += posix_headers
#USEMODULE += xtimer
# If your application is very simple and doesn't use modules that use

View File

@ -26,6 +26,7 @@ USEMODULE += gnrc_udp
USEMODULE += gnrc_sock_udp
USEMODULE += posix_sockets
USEMODULE += posix_time
USEMODULE += posix_inet
# Add also the shell, some shell commands
USEMODULE += shell
USEMODULE += shell_commands

View File

@ -55,6 +55,7 @@ PSEUDOMODULES += newlib_gnu_source
PSEUDOMODULES += newlib_nano
PSEUDOMODULES += openthread
PSEUDOMODULES += pktqueue
PSEUDOMODULES += posix_headers
PSEUDOMODULES += printf_float
PSEUDOMODULES += prng
PSEUDOMODULES += prng_%

View File

@ -4,4 +4,5 @@ ifneq (,$(filter ccn-lite,$(USEPKG)))
USEMODULE += random
USEMODULE += timex
USEMODULE += tlsf-malloc
USEMODULE += posix_headers
endif

View File

@ -2,6 +2,5 @@ INCLUDES += -I$(PKGDIRBASE)/ccn-lite/src/ccnl-riot/include
INCLUDES += -I$(PKGDIRBASE)/ccn-lite/src/ccnl-core/include
INCLUDES += -I$(PKGDIRBASE)/ccn-lite/src/ccnl-pkt/include
INCLUDES += -I$(PKGDIRBASE)/ccn-lite/src/ccnl-fwd/include
INCLUDES += -I$(RIOTBASE)/sys/posix/include
CFLAGS += -DCCNL_RIOT

View File

@ -1 +1 @@
USEMODULE += posix
USEMODULE += posix_headers

View File

@ -1,4 +1,5 @@
ifneq (,$(filter libcoap,$(USEPKG)))
USEMODULE += posix_sockets
USEMODULE += posix_headers
USEMODULE += gnrc_sock_udp
endif

View File

@ -1,2 +1 @@
INCLUDES += -I$(PKGDIRBASE)/libcoap \
-I$(RIOTBASE)/sys/posix/include
INCLUDES += -I$(PKGDIRBASE)/libcoap

View File

@ -4,6 +4,9 @@ endif
ifneq (,$(filter eepreg,$(USEMODULE)))
DIRS += eepreg
endif
ifneq (,$(filter posix_inet,$(USEMODULE)))
DIRS += posix/inet
endif
ifneq (,$(filter posix_semaphore,$(USEMODULE)))
DIRS += posix/semaphore
endif

View File

@ -2,9 +2,6 @@ ifneq (,$(filter nhdp,$(USEMODULE)))
USEMODULE_INCLUDES += $(RIOTBASE)/sys/net/routing/nhdp
endif
ifneq (,$(filter fib,$(USEMODULE)))
USEMODULE_INCLUDES += $(RIOTBASE)/sys/posix/include
endif
ifneq (,$(filter gnrc_netif,$(USEMODULE)))
USEMODULE_INCLUDES += $(RIOTBASE)/sys/net/gnrc/netif/include
endif
@ -14,15 +11,11 @@ ifneq (,$(filter gnrc_sock,$(USEMODULE)))
CFLAGS += -DSOCK_HAS_IPV6
endif
endif
ifneq (,$(filter posix,$(USEMODULE)))
USEMODULE_INCLUDES += $(RIOTBASE)/sys/posix/include
endif
ifneq (,$(filter posix_semaphore,$(USEMODULE)))
USEMODULE_INCLUDES += $(RIOTBASE)/sys/posix/include
endif
ifneq (,$(filter posix_sockets,$(USEMODULE)))
ifneq (,$(filter posix_headers,$(USEMODULE)))
USEMODULE_INCLUDES += $(RIOTBASE)/sys/posix/include
endif
ifneq (,$(filter pthread,$(USEMODULE)))
USEMODULE_INCLUDES += $(RIOTBASE)/sys/posix/pthread/include
endif
@ -41,10 +34,6 @@ ifneq (,$(filter app_metadata,$(USEMODULE)))
endif
endif
ifneq (,$(filter vfs,$(USEMODULE)))
USEMODULE_INCLUDES += $(RIOTBASE)/sys/posix/include
endif
ifneq (,$(filter cpp11-compat,$(USEMODULE)))
USEMODULE_INCLUDES += $(RIOTBASE)/sys/cpp11-compat/include
# make sure cppsupport.o is linked explicitly because __dso_handle is not

View File

@ -1 +1,3 @@
MODULE=posix_inet
include $(RIOTBASE)/Makefile.base

View File

@ -16,7 +16,7 @@ USEMODULE += auto_init_gnrc_netif
USEMODULE += shell_commands
USEMODULE += posix
USEMODULE += posix_inet
LOW_MEMORY_BOARDS := nucleo-f334r8 msb-430 msb-430h

View File

@ -6,7 +6,7 @@ BOARD_BLACKLIST := arduino-mega2560 waspmote-pro arduino-uno arduino-duemilanove
# jiminy-mega256rfr2: unknown type name: clockid_t
# mega-xplained: unknown type name: clockid_t
USEMODULE += posix
USEMODULE += posix_headers
USEMODULE += pthread
TEST_ON_CI_WHITELIST += all

View File

@ -8,7 +8,7 @@ BOARD_BLACKLIST := arduino-mega2560 waspmote-pro arduino-uno arduino-duemilanove
BOARD_INSUFFICIENT_MEMORY := nucleo-f031k6
USEMODULE += posix
USEMODULE += posix_headers
USEMODULE += pthread
USEMODULE += xtimer

View File

@ -8,7 +8,7 @@ BOARD_BLACKLIST := arduino-mega2560 waspmote-pro arduino-uno arduino-duemilanove
BOARD_INSUFFICIENT_MEMORY := nucleo-f031k6
USEMODULE += posix
USEMODULE += posix_headers
USEMODULE += pthread
TEST_ON_CI_WHITELIST += all

View File

@ -6,7 +6,7 @@ BOARD_BLACKLIST := arduino-mega2560 waspmote-pro arduino-uno arduino-duemilanove
# jiminy-mega256rfr2: unknown type name: clockid_t
# mega-xplained: unknown type name: clockid_t
USEMODULE += posix
USEMODULE += posix_headers
USEMODULE += pthread
TEST_ON_CI_WHITELIST += all

View File

@ -3,4 +3,4 @@ USEMODULE += gnrc_sock
USEMODULE += gnrc_ipv6
USEMODULE += ipv4_addr
USEMODULE += ipv6_addr
USEMODULE += posix
USEMODULE += posix_headers