Skip to contentSkip to conversation

building individual files in subdirectories

DISCUSSION Christoph Hellwig 3 participants 4 messages May 28, 2019 – Nov 18, 2019 Kbuild

lore
Share & tools
lore
#0 lore raw

A few kernel modules have source files in multiple subdirectories. Trying to build just a single object of a source file in such a subdirectory currently doesn't work.

For example:

hch@brick:~/work/xfs$ make fs/xfs/libxfs/xfs_alloc.o
  CALL    scripts/checksyscalls.sh
  CALL    scripts/atomic/check-atomics.sh
  DESCEND  objtool
scripts/Makefile.build:42: fs/xfs/libxfs/Makefile: No such file or directory
make[1]: *** No rule to make target 'fs/xfs/libxfs/Makefile'.  Stop.
make: *** [Makefile:1747: fs/xfs/libxfs/xfs_alloc.o] Error 2

Is there any reasonably easy way to get this to work?

#1 lore raw
Quoted 15 lines · Christoph Hellwig

A few kernel modules have source files in multiple subdirectories. Trying to build just a single object of a source file in such a subdirectory currently doesn't work.

For example:

hch@brick:~/work/xfs$ make fs/xfs/libxfs/xfs_alloc.o
  CALL    scripts/checksyscalls.sh
  CALL    scripts/atomic/check-atomics.sh
  DESCEND  objtool
scripts/Makefile.build:42: fs/xfs/libxfs/Makefile: No such file or directory
make[1]: *** No rule to make target 'fs/xfs/libxfs/Makefile'.  Stop.
make: *** [Makefile:1747: fs/xfs/libxfs/xfs_alloc.o] Error 2
Quoted 1 line

Is there any reasonably easy way to get this to work?

While single targets are useful,
they never work correctly.
subdir-ccflags-y from upper Makefiles
are not inherited.

I want to implement single targets correctly, but
I have never got around to it.

"make fs/xfs/" is an alternative solution
although it will compile much more than you want.

Another solution is to put a dummy
fs/xfs/libxfs/Makefile

Signature · 2 lines
Best Regards
Masahiro Yamada
#2 lore raw

Hi Jens,

(related to https://lkml.org/lkml/2019/11/15/1152)

I received questions about single builds not working properly some times in the past.

For example, the following is a post from Christoph to kbuild ML, and my reply to it.

Quoted 37 lines · Masahiro Yamada
Quoted 15 lines · Christoph Hellwig

A few kernel modules have source files in multiple subdirectories. Trying to build just a single object of a source file in such a subdirectory currently doesn't work.

For example:

hch@brick:~/work/xfs$ make fs/xfs/libxfs/xfs_alloc.o
  CALL    scripts/checksyscalls.sh
  CALL    scripts/atomic/check-atomics.sh
  DESCEND  objtool
scripts/Makefile.build:42: fs/xfs/libxfs/Makefile: No such file or directory
make[1]: *** No rule to make target 'fs/xfs/libxfs/Makefile'.  Stop.
make: *** [Makefile:1747: fs/xfs/libxfs/xfs_alloc.o] Error 2
Quoted 1 line

Is there any reasonably easy way to get this to work?

While single targets are useful,
they never work correctly.
subdir-ccflags-y from upper Makefiles
are not inherited.

I want to implement single targets correctly, but
I have never got around to it.

"make fs/xfs/" is an alternative solution
although it will compile much more than you want.

Another solution is to put a dummy
fs/xfs/libxfs/Makefile

--
Best Regards
Masahiro Yamada

Signature · 2 lines
Best Regards
Masahiro Yamada
#3 lore raw
Quoted 11 lines · Masahiro Yamada

Hi Jens,

(related to https://lkml.org/lkml/2019/11/15/1152)

I received questions about single builds not working properly some times in the past.

For example, the following is a post from Christoph to kbuild ML, and my reply to it.

I'm not saying it isn't useful, what I'm saying is that slowing things down by almost 100% seems excessive!

Signature · 1 line
Jens Axboe