commit c7cd988cc0e2c87708df8885a9c5c148a47edb6b
Author: Thomas Schöpping <tschoepp@cit-ec.uni-bielefeld.de>
Date:   Tue Nov 12 15:31:37 2019 +0100

    Makefile structure revised:
    - Module specific tests nor come with individual makefiles, which include the general test code.
    - Board configuration (e.g. connected breakout module) can now be set in Makefile or via CLI.

diff --git a/modules/PowerManagement_1-2/Makefile b/modules/PowerManagement_1-2/Makefile
index 6d62524..c02d07c 100644
--- a/modules/PowerManagement_1-2/Makefile
+++ b/modules/PowerManagement_1-2/Makefile
@@ -140,43 +140,72 @@ include $(CHIBIOS)/os/common/startup/ARMCMx/compilers/GCC/mk/startup_stm32f4xx.m
 include $(CHIBIOS)/os/hal/ports/STM32/STM32F4xx/platform.mk
 include $(CHIBIOS)/os/common/ports/ARMCMx/compilers/GCC/mk/port_v7m.mk
 
-# Periphery LLDs.
+# Module specific configuration
+## select one (or none) of the following
+#BOARD_SENSORRING := BOARD_NOSENSORRING
+#BOARD_SENSORRING := BOARD_PROXIMITYSENSOR
+#BOARD_SENSORRING := BOARD_DISTANCESENSOR_VL53L0X
+#BOARD_SENSORRING := BOARD_DISTANCESENSOR_VL53L1X
+
+# Module specific periphery LLDs.
 include $(AMIROLLD)/drivers/AT24C01B/v1/alld_AT24C01B.mk
-include $(AMIROLLD)/drivers/AT42QT1050/v1/alld_AT42QT1050.mk
 include $(AMIROLLD)/drivers/bq241xx/v1/alld_bq241xx.mk
 include $(AMIROLLD)/drivers/bq27500/v1/alld_bq27500.mk
 include $(AMIROLLD)/drivers/INA219/v1/alld_INA219.mk
 include $(AMIROLLD)/drivers/LED/v1/alld_LED.mk
-include $(AMIROLLD)/drivers/MPR121/v1/alld_MPR121.mk
 include $(AMIROLLD)/drivers/PCA9544A/v1/alld_PCA9544A.mk
-include $(AMIROLLD)/drivers/PCAL6524/v1/alld_PCAL6524.mk
 include $(AMIROLLD)/drivers/PKxxxExxx/v1/alld_PKxxxExxx.mk
 include $(AMIROLLD)/drivers/TPS6211x/v1/alld_TPS6211x.mk
-include $(AMIROLLD)/drivers/VCNL4020/v1/alld_VCNL4020.mk
-
-# Tests.
-include $(AMIROOS_TEST_DIR)lld/adc/aos_test_adc.mk
-include $(AMIROOS_TEST_DIR)periphery-lld/AT24C01B_v1/aos_test_AT24C01B.mk
-include $(AMIROOS_TEST_DIR)periphery-lld/AT42QT1050_v1/aos_test_AT42QT1050.mk
-include $(AMIROOS_TEST_DIR)periphery-lld/bq241xx_v1/aos_test_bq241xx.mk
-include $(AMIROOS_TEST_DIR)periphery-lld/bq27500_v1/aos_test_bq27500.mk
-include $(AMIROOS_TEST_DIR)periphery-lld/bq27500_v1_bq241xx_v1/aos_test_bq27500_bq241xx.mk
-include $(AMIROOS_TEST_DIR)periphery-lld/INA219_v1/aos_test_INA219.mk
-include $(AMIROOS_TEST_DIR)periphery-lld/LED_v1/aos_test_LED.mk
-include $(AMIROOS_TEST_DIR)periphery-lld/MPR121_v1/aos_test_MPR121.mk
-include $(AMIROOS_TEST_DIR)periphery-lld/PCA9544A_v1/aos_test_PCA9544A.mk
-include $(AMIROOS_TEST_DIR)periphery-lld/PCAL6524_v1/aos_test_PCAL6524.mk
-include $(AMIROOS_TEST_DIR)periphery-lld/PKxxxExxx_v1/aos_test_PKxxxExxx.mk
-include $(AMIROOS_TEST_DIR)periphery-lld/TPS6211x_v1/aos_test_TPS6211x.mk
-include $(AMIROOS_TEST_DIR)periphery-lld/TPS6211x_v1_INA219_v1/aos_test_TPS6211x_INA219.mk
-include $(AMIROOS_TEST_DIR)periphery-lld/VCNL4020_v1/aos_test_VCNL4020.mk
+ifeq ($(BOARD_SENSORRING), BOARD_PROXIMITYSENSOR)
+  include $(AMIROLLD)/drivers/MPR121/v1/alld_MPR121.mk
+  include $(AMIROLLD)/drivers/VCNL4020/v1/alld_VCNL4020.mk
+else ifeq ($(BOARD_SENSORRING), BOARD_DISTANCESENSOR_VL53L0X)
+  include $(AMIROLLD)/drivers/AT42QT1050/v1/alld_AT42QT1050.mk
+  include $(AMIROLLD)/drivers/PCAL6524/v1/alld_PCAL6524.mk
+else ifeq ($(BOARD_SENSORRING), BOARD_DISTANCESENSOR_VL53L1X)
+  include $(AMIROLLD)/drivers/AT42QT1050/v1/alld_AT42QT1050.mk
+  include $(AMIROLLD)/drivers/PCAL6524/v1/alld_PCAL6524.mk
+else ifeq ($(BOARD_SENSORRING),)
+  include $(AMIROLLD)/drivers/AT42QT1050/v1/alld_AT42QT1050.mk
+  include $(AMIROLLD)/drivers/PCAL6524/v1/alld_PCAL6524.mk
+  include $(AMIROLLD)/drivers/MPR121/v1/alld_MPR121.mk
+  include $(AMIROLLD)/drivers/VCNL4020/v1/alld_VCNL4020.mk
+endif
 
 # Module specific inclusion directories
-MODULE_INC = $(MODULE_DIR) \
-             $(wildcard $(MODULE_DIR)/test/*)
+MODULE_INC = $(MODULE_DIR)
 
 # Module specific C source files.
-MODULE_CSRC = $(wildcard $(MODULE_INC:%=%/*.[Cc]))
+MODULE_CSRC = $(MODULE_DIR)/board.c \
+              $(MODULE_DIR)/module.c
+
+# Module specific tests.
+include $(MODULE_DIR)/test/adc/module_test_adc.mk
+include $(MODULE_DIR)/test/AT24C01B/module_test_AT24C01B.mk
+include $(MODULE_DIR)/test/bq241xx/module_test_bq241xx.mk
+include $(MODULE_DIR)/test/bq27500/module_test_bq27500.mk
+include $(MODULE_DIR)/test/bq27500_bq241xx/module_test_bq27500_bq241xx.mk
+include $(MODULE_DIR)/test/INA219/module_test_INA219.mk
+include $(MODULE_DIR)/test/LED/module_test_LED.mk
+include $(MODULE_DIR)/test/PCA9544A/module_test_PCA9544A.mk
+include $(MODULE_DIR)/test/PKxxxExxx/module_test_PKxxxExxx.mk
+include $(MODULE_DIR)/test/TPS6211x/module_test_TPS6211x.mk
+include $(MODULE_DIR)/test/TPS6211x_INA219/module_test_TPS6211x_INA219.mk
+ifeq ($(BOARD_SENSORRING), BOARD_PROXIMITYSENSOR)
+  include $(MODULE_DIR)/test/MPR121/module_test_MPR121.mk
+  include $(MODULE_DIR)/test/VCNL4020/module_test_VCNL4020.mk
+else ifeq ($(BOARD_SENSORRING), BOARD_DISTANCESENSOR_VL53L0X)
+  include $(MODULE_DIR)/test/AT42QT1050/module_test_AT42QT1050.mk
+  include $(MODULE_DIR)/test/PCAL6524/module_test_PCAL6524.mk
+else ifeq ($(BOARD_SENSORRING), BOARD_DISTANCESENSOR_VL53L1X)
+  include $(MODULE_DIR)/test/AT42QT1050/module_test_AT42QT1050.mk
+  include $(MODULE_DIR)/test/PCAL6524/module_test_PCAL6524.mk
+else ifeq ($(BOARD_SENSORRING),)
+  include $(MODULE_DIR)/test/AT42QT1050/module_test_AT42QT1050.mk
+  include $(MODULE_DIR)/test/MPR121/module_test_MPR121.mk
+  include $(MODULE_DIR)/test/PCAL6524/module_test_PCAL6524.mk
+  include $(MODULE_DIR)/test/VCNL4020/module_test_VCNL4020.mk
+endif
 
 # C warning options.
 CWARN = -Wall -Wextra -Wundef -Wstrict-prototypes
@@ -196,6 +225,9 @@ SREC = $(CP) -O srec --srec-len=248
 #                                                                              #
 
 # List all user C define here, like -D_DEBUG=1
+ifneq ($(BOARD_SENSORRING),)
+  UDEFS += -DBOARD_SENSORRING=$(BOARD_SENSORRING)
+endif
 UDEFS +=
 
 # Define ASM defines here
