From patchwork Mon Aug 31 09:28:57 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Johannes Berg X-Patchwork-Id: 1354255 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=none (no SPF record) smtp.mailfrom=lists.infradead.org (client-ip=2001:8b0:10b:1231::1; helo=merlin.infradead.org; envelope-from=hostap-bounces+incoming=patchwork.ozlabs.org@lists.infradead.org; receiver=) Authentication-Results: ozlabs.org; dmarc=none (p=none dis=none) header.from=sipsolutions.net Authentication-Results: ozlabs.org; dkim=pass (2048-bit key; secure) header.d=lists.infradead.org header.i=@lists.infradead.org header.a=rsa-sha256 header.s=merlin.20170209 header.b=uxXh3FJA; dkim=fail reason="signature verification failed" (2048-bit key; secure) header.d=infradead.org header.i=@infradead.org header.a=rsa-sha256 header.s=casper.20170209 header.b=ZvygGSpE; dkim-atps=neutral Received: from merlin.infradead.org (merlin.infradead.org [IPv6:2001:8b0:10b:1231::1]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 4Bg4gZ4TRGz9sSJ for ; Mon, 31 Aug 2020 19:30:34 +1000 (AEST) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=merlin.20170209; h=Sender:Content-Transfer-Encoding: Content-Type:Cc:List-Subscribe:List-Help:List-Post:List-Archive: List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To:Message-Id:Date: Subject:To:From:Reply-To:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=KLvjHPeNctA6cVMFR7lcufy1502cm21Fr/Kl0yaf3u4=; b=uxXh3FJApRb0ZB7zBDGt1Trpi BY2kcInMEOdADuSk897lxly0A6vOvtigk3jlPqD2Aq8WUfWxtszYwTKm9PJv8dn2zhkWYBZnKqD/2 9o4ke4+cLAoCV1E9ULBuY9sayZT3YdOo6gRaoNjEbD55Ah2A6rTpVHa+3FhSVE3ihXoijOc5sXD6q UFcUFzlnVagJKsDoB5GIb1n1q2waGuMnCQX0vAccJf6YamvlMt82/W3FR4mas2Uk0v/ZGv9ajNZOm Jj2oT+N4E+y7L0BYhAZ9TXgtGEnDNNLXyhPiooQy0/kpTRHujYqRgm+IcXUPOLmeUC6+HNRubkR9V Kd9p1kdHg==; Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1kCg8S-0007FN-SG; Mon, 31 Aug 2020 09:29:56 +0000 Received: from casper.infradead.org ([2001:8b0:10b:1236::1]) by merlin.infradead.org with esmtps (Exim 4.92.3 #3 (Red Hat Linux)) id 1kCg8J-0007Bc-BV for hostap@merlin.infradead.org; Mon, 31 Aug 2020 09:29:47 +0000 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=casper.20170209; h=Content-Transfer-Encoding:MIME-Version: References:In-Reply-To:Message-Id:Date:Subject:Cc:To:From:Sender:Reply-To: Content-Type:Content-ID:Content-Description; bh=oypUO9+FonqgQOuJwySSeAmXoYd3mniknInSLHALTJs=; b=ZvygGSpESVvnBHV+zcXsYdu0Cq LnHY6ui47nDIbJ76XH5oQN5jv5w5x3Ubwe3VIr7KhEljGE7DBpBcrqRTzzYSsbH8vLtu60YhiEXNI qPknfscHyTD0ustrH5Yw5zsjBfUTLSmcLgRgtLK/bYa4KAD4ATV0FCNqsw9ozM5yPrXBakcRzpB8s yjWIauo4rZQKpCq5+7rlMqdbkY95rQmc75wmd16WWsFrpo5wf1urvfFyvx71qy5oXeoDlVzOLs26j ViJyghLgIyivxvmmcuHOe858u2YG4lfasXP25afd1LAaYTn7bwNjrrquqURwDtJdIFyO7Gs0TNid6 71lgk6fw==; Received: from s3.sipsolutions.net ([2a01:4f8:191:4433::2] helo=sipsolutions.net) by casper.infradead.org with esmtps (Exim 4.92.3 #3 (Red Hat Linux)) id 1kCg7y-0001UB-Gx for hostap@lists.infradead.org; Mon, 31 Aug 2020 09:29:46 +0000 Received: by sipsolutions.net with esmtpsa (TLS1.3:ECDHE_X25519__RSA_PSS_RSAE_SHA256__AES_256_GCM:256) (Exim 4.94) (envelope-from ) id 1kCg7k-00DVGB-2i; Mon, 31 Aug 2020 11:29:12 +0200 From: Johannes Berg To: hostap@lists.infradead.org Subject: [PATCH v3 6/9] build: move config file handling into build.rules Date: Mon, 31 Aug 2020 11:28:57 +0200 Message-Id: <1598866005-Ie37624a7910ff4401e58ce73aa094eb448ff6be4@changeid> X-Mailer: git-send-email 2.26.2 In-Reply-To: <20200831092900.12492-1-johannes@sipsolutions.net> References: <20200831092900.12492-1-johannes@sipsolutions.net> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20200831_102926_695832_A6FC8CC4 X-CRM114-Status: GOOD ( 12.49 ) X-Spam-Score: -1.5 (-) X-Spam-Report: SpamAssassin version 3.4.4 on casper.infradead.org summary: Content analysis details: (-1.5 points, 5.0 required) pts rule name description ---- ---------------------- -------------------------------------------------- -1.9 BAYES_00 BODY: Bayes spam probability is 0 to 1% [score: 0.0000] 0.0 SPF_NONE SPF: sender does not publish an SPF Record 0.0 SPF_HELO_NONE SPF: HELO does not publish an SPF Record 0.4 KHOP_HELO_FCRDNS Relay HELO differs from its IP's reverse DNS X-BeenThere: hostap@lists.infradead.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Johannes Berg Sender: "Hostap" Errors-To: hostap-bounces+incoming=patchwork.ozlabs.org@lists.infradead.org From: Johannes Berg This will make it easier to split out the handling in a proper way, and handle common cflags/dependencies. Signed-off-by: Johannes Berg --- hostapd/Makefile | 13 +------------ src/build.rules | 21 ++++++++++++++++++++- wpa_supplicant/Makefile | 13 +------------ 3 files changed, 22 insertions(+), 25 deletions(-) diff --git a/hostapd/Makefile b/hostapd/Makefile index 2e15c8911483..ac83730e9621 100644 --- a/hostapd/Makefile +++ b/hostapd/Makefile @@ -1,5 +1,5 @@ ALL=hostapd hostapd_cli -VERIFY=verify_config +CONFIG_FILE = .config include ../src/build.rules @@ -27,8 +27,6 @@ CFLAGS += -I$(abspath ../src/utils) export BINDIR ?= /usr/local/bin/ --include .config - ifndef CONFIG_NO_GITVER # Add VERSION_STR postfix for builds from a git repository ifeq ($(wildcard ../.git),../.git) @@ -1261,15 +1259,6 @@ ifdef CONFIG_NO_TKIP CFLAGS += -DCONFIG_NO_TKIP endif -verify_config: - @if [ ! -r .config ]; then \ - echo 'Building hostapd 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 - $(DESTDIR)$(BINDIR)/%: % install -D $(<) $(@) diff --git a/src/build.rules b/src/build.rules index e70a0aa2cda7..d5967df96b52 100644 --- a/src/build.rules +++ b/src/build.rules @@ -1,4 +1,4 @@ -all: $(VERIFY) $(ALL) $(EXTRA_TARGETS) +all: _all # disable built-in rules .SUFFIXES: @@ -22,6 +22,25 @@ ifndef CFLAGS CFLAGS = -MMD -O2 -Wall -g endif +ifneq ($(CONFIG_FILE),) +-include $(CONFIG_FILE) + +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 +_all: $(VERIFY) $(ALL) $(EXTRA_TARGETS) + Q=@ E=echo ifeq ($(V), 1) diff --git a/wpa_supplicant/Makefile b/wpa_supplicant/Makefile index b18755bd7481..8645d908f821 100644 --- a/wpa_supplicant/Makefile +++ b/wpa_supplicant/Makefile @@ -14,9 +14,9 @@ ifdef CONFIG_BUILD_WPA_CLIENT_SO ALL += libwpa_client.so endif -VERIFY=verify_config EXTRA_TARGETS=dynamic_eap_methods +CONFIG_FILE=.config include ../src/build.rules ifdef LIBS @@ -39,8 +39,6 @@ CFLAGS += $(EXTRA_CFLAGS) CFLAGS += -I$(abspath ../src) CFLAGS += -I$(abspath ../src/utils) --include .config - ifndef CONFIG_NO_GITVER # Add VERSION_STR postfix for builds from a git repository ifeq ($(wildcard ../.git),../.git) @@ -57,15 +55,6 @@ CONFIG_WPS_TESTING=y CONFIG_TDLS_TESTING=y endif -verify_config: - @if [ ! -r .config ]; then \ - echo 'Building wpa_supplicant 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 - mkconfig: @if [ -f .config ]; then \ echo '.config exists - did not replace it'; \