Received: by 2002:a05:6358:a55:b0:ec:fcf4:3ecf with SMTP id 21csp81059rwb; Wed, 18 Jan 2023 14:28:32 -0800 (PST) X-Google-Smtp-Source: AMrXdXsoQq68jKK7u65qeeB3i4aGkkAZKs/P7kyn+Wke1a4ZbXPzTgGy7aRaprIB7wn3V3redbVB X-Received: by 2002:a17:907:76ac:b0:857:1e36:3b7b with SMTP id jw12-20020a17090776ac00b008571e363b7bmr8181037ejc.11.1674080912386; Wed, 18 Jan 2023 14:28:32 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1674080912; cv=none; d=google.com; s=arc-20160816; b=qVl6uT5BuueDDq7xOHH3dWBFTLX5Jy8YGZjakPId+jaqsX/0ZcgQ4dReKAkYNChNiS UtmgeEBs7sN1901UvIRR0T9JIlXo3VZv3k1ly2wAQHBsCxS07lk9JSrYtbstPdehLpx7 C2h+H5P/IRw/p2LwJhhScd3kRaIO7yoPGbdG3dlYLxUTEp1lrZ+7pgEdqZ7ZUuzdMdpB C0CA3W3SJ4b8XZ9qoL5Y2oJwgXgCLa0gvup6QpBCk3YDR7Nm5/W5YeC8TwqwNT73UeHN h2uHUgotbrXZCT6qp2yvOcLJhCvs+XyVEGxGkHmsZtFPZNPm+4A6DsYHzvJwrqgim48m P7IA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:subject:cc:to:from:date :dkim-signature; bh=mf0W2iHkEIO2f8dmPTff0HXGLPW3azJ2y4nguCLcbFY=; b=VeFp6QgPJ2vZERKHPnWe33quNNhGhJ42ehvd0zRBHgj4/wCbDqtcrZR4AhpOJrN04D 4KC5CfGBpl6jNw5KLqL9m0l8hz00vg+6IYdBEgIPH5DkWcE3CxYmSVhujQ8XYXa57wQl U3OPg1P+AGje1MgiktszksmdcZrY+p76Z3T9SZOGsc1CB5CdWSOZZ3ZJN7Ul1+iWXsPK 8XQwRjX4Z5AhHaMQKNQgvoVRE7IMs4P4Q+9B401iabsbZ891F+Twp3I25btV1i9MRV1/ wcyUqgaKHyXQ64qgg3SyUup503lnVvZxe3wlFu6HQm6ZPjDUkTEpUYoO5l/F21CvJFmR 4gbw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linux-foundation.org header.s=korg header.b=1wseDJaW; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id di4-20020a170906730400b007ae814af6aasi15299474ejc.87.2023.01.18.14.28.21; Wed, 18 Jan 2023 14:28:32 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@linux-foundation.org header.s=korg header.b=1wseDJaW; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229492AbjARWKm (ORCPT + 44 others); Wed, 18 Jan 2023 17:10:42 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:55358 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229626AbjARWKk (ORCPT ); Wed, 18 Jan 2023 17:10:40 -0500 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 539B56309E for ; Wed, 18 Jan 2023 14:10:39 -0800 (PST) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id D516E61A30 for ; Wed, 18 Jan 2023 22:10:38 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 0D299C433EF; Wed, 18 Jan 2023 22:10:37 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linux-foundation.org; s=korg; t=1674079838; bh=ueXijbmlVWlIGrmmQBHyx5f7RsmjeluYmLaqFHXUtSw=; h=Date:From:To:Cc:Subject:In-Reply-To:References:From; b=1wseDJaWiRCEW5j/92bmCxmg+D0Y02g3H9KMmX3ipF8BgSxn1AQewK+nrcIoqY/hh 5YAyXeNk/IWkD35xe+vRqxqFX7GIGAmPFWE6vziQYexkLTD74qoj3ua3qDhGYrGtVv LUcyfTwMhC3vENTljiMSId6BwUXdifFzJvxaB168= Date: Wed, 18 Jan 2023 14:10:37 -0800 From: Andrew Morton To: "Herton R. Krzesinski" Cc: linux-kernel@vger.kernel.org, vbabka@suse.cz, jforbes@redhat.com, dzickus@redhat.com, scweaver@redhat.com Subject: Re: [PATCH] tools/vm: allow users to provide additional cflags/ldflags Message-Id: <20230118141037.3d5e6df707125353435bfbae@linux-foundation.org> In-Reply-To: References: <20230116224921.4106324-1-herton@redhat.com> <20230117165326.3e693a12a45a1962ca0c40af@linux-foundation.org> X-Mailer: Sylpheed 3.8.0beta1 (GTK+ 2.24.33; x86_64-pc-linux-gnu) Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit X-Spam-Status: No, score=-7.2 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,NICE_REPLY_A,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed, 18 Jan 2023 10:47:21 -0300 "Herton R. Krzesinski" wrote: > On Tue, Jan 17, 2023 at 04:53:26PM -0800, Andrew Morton wrote: > > On Mon, 16 Jan 2023 19:49:21 -0300 "Herton R. Krzesinski" wrote: > > > > > Right now there is no way to provide additional cflags/ldflags when > > > building tools/vm binaries. And using eg. make CFLAGS= will > > > override the CFLAGS being set in the Makefile, making the build fail > > > since it requires the include of the ../lib dir (for libapi). > > > > > > This change then allows you to specify: > > > CFLAGS= LDFLAGS= make V=1 -C tools/vm > > > > > > And the options will be correctly appended as can be seen from the > > > make output. > > > > > > ... > > > > > > --- a/tools/vm/Makefile > > > +++ b/tools/vm/Makefile > > > @@ -8,8 +8,8 @@ TARGETS=page-types slabinfo page_owner_sort > > > LIB_DIR = ../lib/api > > > LIBS = $(LIB_DIR)/libapi.a > > > > > > -CFLAGS = -Wall -Wextra -I../lib/ > > > -LDFLAGS = $(LIBS) > > > +CFLAGS += -Wall -Wextra -I../lib/ > > > +LDFLAGS += $(LIBS) > > > > > > > I think EXTRA_CFLAGS is more conventional? > > > > I was looking and there is no standard under tools/ > > Some use it, some not. To given an example of what uses CFLAGS: > tools/arch/x86/kcpuid/Makefile:override CFLAGS += -O2 -Wall -I../../../include > tools/arch/x86/intel_sdsi/Makefile:override CFLAGS += -O2 -Wall > tools/iio/Makefile:override CFLAGS += -O2 -Wall -g -D_GNU_SOURCE -I$(OUTPUT)include > tools/thermal/tmon/Makefile:override CFLAGS += $(shell $(PKG_CONFIG) --cflags $(STATIC) panelw ncursesw 2> /dev/null || \ > tools/gpio/Makefile:override CFLAGS += -O2 -Wall -g -D_GNU_SOURCE -I$(OUTPUT)include > tools/pci/Makefile:CFLAGS += -O2 -Wall -g -D_GNU_SOURCE -I$(OUTPUT)include > tools/spi/Makefile:CFLAGS += -O2 -Wall -g -D_GNU_SOURCE -I$(OUTPUT)include > tools/wmi/Makefile:CFLAGS += -D__EXPORTED_HEADERS__ -I../../include/uapi -I../../include > tools/io_uring/Makefile:CFLAGS += -Wall -Wextra -g -D_GNU_SOURCE > tools/counter/Makefile:override CFLAGS += -O2 -Wall -g -D_GNU_SOURCE -I$(OUTPUT)include > > I can however use EXTRA_CFLAGS, not a problem, eg. doing instead: > CFLAGS = -Wall -Wextra -I../lib/ $(EXTRA_CFLAGS) > LDFLAGS = $(LIBS) $(EXTRA_LDFLAGS) > > Let me know and I'll resend the patch using EXTRA_* instead. Well drat, I was hoping you'd decide ;) I'll grab it as-is, thanks. (of course, we could always use both!)