Message ID | cover.1708478591.git.ehem+linux@m5p.com (mailing list archive) |
---|---|
Headers | show |
Series | Adding trailing slash to $(srctree) | expand |
On Thu, Feb 22, 2024 at 8:16 AM Elliott Mitchell <ehem+linux@m5p.com> wrote: > > The subject states exactly what I'm suggesting. > > The reason is the fallback value for $(srctree) of "." doesn't work > properly in several places under some conditions. In particular in > several places a pattern of "$(srctree)/$(src)" is used. If $(srctree) > ends up with the value "." and $(src) ends up with the value `pwd`, the > build breaks. This can be triggered via in-tree/out-of-tree build > mechanisms. I really do not understand what you are trying to achieve, but this is just about "Do not try to build upstream drivers with M=". If you hack it, it is what you should do locally. > As such, assuming $(srctree) includes the trailing slash and setting > the fallback for $(srctree) to "" fixes things. This is untested, I'm > proposing this since I wanted to use a build approach which triggers > this. This is really a single patch, but it has been split into 3 to > emphasize where the real work is done. > > I'm suspicious of the fallback settings of $(srctree) found in several > Makefiles. This might be a distinct workaround for the same situation. > I was wondering about adjusting some of those comments too. I think > $(src) needs similar treatment, but that is rather messier. > > Note, this is basically untested. I'm hopeful this actually works, but > if it breaks then this was mostly to alert the maintainers of this > troublesome condition. > > > Elliott Mitchell (3): > build: add trailing slash to $(srctree) > build: modify uses of $(srctree) to assume trailing slash > build: change $(srctree) to empty for current directory > -- Best Regards Masahiro Yamada
On Thu, Feb 22, 2024 at 01:38:36PM +0900, Masahiro Yamada wrote: > On Thu, Feb 22, 2024 at 8:16 AM Elliott Mitchell <ehem+linux@m5p.com> wrote: > > > > The subject states exactly what I'm suggesting. > > > > The reason is the fallback value for $(srctree) of "." doesn't work > > properly in several places under some conditions. In particular in > > several places a pattern of "$(srctree)/$(src)" is used. If $(srctree) > > ends up with the value "." and $(src) ends up with the value `pwd`, the > > build breaks. This can be triggered via in-tree/out-of-tree build > > mechanisms. > > > I really do not understand what you are trying to achieve, > but this is just about > "Do not try to build upstream drivers with M=". > > > If you hack it, it is what you should do locally. I think it is acceptable to state this usage of the build system is unsupported. This is not an acceptable reason to reject proposed patches. While this use of M= might be considered a hack, adjusting $(srctree) to include the trailing slash is entirely appropriate. Everything which worked before still works and more situations now work. This also slightly shrinks the Makefiles. Notice 306 Makefiles (excluding the top-level) reference $(srctree). Of those 26 include the construct which appears to be working around this problem. So 8.5% of Makefiles work around this problem, which seems a pretty good hint the feature is desired. This doesn't account for Makefiles which had such during development, but was removed before submission. This also doesn't account for ones which had it removed after being brought into the Linux source tree. The differences between implementations suggest it might have been independently implemented as many as 3-4 times. That seems a good hint this is desired by a notable percentage of developers. In other news, examination of tools/testing/selftests/nolibc/Makefile suggests $(objtree) needs similar treatment.