build: Move config file handling into build.rules

This will make it easier to split out the handling in
a proper way, and handle common cflags/dependencies.

Signed-off-by: Johannes Berg <johannes.berg@intel.com>
This commit is contained in:
Johannes Berg 2020-09-18 11:49:52 +02:00 committed by Jouni Malinen
parent 0430bc8267
commit 0464d5d5d6
3 changed files with 24 additions and 25 deletions

View file

@ -1,5 +1,5 @@
.PHONY: all
all: $(VERIFY) $(ALL) $(EXTRA_TARGETS)
all: _all
# disable built-in rules
.SUFFIXES:
@ -23,6 +23,27 @@ ifndef CFLAGS
CFLAGS = -MMD -O2 -Wall -g
endif
ifneq ($(CONFIG_FILE),)
-include $(CONFIG_FILE)
.PHONY: verify_config
verify_config:
@if [ ! -r $(CONFIG_FILE) ]; then \
echo 'Building $(firstword $(ALL)) requires a configuration file'; \
echo '(.config). See README for more instructions. You can'; \
echo 'run "cp defconfig .config" to create an example'; \
echo 'configuration.'; \
exit 1; \
fi
VERIFY := verify_config
else
VERIFY :=
endif
# default target
.PHONY: _all
_all: $(VERIFY) $(ALL) $(EXTRA_TARGETS)
Q=@
E=echo
ifeq ($(V), 1)