Skip to content

Commit

Permalink
makefiles: Minor clean ups
Browse files Browse the repository at this point in the history
- Add FEATURES_REQUIRED_ANY to dependency-debug:
  Now `make dependency-debug` by default also stores the contents of
  `FEATURES_REQUIRED_ANY`.
- makefiles/features_check.inc.mk: Break long lines
- {tests/minimal,tests/unittests,bootloaders/riotboot}:
  Disable auto_init_% in addition to auto_init.

This works around weird behavior due to the USEMODULE being recursively expended
in the first iteration of dependency resolution: Modules added to DEFAULT_MODULE
get automatically added to USEMODULE during the first run, but not for
subsequent. This should be iron out later on.
  • Loading branch information
maribu committed Apr 2, 2020
1 parent 7bc15ac commit af21f15
Show file tree
Hide file tree
Showing 5 changed files with 18 additions and 7 deletions.
2 changes: 1 addition & 1 deletion bootloaders/riotboot/Makefile
Expand Up @@ -15,7 +15,7 @@ CFLAGS += -DRIOTBOOT
# Disable unused modules
CFLAGS += -DNDEBUG -DLOG_LEVEL=LOG_NONE
DISABLE_MODULE += core_init core_msg core_panic
DISABLE_MODULE += auto_init
DISABLE_MODULE += auto_init auto_init_%

# avoid using stdio
USEMODULE += stdio_null
Expand Down
7 changes: 6 additions & 1 deletion makefiles/dependencies_debug.inc.mk
Expand Up @@ -39,12 +39,17 @@ DEPENDENCY_DEBUG_OUTPUT_DIR ?= $(CURDIR)

# Save variables that are used for parsing dependencies
_DEPS_DEBUG_VARS += BOARD CPU CPU_MODEL CPU_FAM
_DEPS_DEBUG_VARS += FEATURES_PROVIDED _FEATURES_PROVIDED_SORTED FEATURES_REQUIRED _FEATURES_REQUIRED_SORTED FEATURES_OPTIONAL FEATURES_USED FEATURES_MISSING FEATURES_CONFLICT FEATURES_CONFLICTING
_DEPS_DEBUG_VARS += FEATURES_PROVIDED _FEATURES_PROVIDED_SORTED
_DEPS_DEBUG_VARS += FEATURES_REQUIRED _FEATURES_REQUIRED_SORTED
_DEPS_DEBUG_VARS += FEATURES_REQUIRED_ANY _FEATURES_REQUIRED_ANY_SORTED
_DEPS_DEBUG_VARS += FEATURES_OPTIONAL FEATURES_USED FEATURES_MISSING
_DEPS_DEBUG_VARS += FEATURES_CONFLICT FEATURES_CONFLICTING
_DEPS_DEBUG_VARS += USEMODULE DEFAULT_MODULE DISABLE_MODULE
DEPS_DEBUG_VARS ?= $(_DEPS_DEBUG_VARS)

_FEATURES_PROVIDED_SORTED = $(sort $(FEATURES_PROVIDED))
_FEATURES_REQUIRED_SORTED = $(sort $(FEATURES_REQUIRED))
_FEATURES_REQUIRED_ANY_SORTED = $(sort $(FEATURES_REQUIRED_ANY))

file_save_dependencies_variables = $(call file_save_variable,$(DEPENDENCY_DEBUG_OUTPUT_DIR)/$1_$(BOARD),$(DEPS_DEBUG_VARS))
# Remove file before to be sure appending is started with an empty file
Expand Down
12 changes: 9 additions & 3 deletions makefiles/features_check.inc.mk
Expand Up @@ -39,13 +39,19 @@ FEATURES_REQUIRED_ONE_OUT_OF := $(foreach item,\

# Features that are required by the application but not provided by the BSP
# Having features missing may case the build to fail.
FEATURES_MISSING := $(sort $(filter-out $(FEATURES_PROVIDED),$(FEATURES_REQUIRED) $(FEATURES_REQUIRED_ONE_OUT_OF)))
FEATURES_MISSING := $(sort \
$(filter-out $(FEATURES_PROVIDED),\
$(FEATURES_REQUIRED) $(FEATURES_REQUIRED_ONE_OUT_OF)))

# Features that are used for an application
FEATURES_USED := $(sort $(FEATURES_REQUIRED) $(FEATURES_REQUIRED_ONE_OUT_OF) $(FEATURES_OPTIONAL_USED))
FEATURES_USED := $(sort $(FEATURES_REQUIRED) \
$(FEATURES_REQUIRED_ONE_OUT_OF) \
$(FEATURES_OPTIONAL_USED))

# Used features that conflict when used together
FEATURES_CONFLICTING := $(sort $(foreach conflict,$(FEATURES_CONFLICT),$(call _features_conflicting,$(conflict))))
FEATURES_CONFLICTING := $(sort $(foreach conflict,\
$(FEATURES_CONFLICT),\
$(call _features_conflicting,$(conflict))))

# Return conflicting features from the conflict string feature1:feature2
# $1: feature1:feature2
Expand Down
2 changes: 1 addition & 1 deletion tests/minimal/Makefile
Expand Up @@ -3,7 +3,7 @@ include ../Makefile.tests_common

CFLAGS += -DNDEBUG -DLOG_LEVEL=LOG_NONE

DISABLE_MODULE += auto_init
DISABLE_MODULE += auto_init auto_init_%
DISABLE_MODULE += test_utils_interactive_sync

USEMODULE += stdio_null
Expand Down
2 changes: 1 addition & 1 deletion tests/unittests/Makefile
Expand Up @@ -11,7 +11,7 @@ else
UNIT_TESTS := $(filter tests-%, $(MAKECMDGOALS))
endif

DISABLE_MODULE += auto_init
DISABLE_MODULE += auto_init auto_init_%

# boards using arduino bootloader require auto_init to
# automatically initialize stdio over USB. Without this, the bootloader
Expand Down

0 comments on commit af21f15

Please sign in to comment.