Download your favorite Linux distribution at LQ ISO.
Go Back > Forums > Linux Forums > Linux - Software > Linux - Kernel
User Name
Linux - Kernel This forum is for all discussion relating to the Linux kernel.


  Search this Thread
Old 02-06-2023, 09:47 PM   #1
LQ Newbie
Registered: Feb 2023
Posts: 5

Rep: Reputation: 0
where is the rule to build a $(obj)/% target in linux kernel makefile?

In linux kernel

# To build objects in subdirs, we need to descend into the directories
$(subdir-builtin): $(obj)/%/built-in.a: $(obj)/% ;
$(subdir-modorder): $(obj)/%/modules.order: $(obj)/% ;`

the $(obj)/subdir/built-in.a depends on $(obj)/subdir prereq, but where is the rule to build $(obj)/subdir?

I assume the following rule is only for $(obj)/ directory, and can't apply for the above subdir.

# Build
# ---------------------------------------------------------------------------

$(obj)/: $(if $(KBUILD_BUILTIN), $(targets-for-builtin)) \
$(if $(KBUILD_MODULES), $(targets-for-modules)) \
$(subdir-ym) $(always-y)

Old 02-07-2023, 08:36 AM   #2
LQ Newbie
Registered: Feb 2023
Posts: 5

Original Poster
Rep: Reputation: 0
I already got the answer from a Linux kernel maintainer, as below:

See around line 500.

$(Q)$(MAKE) $(build)=$@ \
need-builtin=$(if $(filter $@/built-in.a, $(subdir-builtin)),1) \
need-modorder=$(if $(filter $@/modules.order, $(subdir-modorder)),1) \
$(filter $@/%, $(single-subdir-goals))


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
what is exact meaning of "obj-m = *.o" in kernel module Makefile Bhoomil Linux - Kernel 1 10-03-2013 04:55 PM
iptables: rule with RETURN target just after a rule with ACCEPT target Nerox Linux - Networking 6 09-04-2011 03:33 PM
[SOLVED] C++ - Two-way Communication between objects if A (obj) creates an instance of B (obj) Gavin Harper Programming 5 04-06-2011 05:27 AM
any difference between "const myClass &obj" and "myClass const &obj"? parv Programming 9 01-09-2008 08:58 AM
obj-y in kernel 2.6 makefile creating problem. raklo Linux - Kernel 0 02-08-2007 12:00 AM > Forums > Linux Forums > Linux - Software > Linux - Kernel

All times are GMT -5. The time now is 12:02 PM.

Main Menu
Write for LQ is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration