Received: by 2002:a05:6358:a55:b0:ec:fcf4:3ecf with SMTP id 21csp6534531rwb; Wed, 18 Jan 2023 06:26:30 -0800 (PST) X-Google-Smtp-Source: AMrXdXsYYvJq1KlAWfLWPc6Wydz4h7QFlA82gPDC0trI7qhdLsxpDIpWhE/87o9jRWA31o71iyo8 X-Received: by 2002:a17:902:8208:b0:193:f76:aed4 with SMTP id x8-20020a170902820800b001930f76aed4mr7369792pln.1.1674051989973; Wed, 18 Jan 2023 06:26:29 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1674051989; cv=none; d=google.com; s=arc-20160816; b=gkI+Q8SOl66Jr5JDllfIkEBx9U4VbEqNVQAt+KL4c6uFmzBcYW11HNvSy3B4V2IvJa wgS9zGDlClBup9l2K3i+CedM4jIjEnrjPE4j9e/lUnlonSXEKFBh28anCcNKubznTpui jsX9l3IFRdJqqfINOi1D0aPI4Qmi+fZPiAdb8qXh7nNbqjoy16EKMcu2a94qy9h50dM8 nf2MEMNftiAEoz4pXNmm3qcgFlkQ+RGXvqwQwZ2hctPglx2qzR1Cl+Qiy48k6T7jgTw0 OgvW1409xHnU+qOZauEr0Xn+mdPoDx2jb1WzUqd63u6rZx5ufEdjBw2+7jM0EvNMIG3e GZjg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature; bh=EX/Tj/K8IZPZvmA1JVHcAukrm9j71qlU1wmRRs9hAGU=; b=HE+0AKqzQLCzF7p5b0rGy7cK0vbqJTsJoUpmT+LUjyQJjEyg9tFU39qxFhsXQdYfVY ZwAFijLPrdryoKF/op/4w4TrbhHu+YC1rWDBcjh97DMW5JPszGeRxEVpj6pfgBOSCcLT f2IQAvH8nurVuEE6K7yGXS8Mi0K0bCDkh2Op2/j/FQCqPhSHV6sKjRu9gge3mH2i0+Ka ReLQc1J+ASWcyJtGNrTMh6UQQ4BjkxyxV7mXxKHKEYKd1Kte3cNy8hett3xMa3ZYHLxe 81EL0yLn1gd1zyyWEQbk5SOJ6+FvXnJH+kZr41fchm0waveGmb4E65mGDfWMgD+xT3bf svEg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=Oiz49nBw; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id i15-20020a17090332cf00b00189c10f6b4csi39440408plr.417.2023.01.18.06.26.18; Wed, 18 Jan 2023 06:26:29 -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=@redhat.com header.s=mimecast20190719 header.b=Oiz49nBw; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230286AbjAROKg (ORCPT + 45 others); Wed, 18 Jan 2023 09:10:36 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:39246 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230076AbjAROJT (ORCPT ); Wed, 18 Jan 2023 09:09:19 -0500 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id C7FA64FC25 for ; Wed, 18 Jan 2023 05:47:29 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1674049648; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=EX/Tj/K8IZPZvmA1JVHcAukrm9j71qlU1wmRRs9hAGU=; b=Oiz49nBwd3BapkCgkCqm/WJXDM5cb2rt8iJWXV8BxXQHjtoHSBt0up0Or52rguK6g8ISJn WS88+MGNHchZR894jusbdRNb7HOkCVAr3PQCtVdfotVet/3Khs0tIA5BfL1QIRzp0kf+Oy zA6cVM/25lGS2WJF5GwoCY3Iy99+p7g= Received: from mimecast-mx02.redhat.com (mx3-rdu2.redhat.com [66.187.233.73]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-587-SP44ch0FOlCNIFY0o2ZuYA-1; Wed, 18 Jan 2023 08:47:24 -0500 X-MC-Unique: SP44ch0FOlCNIFY0o2ZuYA-1 Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.rdu2.redhat.com [10.11.54.3]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 51BE929AB44B; Wed, 18 Jan 2023 13:47:24 +0000 (UTC) Received: from redhat.com (ovpn-116-89.gru2.redhat.com [10.97.116.89]) by smtp.corp.redhat.com (Postfix) with ESMTP id 904641121315; Wed, 18 Jan 2023 13:47:23 +0000 (UTC) Date: Wed, 18 Jan 2023 10:47:21 -0300 From: "Herton R. Krzesinski" To: Andrew Morton 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: References: <20230116224921.4106324-1-herton@redhat.com> <20230117165326.3e693a12a45a1962ca0c40af@linux-foundation.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20230117165326.3e693a12a45a1962ca0c40af@linux-foundation.org> X-Scanned-By: MIMEDefang 3.1 on 10.11.54.3 X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_NONE, RCVD_IN_MSPIKE_H2,SPF_HELO_NONE,SPF_NONE 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 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. -- []'s Herton