[PATCH] drm/radeon: Add build directory to include path

Michel Dänzer michel.daenzer at mailbox.org
Thu Apr 14 16:57:18 UTC 2022


On 2022-04-14 17:04, Masahiro Yamada wrote:
> On Thu, Apr 14, 2022 at 10:50 PM Michel Dänzer
> <michel.daenzer at mailbox.org> wrote:
>> On 2022-04-14 15:34, Alex Deucher wrote:
>>> On Thu, Apr 14, 2022 at 4:44 AM Christian König
>>> <ckoenig.leichtzumerken at gmail.com> wrote:
>>>> Am 14.04.22 um 09:37 schrieb Michel Dänzer:
>>>>> On 2022-04-14 08:24, Christian König wrote:
>>>>>> Am 13.04.22 um 18:14 schrieb Michel Dänzer:
>>>>>>> From: Michel Dänzer <mdaenzer at redhat.com>
>>>>>>>
>>>>>>> Fixes compile errors with out-of-tree builds, e.g.
>>>>>>>
>>>>>>> ../drivers/gpu/drm/radeon/r420.c:38:10: fatal error: r420_reg_safe.h: No such file or directory
>>>>>>>      38 | #include "r420_reg_safe.h"
>>>>>>>         |          ^~~~~~~~~~~~~~~~~
>>>>>>
>>>>>> Well stuff like that usually points to a broken build environment.
>>>>> Just a separate build directory. Specifically, I'm hitting the errors with
>>>>>
>>>>>   make -C build-amd64 M=drivers/gpu/drm
> 
> 
> Maybe
> 
>         make  O=build-arm64   drivers/gpu/drm/
> 
> is the way you were searching for.
> 
> It builds only drivers/gpu/drm/
> in the separate directory.

Indeed, that works.


>>>>> Generated headers such as r420_reg_safe.h reside in the build directory, so source files in the source directory can't find them without an explicit search path.
>>>>
>>>> I'm trying to swap back into my brain how all of this used to work, but
>>>> that's a really long time ago that I tried this as well.
>>>>
>>>>> Are you saying that should get added automagically somehow?
> 
> 
> For the kernel tree, yes, it is done automatically.
> 
> See the code in scripts/Makefile.lib:
> 
> # $(srctree)/$(src) for including checkin headers from generated source files
> # $(objtree)/$(obj) for including generated headers from checkin source files
> ifeq ($(KBUILD_EXTMOD),)
> ifdef building_out_of_srctree
> _c_flags   += -I $(srctree)/$(src) -I $(objtree)/$(obj)
> _a_flags   += -I $(srctree)/$(src) -I $(objtree)/$(obj)
> _cpp_flags += -I $(srctree)/$(src) -I $(objtree)/$(obj)
> endif
> endif
> 
> 
> 
> 
> But, you used M=drivers/gpu/drm.
> So, it did not work.
> 
> 
> 
> M= is intended for building external modules.
> 
> I do not recommend it for in-tree drivers.

So I've been doing it wrong for all these years... Happened to always work for in-tree builds.

Thank you so much for your help, Yamada-san!

I am retracting this patch.


-- 
Earthling Michel Dänzer            |                  https://redhat.com
Libre software enthusiast          |         Mesa and Xwayland developer


More information about the dri-devel mailing list