kbuild: add %/built-in.o target in top Makefile
PATCH 1/1 kbuild: add %/built-in.o target in top Makefile
Current kbuild just supports building built-in.o in second directory level individually. There is no rule to build those built-in.o targets below third directory level.
Even current kbuild system could achieve this with rule "%/", while this not only builds built-in targes but also lib target, extra target and module objects.
This patch adds the "%/built-in.o" rule so that each built-in.o in the kernel tree could be the build target, which looks more consistent for the kbuild system.
--- Makefile | 2 ++ 1 file changed, 2 insertions(+)
Makefile +2 -0
@@ -1627,6 +1627,8 @@ endif $(Q)$(MAKE) $(build)=$(build-dir) $(target-dir)$(notdir $@) %.symtypes: %.c prepare scripts FORCE $(Q)$(MAKE) $(build)=$(build-dir) $(target-dir)$(notdir $@) +%/built-in.o: prepare scripts + $(Q)$(MAKE) $(build)=$(build-dir) $(target-dir)$(notdir $@) # Modules /: prepare scripts FORCE
Signature · 1 line
2.5.0
Hi, hope someone like this :-)
Quoted 32 lines · Wei Yang
Current kbuild just supports building built-in.o in second directory level individually. There is no rule to build those built-in.o targets below third directory level.
Even current kbuild system could achieve this with rule "%/", while this not only builds built-in targes but also lib target, extra target and module objects.
This patch adds the "%/built-in.o" rule so that each built-in.o in the kernel tree could be the build target, which looks more consistent for the kbuild system.
Signed-off-by Wei Yang <[email protected]>---
Makefile| 2 ++1 file changed, 2 insertions(+)Makefile +0
-0@@ -1627,6 +1627,8 @@ endif $(Q)$(MAKE) $(build)=$(build-dir) $(target-dir)$(notdir $@)%.symtypes: %.c prepare scripts FORCE
$(Q)$(MAKE) $(build)=$(build-dir) $(target-dir)$(notdir $@)+%/built-in.o: prepare scripts
Makefile +1
-0+ $(Q)$(MAKE) $(build)=$(build-dir) $(target-dir)$(notdir $@)# Modules
/: prepare scripts FORCESignature · 1 line
2.5.0
Signature · 2 lines
Wei Yang Help you, Help me
Makefile endif · line 1631
Quoted 10 lines · Wei Yang
Makefile +2
-0@@ -1627,6 +1627,8 @@ endif $(Q)$(MAKE) $(build)=$(build-dir) $(target-dir)$(notdir $@) %.symtypes: %.c prepare scripts FORCE $(Q)$(MAKE) $(build)=$(build-dir) $(target-dir)$(notdir $@) +%/built-in.o: prepare scripts + $(Q)$(MAKE) $(build)=$(build-dir) $(target-dir)$(notdir $@)
This rule gets in the way of
975 # The actual objects are generated when descending, 976 # make sure no implicit rule kicks in 977 $(sort $(vmlinux-deps)): $(vmlinux-dirs) ;
Quickly looking at the Makefile, it may be fine, but it needs to be confirmed. This also explains why the current behavior with */built-in.o is inconsistent.
Michal
Quoted 15 lines · Michal Marek
Makefile endif · line 1631
Quoted 10 lines · Wei Yang
Makefile +2
-0@@ -1627,6 +1627,8 @@ endif $(Q)$(MAKE) $(build)=$(build-dir) $(target-dir)$(notdir $@) %.symtypes: %.c prepare scripts FORCE $(Q)$(MAKE) $(build)=$(build-dir) $(target-dir)$(notdir $@) +%/built-in.o: prepare scripts + $(Q)$(MAKE) $(build)=$(build-dir) $(target-dir)$(notdir $@)This rule gets in the way of
Quoted 4 lines
975 # The actual objects are generated when descending, 976 # make sure no implicit rule kicks in 977 $(sort $(vmlinux-deps)): $(vmlinux-dirs) ;
Yes, second level built-in.o is built because of this rule, while for deeper level built-in.o we don't have a rule now. This patch is trying to add a rule for those deeper level built-in.o.
Quoted 4 lines
Quickly looking at the
Makefile, it may be fine, but it needs to be confirmed. This also explains why the current behavior with*/built-in.ois inconsistent.
Agree with you.
One of my concern is whether it is necessary to add "FORCE" to the prerequest. I have tried on my machine, it works fine without "FORCE", while maybe it won't work fine with some version of "make".
This is what I want to confirm. Any other potential issue, just let me know.
Thanks for your comment :-)
Quoted 1 line
Michal
Signature · 2 lines
Wei Yang Help you, Help me
PATCH v2 1/1 kbuild: add %/built-in.o target in top Makefile
In reply to Wei YangCurrent kbuild just supports building built-in.o in second directory level individually. There is no rule to build those built-in.o targets below third directory level.
Even current kbuild system could achieve this with rule "%/", while this not only builds built-in targes but also lib target, extra target and module objects.
This patch adds the "%/built-in.o" rule so that each built-in.o in the kernel tree could be the build target, which looks more consistent for the kbuild system.
---
v2
. add FORCE in prerequest
--- Makefile | 2 ++ 1 file changed, 2 insertions(+)
Makefile +2 -0
@@ -1638,6 +1638,8 @@ endif $(Q)$(MAKE) $(build)=$(build-dir) $(target-dir)$(notdir $@) %.symtypes: %.c prepare scripts FORCE $(Q)$(MAKE) $(build)=$(build-dir) $(target-dir)$(notdir $@) +%/built-in.o: prepare scripts FORCE + $(Q)$(MAKE) $(build)=$(build-dir) $(target-dir)$(notdir $@) # Modules /: prepare scripts FORCE
Signature · 1 line
2.5.0
Hi ~
Quoted 37 lines · Wei Yang
Current kbuild just supports building built-in.o in second directory level individually. There is no rule to build those built-in.o targets below third directory level.
Even current kbuild system could achieve this with rule "%/", while this not only builds built-in targes but also lib target, extra target and module objects.
This patch adds the "%/built-in.o" rule so that each built-in.o in the kernel tree could be the build target, which looks more consistent for the kbuild system.
Signed-off-by Wei Yang <[email protected]>---
v2
. add FORCE in prerequest---
Makefile| 2 ++1 file changed, 2 insertions(+)Makefile +0
-0@@ -1638,6 +1638,8 @@ endif $(Q)$(MAKE) $(build)=$(build-dir) $(target-dir)$(notdir $@)%.symtypes: %.c prepare scripts FORCE
$(Q)$(MAKE) $(build)=$(build-dir) $(target-dir)$(notdir $@)+%/built-in.o: prepare scripts FORCE
Makefile +1
-0+ $(Q)$(MAKE) $(build)=$(build-dir) $(target-dir)$(notdir $@)# Modules
/: prepare scripts FORCESignature · 1 line
2.5.0
Signature · 2 lines
Wei Yang Help you, Help me
Hi, haven't get any feedback for a looong time.
Someone would like this change ? :-)
Quoted 37 lines · Wei Yang
Current kbuild just supports building built-in.o in second directory level individually. There is no rule to build those built-in.o targets below third directory level.
Even current kbuild system could achieve this with rule "%/", while this not only builds built-in targes but also lib target, extra target and module objects.
This patch adds the "%/built-in.o" rule so that each built-in.o in the kernel tree could be the build target, which looks more consistent for the kbuild system.
Signed-off-by Wei Yang <[email protected]>---
v2
. add FORCE in prerequest---
Makefile| 2 ++1 file changed, 2 insertions(+)Makefile +0
-0@@ -1638,6 +1638,8 @@ endif $(Q)$(MAKE) $(build)=$(build-dir) $(target-dir)$(notdir $@)%.symtypes: %.c prepare scripts FORCE
$(Q)$(MAKE) $(build)=$(build-dir) $(target-dir)$(notdir $@)+%/built-in.o: prepare scripts FORCE
Makefile +1
-0+ $(Q)$(MAKE) $(build)=$(build-dir) $(target-dir)$(notdir $@)# Modules
/: prepare scripts FORCESignature · 1 line
2.5.0
Signature · 2 lines
Wei Yang Help you, Help me