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

View File

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

2
dist/Makefile vendored
View File

@ -33,7 +33,7 @@ QUIET ?= 1
# Modules to include: # Modules to include:
#USEMODULE += shell #USEMODULE += shell
#USEMODULE += posix #USEMODULE += posix_headers
#USEMODULE += xtimer #USEMODULE += xtimer
# If your application is very simple and doesn't use modules that use # 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 += gnrc_sock_udp
USEMODULE += posix_sockets USEMODULE += posix_sockets
USEMODULE += posix_time USEMODULE += posix_time
USEMODULE += posix_inet
# Add also the shell, some shell commands # Add also the shell, some shell commands
USEMODULE += shell USEMODULE += shell
USEMODULE += shell_commands USEMODULE += shell_commands

View File

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

View File

@ -4,4 +4,5 @@ ifneq (,$(filter ccn-lite,$(USEPKG)))
USEMODULE += random USEMODULE += random
USEMODULE += timex USEMODULE += timex
USEMODULE += tlsf-malloc USEMODULE += tlsf-malloc
USEMODULE += posix_headers
endif 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-core/include
INCLUDES += -I$(PKGDIRBASE)/ccn-lite/src/ccnl-pkt/include INCLUDES += -I$(PKGDIRBASE)/ccn-lite/src/ccnl-pkt/include
INCLUDES += -I$(PKGDIRBASE)/ccn-lite/src/ccnl-fwd/include INCLUDES += -I$(PKGDIRBASE)/ccn-lite/src/ccnl-fwd/include
INCLUDES += -I$(RIOTBASE)/sys/posix/include
CFLAGS += -DCCNL_RIOT CFLAGS += -DCCNL_RIOT

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -16,7 +16,7 @@ USEMODULE += auto_init_gnrc_netif
USEMODULE += shell_commands USEMODULE += shell_commands
USEMODULE += posix USEMODULE += posix_inet
LOW_MEMORY_BOARDS := nucleo-f334r8 msb-430 msb-430h 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 # jiminy-mega256rfr2: unknown type name: clockid_t
# mega-xplained: unknown type name: clockid_t # mega-xplained: unknown type name: clockid_t
USEMODULE += posix USEMODULE += posix_headers
USEMODULE += pthread USEMODULE += pthread
TEST_ON_CI_WHITELIST += all 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 BOARD_INSUFFICIENT_MEMORY := nucleo-f031k6
USEMODULE += posix USEMODULE += posix_headers
USEMODULE += pthread USEMODULE += pthread
USEMODULE += xtimer USEMODULE += xtimer

View File

@ -8,7 +8,7 @@ BOARD_BLACKLIST := arduino-mega2560 waspmote-pro arduino-uno arduino-duemilanove
BOARD_INSUFFICIENT_MEMORY := nucleo-f031k6 BOARD_INSUFFICIENT_MEMORY := nucleo-f031k6
USEMODULE += posix USEMODULE += posix_headers
USEMODULE += pthread USEMODULE += pthread
TEST_ON_CI_WHITELIST += all 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 # jiminy-mega256rfr2: unknown type name: clockid_t
# mega-xplained: unknown type name: clockid_t # mega-xplained: unknown type name: clockid_t
USEMODULE += posix USEMODULE += posix_headers
USEMODULE += pthread USEMODULE += pthread
TEST_ON_CI_WHITELIST += all TEST_ON_CI_WHITELIST += all

View File

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