public inbox for linux-kselftest@vger.kernel.org
 help / color / mirror / Atom feed
From: Muhammad Usama Anjum <usama.anjum@collabora.com>
To: Masahiro Yamada <masahiroy@kernel.org>, Shuah Khan <shuah@kernel.org>
Cc: usama.anjum@collabora.com, Michal Marek <michal.lkml@markovi.net>,
	Nick Desaulniers <ndesaulniers@google.com>,
	kernel@collabora.com, kernelci@groups.io,
	"open list:KERNEL SELFTEST FRAMEWORK" 
	<linux-kselftest@vger.kernel.org>,
	Kees Cook <keescook@chromium.org>,
	Linux Kbuild mailing list <linux-kbuild@vger.kernel.org>,
	Linux Kernel Mailing List <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH] Makefile: Fix separate output directory build of kselftests
Date: Mon, 4 Apr 2022 16:09:57 +0500	[thread overview]
Message-ID: <d10a70cf-24a5-997a-09df-0bb2f4146b86@collabora.com> (raw)
In-Reply-To: <CAK7LNATkTPEBPWBSv6Rum0siHiHcJ0Q7VvPVoUQFH=S0M1fqow@mail.gmail.com>

From [Makefile](https://elixir.bootlin.com/linux/latest/source/Makefile):
```
ifeq ($(abs_srctree),$(abs_objtree))
        # building in the source tree
        srctree := .
	building_out_of_srctree :=
else
        ifeq ($(abs_srctree)/,$(dir $(abs_objtree)))
                # building in a subdirectory of the source tree
                srctree := ..
        else
                srctree := $(abs_srctree)
        endif
	building_out_of_srctree := 1
endif
```
`ifeq ($(abs_srctree)/,$(dir $(abs_objtree)))` condition is setting
`srctree` to `..`. This is wrong. This condition isn't considering that
`header_install` doesn't depend on `abs_srctree and abs_objtree`. This
condition needs to be tweaked or removed for the `install_headers` to
work fine and fix this issue. I've added `KBUILD_ABS_SRCTREE=1` to the
kselftest target which sets the `srctree` to `abs_srctree` and thus
forcefully affecting only kselftest targets. This seems like the clean
fix. Alternatively we should remove this condition `ifeq
($(abs_srctree)/,$(dir $(abs_objtree)))` but it'll affect other targets
as well.

Complete details of investigation can be found here:
https://github.com/kernelci/kernelci-project/issues/92#issuecomment-1087406222

On 3/17/22 11:08 PM, Masahiro Yamada wrote:
> On Thu, Mar 17, 2022 at 7:49 PM Muhammad Usama Anjum
> <usama.anjum@collabora.com> wrote:
>>
>> Reminder. Shuah is okay with this patch. Any thoughts?
> 
> I do not think this is the right fix,
> but something you just happen to find working.
> 
> 
> The Make is working in a wrong directory, that is why
> the relative path does not work
> (and you use the absolute path to work around it)
> 
`ifeq ($(abs_srctree)/,$(dir $(abs_objtree))) \ srctree := ..` has
broken the `make headers_install` when called through
selftests/Makefile. We can remove it or use the absolute path each time.

-- 
Muhammad Usama Anjum

  reply	other threads:[~2022-04-04 11:10 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-02-23 19:10 [PATCH] Makefile: Fix separate output directory build of kselftests Muhammad Usama Anjum
2022-03-03 18:06 ` Muhammad Usama Anjum
2022-03-03 21:32 ` Shuah Khan
2022-03-08  8:11   ` Muhammad Usama Anjum
2022-03-08 21:19     ` Shuah Khan
2022-03-10 17:06       ` Muhammad Usama Anjum
2022-03-17 10:48 ` Muhammad Usama Anjum
2022-03-17 18:08   ` Masahiro Yamada
2022-04-04 11:09     ` Muhammad Usama Anjum [this message]
2022-04-14 11:10       ` Muhammad Usama Anjum

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=d10a70cf-24a5-997a-09df-0bb2f4146b86@collabora.com \
    --to=usama.anjum@collabora.com \
    --cc=keescook@chromium.org \
    --cc=kernel@collabora.com \
    --cc=kernelci@groups.io \
    --cc=linux-kbuild@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-kselftest@vger.kernel.org \
    --cc=masahiroy@kernel.org \
    --cc=michal.lkml@markovi.net \
    --cc=ndesaulniers@google.com \
    --cc=shuah@kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox