summaryrefslogtreecommitdiff
path: root/digital/ucoolib/build/config.mk
blob: ff3fa5687f25d4d2e252d400a474017c1b7e560c (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
# ucoolib - Microcontroller object oriented library.
#
# Build time configuration system.

PROJECT_CONFIG ?= Config
MODULES_CONFIG := $(wildcard $(ALL_MODULES:%=$(BASE)/ucoolib/%/Config))

CONFIG_LIST := $(strip $(wildcard $(PROJECT_CONFIG)) $(MODULES_CONFIG))

# Ensure that configuration is up to date, using two mechanisms:
#  - make will make sure config.list is up to date as it is included.
#  - comparison with CONFIG_LIST ensures that the list of included
#  configuration (including the project configuration) is the same.
ifneq ($(MAKECMDGOALS),clean)
-include $(OBJDIR)/config.list
ifneq ($(CONFIG_LIST),$(CONFIG_LIST_OLD))
CONFIG_FORCE := CONFIG_FORCE
endif
endif

# This configuration is really needed, make sure to stop here if it fails.
COMPILE_ORDER_DEPS += $(OBJDIR)/config.list

clean: config-clean

.PHONY: config-clean CONFIG_FORCE

$(OBJDIR)/config.list: $(CONFIG_LIST) $(CONFIG_FORCE) | $(OBJDIR)
	@echo "CONF $(PROJECT_CONFIG)"
	$Q$(BASE)/build/tools/config-gen -H $(OBJDIR)/config/%.hh \
		-p $(PROJECT_CONFIG) -T '$(TARGETS_SUBTARGETS)' \
		$(MODULES_CONFIG)
	$Qecho "CONFIG_LIST_OLD = $(CONFIG_LIST)" > $@

config-clean:
	rm -rf $(OBJDIR)/config $(OBJDIR)/config.list