]> git.ipfire.org Git - thirdparty/hostap.git/blobdiff - src/build.rules
build: Move config file handling into build.rules
[thirdparty/hostap.git] / src / build.rules
index 18e23ea5338cf9e02948c09390f14c278eb87f97..486fea65861eb080b0ecd22e2f91f254da46889c 100644 (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)