Re: HELP: Count Lines of Code in Custom Compiled Kernel

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On 08/10/2018 09:43 AM, Randy Dunlap wrote:
> On 08/10/2018 12:30 AM, Faisal Mehmood wrote:
>> So I compiled a custom minimal Linux Kernel. I want to list all the
>> source files used for this particular .config file. I also want to
>> count the lines of code against that .config file compilation.
> 
> Hi,
> 
> We have a tradition of not doing people's homework for them.  :)
> 
>> I tried using 'make  > logfile', but that only lists the generated
>> object files. Source files are not listed.
> 
> Did you try other build options?
> 
> E.g., using "make V=1 ... " will give you verbose output.  It might give
> you a list of source files that are compiled.  OTOH, it's probably too verbose.
> 
> Or did you look at "make C=1 ..." to invoke the "CHECK" tool on each source
> file that is built?
> 
> That should be enough of a hint to get you going...
> 
>> 'find . -type f -name *.[ch]' includes all the source files, while I
>> only need those that are being used by my .config file.
> 
> 
> BTW, it would be helpful if one could override "CHECKFLAGS" on the
> 'make' command line.
> As is, CHECKFLAGS is (too) sparse-specific.

Aha, it is c_flags that gets in the way.
CHECKFLAGS=   does work to override its value.

So Faisal, I had to use a patch like this and then using CHECK=<some script file>
and CHECKFLAGS=      works to count each source file that is built.


---
 scripts/Makefile.build |    4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

--- linux-next-20180810.orig/scripts/Makefile.build
+++ linux-next-20180810/scripts/Makefile.build
@@ -86,10 +86,10 @@ __build: $(if $(KBUILD_BUILTIN),$(builti
 ifneq ($(KBUILD_CHECKSRC),0)
   ifeq ($(KBUILD_CHECKSRC),2)
     quiet_cmd_force_checksrc = CHECK   $<
-          cmd_force_checksrc = $(CHECK) $(CHECKFLAGS) $(c_flags) $< ;
+          cmd_force_checksrc = $(CHECK) $(CHECKFLAGS)  $< ;
   else
       quiet_cmd_checksrc     = CHECK   $<
-            cmd_checksrc     = $(CHECK) $(CHECKFLAGS) $(c_flags) $< ;
+            cmd_checksrc     = $(CHECK) $(CHECKFLAGS)  $< ;
   endif
 endif
 




-- 
~Randy



[Index of Archives]     [Linux&nblp;USB Development]     [Linux Media]     [Video for Linux]     [Linux Audio Users]     [Yosemite Secrets]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux