From patchwork Wed Jul 3 13:15:19 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Przemek Kitszel X-Patchwork-Id: 13722220 X-Patchwork-Delegate: stephen@networkplumber.org Received: from mgamail.intel.com (mgamail.intel.com [198.175.65.21]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 65674171095 for ; Wed, 3 Jul 2024 13:16:18 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=198.175.65.21 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1720012579; cv=none; b=uPy2h6YJQ5BaJrRO9/B1FKBNRbqnmgE+We2CU6OllGcocgmwb7SnNQDarAG2DXhcnA032q0u3TQ18PTL1DENWtvcn/0JQhkG0MIt1eOE7h7HtV/MBdQG+HgkFllFK0dDNF9anOSww1oIJA4CpffLQbaiLHgeymkPSoZoyPDuWxU= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1720012579; c=relaxed/simple; bh=RmFFuiWyudqqJH/BIdZhqZUPBJUMygqHGKWV0ukvic0=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=NfK6WaWRXyxl11Oe1ha8bS5CH8RIe5iiXkpQPTlIkBaoPGO6D+pI/TZQSXgcD8HLte/1Txnxv8UymbJGWcYEQwN4EnMq57KhlH2Shw5uz8eEeylB0ifOb09cd4KW5g55KKverWiJ3bTPXzFo3yi/bywH5uekvUEK5O3N+2vsAEM= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=intel.com; spf=pass smtp.mailfrom=intel.com; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b=gNWzv+RM; arc=none smtp.client-ip=198.175.65.21 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=intel.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=intel.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b="gNWzv+RM" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1720012579; x=1751548579; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=RmFFuiWyudqqJH/BIdZhqZUPBJUMygqHGKWV0ukvic0=; b=gNWzv+RMH2bzbX5DWfDiA/9i5FuWUF2oNuim7yO/6UxPUbVcJNnyUqoq w/ZEigvjgYKoUloc0CCSrjwwsqPHGCiYY93G85IarJMzslkb8YI8l+EQc YCr15pl263fiMEDW4MaXRs6RrHADNJ8gg+ezd0UtPkyQZ751gF2WzR3dE rApozrP/1Wvg4g7FCgb+OU8rwzhGnRhyV/jvN4YOyIZ2M3PVP0ySbVPVt vueRsp9PjjFeLNOtE/DH/BCFxTK3oD9JIBjw0yJM/VrSxiFLr308ZgVeq MxLrkFUt8S+5kUaJIjza4q6wMIR9t/yB2MmcitfxxtRfBY3esBJbnpGD7 w==; X-CSE-ConnectionGUID: 5McSNQf4SwK+sOSuDJJtyA== X-CSE-MsgGUID: Bxg2uiaTQZaKd9hz+19ymA== X-IronPort-AV: E=McAfee;i="6700,10204,11121"; a="17195087" X-IronPort-AV: E=Sophos;i="6.09,182,1716274800"; d="scan'208";a="17195087" Received: from orviesa001.jf.intel.com ([10.64.159.141]) by orvoesa113.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 03 Jul 2024 06:16:15 -0700 X-CSE-ConnectionGUID: FqYrvja0RNeacWloGBNzng== X-CSE-MsgGUID: e6dx5BRcRLisInHUVMyelw== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.09,182,1716274800"; d="scan'208";a="83805884" Received: from irvmail002.ir.intel.com ([10.43.11.120]) by orviesa001.jf.intel.com with ESMTP; 03 Jul 2024 06:16:11 -0700 Received: from vecna.igk.intel.com (vecna.igk.intel.com [10.123.220.17]) by irvmail002.ir.intel.com (Postfix) with ESMTP id CDD2728778; Wed, 3 Jul 2024 14:16:10 +0100 (IST) From: Przemek Kitszel To: Stephen Hemminger , David Ahern Cc: netdev@vger.kernel.org, Tony Nguyen , Lukasz Czapnik , Przemek Kitszel Subject: [PATCH iproute2-next 1/3] man: devlink-resource: add missing words in the example Date: Wed, 3 Jul 2024 15:15:19 +0200 Message-Id: <20240703131521.60284-2-przemyslaw.kitszel@intel.com> X-Mailer: git-send-email 2.39.3 In-Reply-To: <20240703131521.60284-1-przemyslaw.kitszel@intel.com> References: <20240703131521.60284-1-przemyslaw.kitszel@intel.com> Precedence: bulk X-Mailing-List: netdev@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-Patchwork-Delegate: dsahern@gmail.com Add missing "size" and "path" words in the example, as the current example is incorrect and will be rejected by the command. The keywords were missing from very inception of devlink-resource man page Fixes: 58b48c5d75e2 ("devlink: Update man pages and add resource man") Signed-off-by: Przemek Kitszel Reviewed-by: Michal Kubiak --- man/man8/devlink-resource.8 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/man/man8/devlink-resource.8 b/man/man8/devlink-resource.8 index 8c3158076a92..c4f6918c9b03 100644 --- a/man/man8/devlink-resource.8 +++ b/man/man8/devlink-resource.8 @@ -63,7 +63,7 @@ devlink resource show pci/0000:01:00.0 Shows the resources of the specified devlink device. .RE .PP -devlink resource set pci/0000:01:00.0 /kvd/linear 98304 +devlink resource set pci/0000:01:00.0 path /kvd/linear size 98304 .RS 4 Sets the size of the specified resource for the specified devlink device. .RE From patchwork Wed Jul 3 13:15:20 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Przemek Kitszel X-Patchwork-Id: 13722222 X-Patchwork-Delegate: dsahern@gmail.com Received: from mgamail.intel.com (mgamail.intel.com [198.175.65.21]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 00B2B179970 for ; Wed, 3 Jul 2024 13:16:19 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=198.175.65.21 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1720012581; cv=none; b=jOijTxeTmkTzEuc4PVzSw7pd1ux6rGICUbe4q9vKa4A1CyA8vHBzpPEcPEodc1nFnwFHnjVIfDdeeAetovEBoaQz48DFhuqUQ0i24UVWWd5ccA5MTrmyP1viarMpqHXhggUVTf71ed08Eu4TVzVeN1GPN56wf7zNljaFL4mx0J4= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1720012581; c=relaxed/simple; bh=rT0BeF4MDOJPjbgHUSfRBBx/GY1rVxmeWdmq+26n/ko=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=apo56a5pBq1sscNTdnbS5zIZDeKS1ZJCHAOJOPCzYlHoqj5owCvAvUvffHMjyMOB5IhsWuRJsePjpEj1V+GYQwh5vaF1dQluHBTuF27Skm3Ec7AOEc91aqUQO60sPn/UWbf2XJumWbqPfu+8WePXNPG0AFpkcDv88b7HFUjhzG8= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=intel.com; spf=pass smtp.mailfrom=intel.com; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b=OyUVXXNE; arc=none smtp.client-ip=198.175.65.21 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=intel.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=intel.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b="OyUVXXNE" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1720012581; x=1751548581; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=rT0BeF4MDOJPjbgHUSfRBBx/GY1rVxmeWdmq+26n/ko=; b=OyUVXXNEQbl4eaQBGzaY9/Dlq4sQXLxQadN4VBWf7pC7CTYLai5x5DXf q40xLw+nd+P3Yndqd0vDWMoclV+qa9lMTfyLwKOrMBancW5u+AcxIIgeS YpSXb7pBYHupP/wNS7QobzK9blec0iFd+PBY35G3jAqNCpBiNv0rKfCR9 YTY/mwumRieoSZca3rRpk6L6n8mQ6vEu9xr2DmPugcSYmiRnxSTGhHYOA snawWXJolKgdypwEM95KGUQoxz4oTShQZNWjl7NzwpQwnfE0YPOrIFx6z vA42gfK1GaoRrRoUX732woXHI6hC3D6i8d8ngJUtLmrIQ+lEJmr9KL7L5 Q==; X-CSE-ConnectionGUID: 3P16Jh9CQNKmh3hxbL/8Eg== X-CSE-MsgGUID: BzFNlImaQSKD5oQtphSuJQ== X-IronPort-AV: E=McAfee;i="6700,10204,11121"; a="17195090" X-IronPort-AV: E=Sophos;i="6.09,182,1716274800"; d="scan'208";a="17195090" Received: from orviesa001.jf.intel.com ([10.64.159.141]) by orvoesa113.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 03 Jul 2024 06:16:15 -0700 X-CSE-ConnectionGUID: bCJ/DNArR0K9TLQNx7b8Fw== X-CSE-MsgGUID: D6sK2YMtQc6mx/6dTNyedA== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.09,182,1716274800"; d="scan'208";a="83805886" Received: from irvmail002.ir.intel.com ([10.43.11.120]) by orviesa001.jf.intel.com with ESMTP; 03 Jul 2024 06:16:12 -0700 Received: from vecna.igk.intel.com (vecna.igk.intel.com [10.123.220.17]) by irvmail002.ir.intel.com (Postfix) with ESMTP id 513C828779; Wed, 3 Jul 2024 14:16:11 +0100 (IST) From: Przemek Kitszel To: Stephen Hemminger , David Ahern Cc: netdev@vger.kernel.org, Tony Nguyen , Lukasz Czapnik , Przemek Kitszel , Maciej Fijalkowski Subject: [PATCH iproute2-next 2/3] devlink: print missing params even if an unknown one is present Date: Wed, 3 Jul 2024 15:15:20 +0200 Message-Id: <20240703131521.60284-3-przemyslaw.kitszel@intel.com> X-Mailer: git-send-email 2.39.3 In-Reply-To: <20240703131521.60284-1-przemyslaw.kitszel@intel.com> References: <20240703131521.60284-1-przemyslaw.kitszel@intel.com> Precedence: bulk X-Mailing-List: netdev@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-Patchwork-Delegate: dsahern@gmail.com Print all of the missing parameters, also in the presence of unknown ones. Take for example a correct command: $ devlink resource set pci/0000:01:00.0 path /kvd/linear size 98304 And remove the "size" keyword: $ devlink resource set pci/0000:01:00.0 path /kvd/linear 98304 That yields output: Resource size expected. Unknown option "98304" Prior to the patch only the last line of output was present. And if user would forgot also the "path" keyword, there will be additional line: Resource path expected. in the stderr. Reviewed-by: Maciej Fijalkowski Signed-off-by: Przemek Kitszel Reviewed-by: Michal Kubiak --- devlink/devlink.c | 27 +++++++++++++++++++-------- 1 file changed, 19 insertions(+), 8 deletions(-) diff --git a/devlink/devlink.c b/devlink/devlink.c index 57bcc9658bdb..9907712e3ad0 100644 --- a/devlink/devlink.c +++ b/devlink/devlink.c @@ -1680,26 +1680,28 @@ static const struct dl_args_metadata dl_args_required[] = { static int dl_args_finding_required_validate(uint64_t o_required, uint64_t o_found) { - uint64_t o_flag; - int i; + uint64_t o_flag, o_missing = 0; + int i, err = 0; for (i = 0; i < ARRAY_SIZE(dl_args_required); i++) { o_flag = dl_args_required[i].o_flag; if ((o_required & o_flag) && !(o_found & o_flag)) { + o_missing |= o_flag; pr_err("%s\n", dl_args_required[i].err_msg); - return -ENOENT; + err = -ENOENT; } } - if (o_required & ~o_found) { + if (o_required & ~(o_found | o_missing)) { pr_err("BUG: unknown argument required but not found\n"); return -EINVAL; } - return 0; + return err; } static int dl_argv_parse(struct dl *dl, uint64_t o_required, uint64_t o_optional) { + const char *unknown_option = NULL; struct dl_opts *opts = &dl->opts; uint64_t o_all = o_required | o_optional; char *str = dl_argv_next(dl); @@ -2313,8 +2315,9 @@ static int dl_argv_parse(struct dl *dl, uint64_t o_required, o_found |= DL_OPT_PORT_FN_MAX_IO_EQS; } else { - pr_err("Unknown option \"%s\"\n", dl_argv(dl)); - return -EINVAL; + if (!unknown_option) + unknown_option = dl_argv(dl); + dl_arg_inc(dl); } } @@ -2325,7 +2328,15 @@ static int dl_argv_parse(struct dl *dl, uint64_t o_required, opts->present = o_found; - return dl_args_finding_required_validate(o_required, o_found); + err = dl_args_finding_required_validate(o_required, o_found); + + if (unknown_option) { + pr_err("Unknown option \"%s\"\n", unknown_option); + if (!err) + return -EINVAL; + } + + return err; } static int dl_argv_dry_parse(struct dl *dl, uint64_t o_required, From patchwork Wed Jul 3 13:15:21 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Przemek Kitszel X-Patchwork-Id: 13722221 X-Patchwork-Delegate: dsahern@gmail.com Received: from mgamail.intel.com (mgamail.intel.com [198.175.65.21]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id EE11617838B for ; Wed, 3 Jul 2024 13:16:18 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=198.175.65.21 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1720012580; cv=none; b=HYZg4cHws7VMQqEr7lcOQ6cwM7WAVq8NLyMPaxJ9BWJSiHUykEGbDpCsCx737IW1lAdjPrMX/9SVlfAeLC31br4cclm3Q+oi8XbDH2n9/GoCOP3fV66lcjucVt1aaeyzOrPLP9KO8c8fSCjUky1j1D3Tijg3rBcsVjbuZpx01jY= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1720012580; c=relaxed/simple; bh=gVSHs/txastxc+p5HWuJAzqBslA+1scIlNsHFQvuKiE=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=m7PzlK7vqymIua4DnLAzWZV9GghtHAGTFG6KxMfOdGBa+o1ffEeAGda/kyp0W/OmjxXKhCXybXFnJEN4/HV5FUy3yyTo7xcxnaCDDUHkGzO+8f8QD+8OJqfCGbfEtl9HA/TZ/EL+kO/h39+YM3b/gEH/gsOI5/0ZJx5fonmmAwU= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=intel.com; spf=pass smtp.mailfrom=intel.com; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b=nIhFmnz+; arc=none smtp.client-ip=198.175.65.21 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=intel.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=intel.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b="nIhFmnz+" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1720012580; x=1751548580; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=gVSHs/txastxc+p5HWuJAzqBslA+1scIlNsHFQvuKiE=; b=nIhFmnz+pjGsb1/XNAl2h6vTBVI5wVe7Y73RX9ZRAXEVUvxm69MfilE8 mOvHSholgDXG08Z8PiHSjLiFzSoCviOUyXFYgSMPQGbtkcOLGjYb2VUim 6e1inBcbSNU4k5mSqYlh+Bi43fd2O/G66vcO90kxHIHHEpOn4Zpsu/Xty tHzMjpOWu4HomMSyQ2hyeiXkHeItvp00i8z+ojazBFKBzW3BQW2gTDmhA FSA/fBNHAH1qvYnpeoksJo5450h6tt0YP0DzdfQbCPsVKp7sqBDOZWQuN 9KQoC5t8pigwXKWd00XmIFslFG2lEbjp61xW/usWN2xNLTiKi0LlANial w==; X-CSE-ConnectionGUID: LkQZ6kYEQwmNn1Nb/6T/GA== X-CSE-MsgGUID: m/sWPxmFThulTnRw9QMgpw== X-IronPort-AV: E=McAfee;i="6700,10204,11121"; a="17195094" X-IronPort-AV: E=Sophos;i="6.09,182,1716274800"; d="scan'208";a="17195094" Received: from orviesa001.jf.intel.com ([10.64.159.141]) by orvoesa113.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 03 Jul 2024 06:16:16 -0700 X-CSE-ConnectionGUID: dX6Oh2bYQSu98xO7BTM+Sg== X-CSE-MsgGUID: fsCBoCPZSjWD+BQoDhiZAg== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.09,182,1716274800"; d="scan'208";a="83805888" Received: from irvmail002.ir.intel.com ([10.43.11.120]) by orviesa001.jf.intel.com with ESMTP; 03 Jul 2024 06:16:12 -0700 Received: from vecna.igk.intel.com (vecna.igk.intel.com [10.123.220.17]) by irvmail002.ir.intel.com (Postfix) with ESMTP id E39E32877D; Wed, 3 Jul 2024 14:16:11 +0100 (IST) From: Przemek Kitszel To: Stephen Hemminger , David Ahern Cc: netdev@vger.kernel.org, Tony Nguyen , Lukasz Czapnik , Przemek Kitszel Subject: [PATCH iproute2-next 3/3] Makefile: support building from subdirectories Date: Wed, 3 Jul 2024 15:15:21 +0200 Message-Id: <20240703131521.60284-4-przemyslaw.kitszel@intel.com> X-Mailer: git-send-email 2.39.3 In-Reply-To: <20240703131521.60284-1-przemyslaw.kitszel@intel.com> References: <20240703131521.60284-1-przemyslaw.kitszel@intel.com> Precedence: bulk X-Mailing-List: netdev@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-Patchwork-Delegate: dsahern@gmail.com Support building also from subdirectories, like: `make -C devlink` or `cd devlink; make`. Extract common defines and include flags to a new file (common.mk) which will be included from subdir makefiles via the generated config.mk file. Note that the current, toplevel-issued, `make` still works as before. Note that `./configure && make` is still required once after the fresh checkout. Signed-off-by: Przemek Kitszel --- Makefile | 45 --------------------------------------------- common.mk | 43 +++++++++++++++++++++++++++++++++++++++++++ configure | 3 +++ 3 files changed, 46 insertions(+), 45 deletions(-) create mode 100644 common.mk diff --git a/Makefile b/Makefile index 2b2c3dec927e..1915b8191d3e 100644 --- a/Makefile +++ b/Makefile @@ -1,8 +1,6 @@ # SPDX-License-Identifier: GPL-2.0 # Top level Makefile for iproute2 --include config.mk - ifeq ("$(origin V)", "command line") VERBOSE = $(V) endif @@ -14,37 +12,6 @@ ifeq ($(VERBOSE),0) MAKEFLAGS += --no-print-directory endif -PREFIX?=/usr -SBINDIR?=/sbin -NETNS_RUN_DIR?=/var/run/netns -NETNS_ETC_DIR?=/etc/netns -DATADIR?=$(PREFIX)/share -HDRDIR?=$(PREFIX)/include/iproute2 -CONF_ETC_DIR?=/etc/iproute2 -CONF_USR_DIR?=$(DATADIR)/iproute2 -DOCDIR?=$(DATADIR)/doc/iproute2 -MANDIR?=$(DATADIR)/man -ARPDDIR?=/var/lib/arpd -KERNEL_INCLUDE?=/usr/include -BASH_COMPDIR?=$(DATADIR)/bash-completion/completions - -# Path to db_185.h include -DBM_INCLUDE:=$(DESTDIR)/usr/include - -SHARED_LIBS = y - -DEFINES= -DRESOLVE_HOSTNAMES -DLIBDIR=\"$(LIBDIR)\" -ifneq ($(SHARED_LIBS),y) -DEFINES+= -DNO_SHARED_LIBS -endif - -DEFINES+=-DCONF_USR_DIR=\"$(CONF_USR_DIR)\" \ - -DCONF_ETC_DIR=\"$(CONF_ETC_DIR)\" \ - -DNETNS_RUN_DIR=\"$(NETNS_RUN_DIR)\" \ - -DNETNS_ETC_DIR=\"$(NETNS_ETC_DIR)\" \ - -DARPDDIR=\"$(ARPDDIR)\" \ - -DCONF_COLOR=$(CONF_COLOR) - #options for AX.25 ADDLIB+=ax25_ntop.o @@ -59,24 +26,12 @@ ADDLIB+=netrom_ntop.o CC := gcc HOSTCC ?= $(CC) -DEFINES += -D_GNU_SOURCE -# Turn on transparent support for LFS -DEFINES += -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE -D_LARGEFILE64_SOURCE -CCOPTS = -O2 -pipe -WFLAGS := -Wall -Wstrict-prototypes -Wmissing-prototypes -WFLAGS += -Wmissing-declarations -Wold-style-definition -Wformat=2 - -CFLAGS := $(WFLAGS) $(CCOPTS) -I../include -I../include/uapi $(DEFINES) $(CFLAGS) -YACCFLAGS = -d -t -v SUBDIRS=lib ip tc bridge misc netem genl man ifeq ($(HAVE_MNL),y) SUBDIRS += tipc devlink rdma dcb vdpa endif -LIBNETLINK=../lib/libutil.a ../lib/libnetlink.a -LDLIBS += $(LIBNETLINK) - all: config.mk @set -e; \ for i in $(SUBDIRS); \ diff --git a/common.mk b/common.mk new file mode 100644 index 000000000000..de26322322d6 --- /dev/null +++ b/common.mk @@ -0,0 +1,43 @@ +PREFIX?=/usr +SBINDIR?=/sbin +NETNS_RUN_DIR?=/var/run/netns +NETNS_ETC_DIR?=/etc/netns +DATADIR?=$(PREFIX)/share +HDRDIR?=$(PREFIX)/include/iproute2 +CONF_ETC_DIR?=/etc/iproute2 +CONF_USR_DIR?=$(DATADIR)/iproute2 +DOCDIR?=$(DATADIR)/doc/iproute2 +MANDIR?=$(DATADIR)/man +ARPDDIR?=/var/lib/arpd +KERNEL_INCLUDE?=/usr/include +BASH_COMPDIR?=$(DATADIR)/bash-completion/completions + +# Path to db_185.h include +DBM_INCLUDE:=$(DESTDIR)/usr/include + +SHARED_LIBS = y + +DEFINES= -DRESOLVE_HOSTNAMES -DLIBDIR=\"$(LIBDIR)\" +ifneq ($(SHARED_LIBS),y) +DEFINES+= -DNO_SHARED_LIBS +endif + +DEFINES+=-DCONF_USR_DIR=\"$(CONF_USR_DIR)\" \ + -DCONF_ETC_DIR=\"$(CONF_ETC_DIR)\" \ + -DNETNS_RUN_DIR=\"$(NETNS_RUN_DIR)\" \ + -DNETNS_ETC_DIR=\"$(NETNS_ETC_DIR)\" \ + -DARPDDIR=\"$(ARPDDIR)\" \ + -DCONF_COLOR=$(CONF_COLOR) + +DEFINES += -D_GNU_SOURCE +# Turn on transparent support for LFS +DEFINES += -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE -D_LARGEFILE64_SOURCE +CCOPTS = -O2 -pipe +WFLAGS := -Wall -Wstrict-prototypes -Wmissing-prototypes +WFLAGS += -Wmissing-declarations -Wold-style-definition -Wformat=2 + +CFLAGS := $(WFLAGS) $(CCOPTS) -I../include -I../include/uapi $(DEFINES) $(CFLAGS) +YACCFLAGS = -d -t -v + +LIBNETLINK=../lib/libutil.a ../lib/libnetlink.a +LDLIBS += $(LIBNETLINK) diff --git a/configure b/configure index 928048b3d8c0..978f787ce4d3 100755 --- a/configure +++ b/configure @@ -615,6 +615,9 @@ check_cap echo -n "color output: " check_color +# must be after check_color +echo "include ../common.mk" >> $CONFIG + echo >> $CONFIG echo "%.o: %.c" >> $CONFIG echo ' $(QUIET_CC)$(CC) $(CFLAGS) $(EXTRA_CFLAGS) $(CPPFLAGS) -c -o $@ $<' >> $CONFIG