Received: by 2002:a25:ab43:0:0:0:0:0 with SMTP id u61csp2362838ybi; Thu, 20 Jun 2019 13:49:09 -0700 (PDT) X-Google-Smtp-Source: APXvYqzl/LXUmSVhvDQ/HAYXynkRGc35h9f61PSRRmiv00VrrDDrRlWTT4MC8o5nDDfGH1lCiPcU X-Received: by 2002:a17:902:e211:: with SMTP id ce17mr45128184plb.193.1561063749797; Thu, 20 Jun 2019 13:49:09 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1561063749; cv=none; d=google.com; s=arc-20160816; b=igzszfeUmqe1kuNT/WyXTDSq3khaCkl/QUcHhmVNws0VMlb8CMiTTjy4eddbPdg2qE VjCgLaYwKvbV61qYifotrQIwEbfff2K5JHfarLvV4RYPwWx7nHeq/or599R+0BAjORvg ar2hFULQN7tUKqUf0Gj+3JXkVwErQxPzj71KeE67hOH74YeEX+6Q+XjolbmjLiUYvyRx DYJrAOOdIKa8XKvAx3/BuXaziLoLVwRaejCm6rTn6fCdcPoCQM7VYKY5eVkavW+HMRvQ Zm49w89sQY7DRvkBhVLQyqcd/zANS7J5ywziqYUD6TypvcXRa8j0x6aQMpEnvUrIQ1xc pA1g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date:dkim-signature; bh=O7l+Vz8Z+P5e/XZWrPOY5NRWsmIcQSKPNpkfC3vTPbA=; b=0G3KlTkZb40uyyFTPFcIsqwn0jGPkIKHeQ5HfmUnjSmzhn8crxF2QtEuAW37iV6UvS /LN3hqMLv+KsCNlbHzJy+teiu4IWJxe46b2nx+guG0s9lCCWriXeXqtoQ+S+qgc4giUW 2+ReNPz454X5VD34mg4tCbP/HhTsK3HLGjGs8IvTdm9UX8pavPVEQolyP0pkfxlJd9sd 1NL32+0zmInwePLgkPc4Wc6kzQrrJLEFwKkNT7EZ+dGeT4Y+gMgfpjTYkXwJ9f2l7G13 9g2ZZlZ6tIRs7HdPqIpVdZGDz8iftfLqJJV44VHOJSlmMv/ypsrQwXp6QjISBiqasE/4 G/aQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@chromium.org header.s=google header.b=LPdPtGZm; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=chromium.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id c13si509875pgm.140.2019.06.20.13.48.54; Thu, 20 Jun 2019 13:49:09 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@chromium.org header.s=google header.b=LPdPtGZm; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=chromium.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726203AbfFTUrE (ORCPT + 99 others); Thu, 20 Jun 2019 16:47:04 -0400 Received: from mail-pg1-f193.google.com ([209.85.215.193]:45976 "EHLO mail-pg1-f193.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725913AbfFTUrE (ORCPT ); Thu, 20 Jun 2019 16:47:04 -0400 Received: by mail-pg1-f193.google.com with SMTP id k35so547790pgm.12 for ; Thu, 20 Jun 2019 13:47:04 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to:user-agent; bh=O7l+Vz8Z+P5e/XZWrPOY5NRWsmIcQSKPNpkfC3vTPbA=; b=LPdPtGZm3Cn4AH88lhL8O5Q3ngb9omPQ6UlcQz+FUPIDjiuAqz0J341JuPnNaUYkSQ /2WDq945SjNbhP0UH69dhcavWBJUFj1jh+R5LOnEc7xa2Rsfh3bWsYu5uurPZzBwV32R Wie2iQCTYHkHjSE7VCDn6rzndnvldaDH5+Hvc= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to:user-agent; bh=O7l+Vz8Z+P5e/XZWrPOY5NRWsmIcQSKPNpkfC3vTPbA=; b=P1PplnCfneL5e2hbNZcAZhVLb7B0OVaf3tntClZpnrO/zegJK+fxActrRU0p2HB8B2 69DobWsKaDI3qEVma0ZLMMTyvC697vvxgWf2abTzJgJDWL+yA+m9hQNiGiGkWiBszNi2 lopTVD8cBbEillYJ8CRNCf2Woc3RWRK77rkJ4YnDtpcYuZGvlfrJnWZVhjLoQZJE+vOP CQkknQPl8rErl8OtkezzilTIckce+S9L2I3uB3wgbyE1LtP+iMO6OfxTfkD5tu6+Kiio UfIWOzhFAvIfW6B4qG87AOHli8GSiBs0/Pwb/1EPfXxWy2mlvQ5rvfCx2+oBI7LwtSDQ BMew== X-Gm-Message-State: APjAAAX+ifM4XckOzIBBaoR3IOpyOd685RokCihdbDG3unJJWjm1uAZB PcobcHDzFqPzHNsvGac78KMaIA== X-Received: by 2002:a17:90a:ac11:: with SMTP id o17mr1639575pjq.134.1561063623898; Thu, 20 Jun 2019 13:47:03 -0700 (PDT) Received: from localhost ([2620:15c:202:1:75a:3f6e:21d:9374]) by smtp.gmail.com with ESMTPSA id f15sm564455pje.17.2019.06.20.13.47.03 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 20 Jun 2019 13:47:03 -0700 (PDT) Date: Thu, 20 Jun 2019 13:47:01 -0700 From: Matthias Kaehlcke To: Tom Roeder Cc: Masahiro Yamada , linux-kernel@vger.kernel.org, Raul E Rangel , Nick Desaulniers , Tom Hughes , Douglas Anderson , Ryan Case , Yu Liu Subject: Re: [PATCH] gen_compile_command: Add support for separate KBUILD_OUTPUT directory Message-ID: <20190620204701.GX137143@google.com> References: <20190620184523.155756-1-mka@chromium.org> <20190620192345.GA133204@google.com> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline In-Reply-To: <20190620192345.GA133204@google.com> User-Agent: Mutt/1.10.1 (2018-07-13) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu, Jun 20, 2019 at 12:23:45PM -0700, Tom Roeder wrote: > I can confirm that I can still run clang-tidy on the kernel using this > new version of the script; it generates a version of > compile_commands.json that works in my case. > > On Thu, Jun 20, 2019 at 11:45:23AM -0700, Matthias Kaehlcke wrote: > > gen_compile_command.py currently assumes that the .cmd files and the > > source code live in the same directory, which is not the case when > > a separate KBUILD_OUTPUT directory is used. > > > > Add a new option to specify the kbuild output directory. If the > > option is not set the kernel source directory is used. > > > > Signed-off-by: Matthias Kaehlcke > Reviewed-by: Tom Roeder > Tested-by: Tom Roeder Thanks! > > scripts/gen_compile_commands.py | 28 +++++++++++++++++++--------- > > 1 file changed, 19 insertions(+), 9 deletions(-) > > > > diff --git a/scripts/gen_compile_commands.py b/scripts/gen_compile_commands.py > > index 7915823b92a5..5a738ec66cc7 100755 > > --- a/scripts/gen_compile_commands.py > > +++ b/scripts/gen_compile_commands.py > > @@ -31,15 +31,21 @@ def parse_arguments(): > > > > Returns: > > log_level: A logging level to filter log output. > > - directory: The directory to search for .cmd files. > > + source_directory: The kernel source directory. > > + kbuild_output_directory: The directory to search for .cmd files. > > output: Where to write the compile-commands JSON file. > > """ > > usage = 'Creates a compile_commands.json database from kernel .cmd files' > > parser = argparse.ArgumentParser(description=usage) > > > > - directory_help = ('Path to the kernel source directory to search ' > > + directory_help = ('Path to the kernel source directory' > Minor detail: this needs a space after "directory" so that it reads > "directory '". Otherwise, the output doesn't have a space before the > parenthesis. > > > '(defaults to the working directory)') > > parser.add_argument('-d', '--directory', type=str, help=directory_help) > > + kbuild_output_directory_help = ('Path to the directory to search for ' > > + '.cmd files' > Same comment here: this should be "files '", with a space before the > ending quote character. Ok, I'll wait a bit for it there are other comments and send out a new version with the spaces added.