CHECK without C compile?
Hi Sam,
Is there an option/variant of CHECKSRC that does something like
make checkall
i.e., runs CHECK=sparse on all source files, without also building them with the C compiler?
Thanks,
---
~Randy
RFC PATCH 1/1 kbuild: implement checksrc without building Cources (was Re: CHECK without C compile?)
Quoted 1 line · Randy Dunlap
Hi Sam,
It seem he on vocation, let me get it, since i've started my develife from makefiles.
Quoted 4 lines
Is there an option/variant of CHECKSRC that does something like
make checkall
i.e., runs CHECK=sparse on all source files, without also building them with the C compiler?
As far as i can see, no, there isn't.
I have thing to propose, but something with generated header files will not work yet (e.g kernel/config_data.h). Patch is rfc, of course.
---
From: Oleg Verych <[email protected]>
Subject: [patch, rfc] kbuild: implement checksrc without building Cources
Implementation of configured source chacking without actual building.
---
Configured sources means, some config target must be run already. After that
,-<shell>
| make prepare
| make C=something_not_0,1,2 _target_
`--
should run _target_ with checking and without building.
-o--=O`C /. .\
#oo'L O o
<___=E M ^--
scripts/Kbuild.include | 6 +++--- scripts/Makefile.build | 21 +++++++++++++-------- 2 files changed, 16 insertions(+), 11 deletions(-)
scripts/Kbuild.include +3 -3
@@ -153,7 +153,7 @@ if_changed = $(if $(strip $(any-prereq) $(arg-check)), \ @set -e; \ $(echo-cmd) $(cmd_$(1)); \ - echo 'cmd_$@ := $(make-cmd)' > $(dot-target).cmd) + echo 'cmd_$@ := $(make-cmd)' > $(dot-target).cmd, @:) # execute the command and also postprocess generated .d dependencies # file
@@ -162,14 +162,14 @@ $(echo-cmd) $(cmd_$(1)); \ scripts/basic/fixdep $(depfile) $@ '$(make-cmd)' > $(dot-target).tmp;\ rm -f $(depfile); \ - mv -f $(dot-target).tmp $(dot-target).cmd) + mv -f $(dot-target).tmp $(dot-target).cmd, @:) # Usage: $(call if_changed_rule,foo) # will check if $(cmd_foo) changed, or any of the prequisites changed, # and if so will execute $(rule_foo) if_changed_rule = $(if $(strip $(any-prereq) $(arg-check) ), \ @set -e; \ - $(rule_$(1))) + $(rule_$(1)), @:) ### # why - tell why a a target got build
scripts/Makefile.build +13 -8
@@ -87,12 +87,17 @@ # Linus' kernel sanity checking tool ifneq ($(KBUILD_CHECKSRC),0) - ifeq ($(KBUILD_CHECKSRC),2) - quiet_cmd_force_checksrc = CHECK $< - cmd_force_checksrc = $(CHECK) $(CHECKFLAGS) $(c_flags) $< ; - else + ifeq ($(KBUILD_CHECKSRC),1) quiet_cmd_checksrc = CHECK $< cmd_checksrc = $(CHECK) $(CHECKFLAGS) $(c_flags) $< ; + else + quiet_cmd_force_checksrc = CHECK $< + cmd_force_checksrc = $(CHECK) $(CHECKFLAGS) $(c_flags) $< ; + ifneq ($(KBUILD_CHECKSRC),2) + if_changed = @: + if_changed_dep = @: + if_changed_rule = @: + endif endif endif
@@ -207,8 +212,8 @@ $(single-used-m): %.o: %.c FORCE $(call cmd,force_checksrc) - $(call if_changed_rule,cc_o_c) - @{ echo $(@:.o=.ko); echo $@; } > $(MODVERDIR)/$(@F:.o=.mod) + $(call if_changed_rule,cc_o_c) || \ + { echo $(@:.o=.ko); echo $@; } > $(MODVERDIR)/$(@F:.o=.mod) quiet_cmd_cc_lst_c = MKLST $@ cmd_cc_lst_c = $(CC) $(c_flags) -g -c -o $*.o $< && \
@@ -310,8 +315,8 @@ $(call if_changed,link_multi-y) $(multi-used-m) : %.o: $(multi-objs-m) FORCE - $(call if_changed,link_multi-m) - @{ echo $(@:.o=.ko); echo $(link_multi_deps); } > $(MODVERDIR)/$(@F:.o=.mod) + $(call if_changed,link_multi-m) || \ + { echo $(@:.o=.ko); echo $(link_multi_deps); } > $(MODVERDIR)/$(@F:.o=.mod) targets += $(multi-used-y) $(multi-used-m)
Re: [patch, rfc] kbuild: implement checksrc without building Cources (was Re: CHECK without C compile?)
Quoted 3 lines · Oleg Verych
Quoted 1 line · Randy Dunlap
Hi Sam,
* It seems*
Review
Quoted 3 lines
(quoted diff) +2
-0+ $(call if_changed_rule,cc_o_c) || \ + { echo $(@:.o=.ko); echo $@; } > $(MODVERDIR)/$(@F:.o=.mod)
This doesn't work, use ifs instead. Updated.
I have no idea what to do with generated sources and headers. One may be: check target `if_changed' to be %.c or %.h and let it be built.
____
From: Oleg Verych <[email protected]>
Subject: [patch, rfc] kbuild: implement checksrc without building Cources
Implementation of configured source chacking without actual building.
---
Configured sources means, some config target must be run already. After that
,-<shell>
| make prepare
| make C=something_not_0,1,2 _target_
`--
should run _target_ with checking and without building.
-o--=O`C /. .\
#oo'L O o
<___=E M ^--
scripts/Kbuild.include | 6 +++--- scripts/Makefile.build | 25 ++++++++++++++++--------- 2 files changed, 19 insertions(+), 12 deletions(-)
scripts/Kbuild.include +3 -3
@@ -153,7 +153,7 @@ if_changed = $(if $(strip $(any-prereq) $(arg-check)), \ @set -e; \ $(echo-cmd) $(cmd_$(1)); \ - echo 'cmd_$@ := $(make-cmd)' > $(dot-target).cmd) + echo 'cmd_$@ := $(make-cmd)' > $(dot-target).cmd ;) # execute the command and also postprocess generated .d dependencies # file
@@ -162,14 +162,14 @@ $(echo-cmd) $(cmd_$(1)); \ scripts/basic/fixdep $(depfile) $@ '$(make-cmd)' > $(dot-target).tmp;\ rm -f $(depfile); \ - mv -f $(dot-target).tmp $(dot-target).cmd) + mv -f $(dot-target).tmp $(dot-target).cmd ;) # Usage: $(call if_changed_rule,foo) # will check if $(cmd_foo) changed, or any of the prequisites changed, # and if so will execute $(rule_foo) if_changed_rule = $(if $(strip $(any-prereq) $(arg-check) ), \ @set -e; \ - $(rule_$(1))) + $(rule_$(1)) ;) ### # why - tell why a a target got build
scripts/Makefile.build +16 -9
@@ -87,12 +87,17 @@ # Linus' kernel sanity checking tool ifneq ($(KBUILD_CHECKSRC),0) - ifeq ($(KBUILD_CHECKSRC),2) - quiet_cmd_force_checksrc = CHECK $< - cmd_force_checksrc = $(CHECK) $(CHECKFLAGS) $(c_flags) $< ; - else + ifeq ($(KBUILD_CHECKSRC),1) quiet_cmd_checksrc = CHECK $< cmd_checksrc = $(CHECK) $(CHECKFLAGS) $(c_flags) $< ; + else + quiet_cmd_force_checksrc = CHECK $< + cmd_force_checksrc = $(CHECK) $(CHECKFLAGS) $(c_flags) $< ; + ifneq ($(KBUILD_CHECKSRC),2) + if_changed =# + if_changed_dep =# + if_changed_rule =# + endif endif endif
@@ -204,11 +209,11 @@ $(call if_changed_rule,cc_o_c) # Single-part modules are special since we need to mark them in $(MODVERDIR) - $(single-used-m): %.o: %.c FORCE $(call cmd,force_checksrc) - $(call if_changed_rule,cc_o_c) - @{ echo $(@:.o=.ko); echo $@; } > $(MODVERDIR)/$(@F:.o=.mod) + $(if $(if_changed_rule), \ + $(call if_changed_rule,cc_o_c) \ + { echo $(@:.o=.ko); echo $@; } > $(MODVERDIR)/$(@F:.o=.mod)) quiet_cmd_cc_lst_c = MKLST $@ cmd_cc_lst_c = $(CC) $(c_flags) -g -c -o $*.o $< && \
@@ -310,8 +315,10 @@ $(call if_changed,link_multi-y) $(multi-used-m) : %.o: $(multi-objs-m) FORCE - $(call if_changed,link_multi-m) - @{ echo $(@:.o=.ko); echo $(link_multi_deps); } > $(MODVERDIR)/$(@F:.o=.mod) + $(if $(if_changed), \ + $(call if_changed,link_multi-m) \ + { echo $(@:.o=.ko); \ + echo $(link_multi_deps); } > $(MODVERDIR)/$(@F:.o=.mod)) targets += $(multi-used-y) $(multi-used-m)
Re: [patch, rfc] kbuild: implement checksrc without building Cources (was Re: CHECK without C compile?)
Quoted 6 lines · On Tue, 24 Oct 2006 19:43:40 +0000 (UTC) Oleg Verych wrote:
Quoted 3 lines · Oleg Verych
Quoted 1 line · Randy Dunlap
Hi Sam,
* It seems*
Quoted 1 line
Quoted 7 lines
Review
Quoted 2 lines
(quoted diff) +2
-0+ $(call if_changed_rule,cc_o_c) || \ + { echo $(@:.o=.ko); echo $@; } > $(MODVERDIR)/$(@F:.o=.mod)This doesn't work, use ifs instead. Updated.
I have no idea what to do with generated sources and headers. One may be: check target `if_changed' to be %.c or %.h and let it be built.
Hi Oleg,
Yes, it works for me, with the exception of host-generated files, as you mentioned. I ran into those with:
IKCONFIG (the one that you mentioned), ATM_FORE200E firmware, IEEE 1394 OUI database (which I sent a patch for -- it should not be generated when the config option is not enabled), RAID456 tables, VIDEO_LOGO files, and CRC32 table.
Thanks for your time and effort. Maybe Sam will have some ideas.
Quoted 19 lines
____
From: Oleg Verych <[email protected]>
Subject: [patch, rfc] kbuild: implement checksrc without building CourcesImplementation of configured source chacking without actual building.
Cc Randy Dunlap <[email protected]>Cc Sam Ravnborg <[email protected]>Signed-off-by Oleg Verych <[email protected]>---
Configured sources means, some config target must be run already. After that
,-<shell>
| make prepare
| make C=something_not_0,1,2 _target_
`--
should run _target_ with checking and without building.
Quoted 7 lines
-o--=O`C /. .\
#oo'L O o
<___=E M ^--scripts/Kbuild.include | 6 +++--- scripts/Makefile.build | 25 ++++++++++++++++--------- 2 files changed, 19 insertions(+), 12 deletions(-)
---
~Randy
Re:[patch, rfc] kbuild: implement checksrc without building Cources...
Quoted 6 lines · Randy Dunlap
Quoted 4 lines · On Tue, 24 Oct 2006 19:43:40 +0000 (UTC) Oleg Verych wrote:
This doesn't work, use ifs instead. Updated.
I have no idea what to do with generated sources and headers. One may be: check target `if_changed' to be %.c or %.h and let it be built.
Quoted 8 lines
Hi Oleg,
Yes, it works for me, with the exception of host-generated files, as you mentioned. I ran into those with:
IKCONFIG (the one that you mentioned),ATM_FORE200Efirmware, IEEE 1394 OUI database (which I sent a patch for -- it should not be generated when the config option is not enabled), RAID456 tables,VIDEO_LOGOfiles, and CRC32 table.
I'm glad, that semi-working thing was helpful. But it's ugly hack.
Idea is to substitute objects (*.o) with sparse output, thus targets like
,--
|%.o : %.c
+--
will be updated and new check will pass them (force check may be applied). Also having results in files (even in so messy called *.o) is good for collecting and sorting errors. Headers will be generated as needed.
Finally short statistics maybe printed in the end of the check:
[(stat -c %s *.o > 0 | wc -l) / find --name *.o]
^ with error file size > 0 / overall error files
But implementing all this in non-hack way isn't easy. Maybe Sam will came back and will do it magically quickly. Until that, i'll try to fight with current makefiles myself.
Quoted 1 line
Thanks for your time and effort. Maybe Sam will have some ideas.
I've found "sparse" and read some philosophy from README. Nice. Thanks you also !
____
Re: [patch, rfc] kbuild: implement checksrc without building Cources...
Quoted 41 lines
From: Oleg Verych
Newsgroups: gmane.linux.kernel,gmane.linux.kbuild.devel
Subject: Re:[patch, rfc] kbuild: implement checksrc without building Cources...
Date: Thu, 26 Oct 2006 15:07:20 +0200
Archived-At: <http://permalink.gmane.org/gmane.linux.kernel/460736>Quoted 6 lines · Randy Dunlap
Quoted 4 lines · On Tue, 24 Oct 2006 19:43:40 +0000 (UTC) Oleg Verych wrote:
This doesn't work, use ifs instead. Updated.
I have no idea what to do with generated sources and headers. One may be: check target `if_changed' to be %.c or %.h and let it be built.Quoted 8 lines
Hi Oleg,
Yes, it works for me, with the exception of host-generated files, as you mentioned. I ran into those with:
IKCONFIG (the one that you mentioned),ATM_FORE200Efirmware, IEEE 1394 OUI database (which I sent a patch for -- it should not be generated when the config option is not enabled), RAID456 tables,VIDEO_LOGOfiles, and CRC32 table.I'm glad, that semi-working thing was helpful. But it's ugly hack.
Idea is to substitute objects (*.o) with sparse output, thus targets like
,--
|%.o : %.c
+--
will be updated and new check will pass them (force check may be applied). Also having results in files (even in so messy called *.o) is good for collecting and sorting errors. Headers will be generated as needed.Finally short statistics maybe printed in the end of the check:
[(stat -c %s *.o > 0 | wc -l) / find --name *.o]
^ with error file size > 0 / overall error filesBut implementing all this in non-hack way isn't easy. Maybe Sam will came back and will do it magically quickly. Until that, i'll try to fight with current makefiles myself.
Quoted 5 lines
Quoted 1 line
Thanks for your time and effort. Maybe Sam will have some ideas.
I've found "sparse" and read some philosophy from README. Nice. Thanks you also !
____
So far nothing has changed. Is it still worth to try to make more comprehensive solution ?
p.s. Note. Please honor "Mail-Followup-To" header. Thanks.
____