Subject: Compile one file in kernel

Hi,
I always using command make, then it will compile all files. How
about just compile one c file(just make sure some modify can compile
successful), how should I do? Is there any command to allow me to doing
this?
Thanks.
.jovi


2010-08-11 01:50:00

by Xiaotian Feng

[permalink] [raw]
Subject: Re: Compile one file in kernel

On Wed, Aug 11, 2010 at 8:59 AM, Zhang, Wei-Jovi (NSN - CN/Hangzhou)
<[email protected]> wrote:
> Hi,
>        I always using command make, then it will compile all files. How
> about just compile one c file(just make sure some modify can compile
> successful), how should I do? Is there any command to allow me to doing
> this?

make <filename>.o

>        Thanks.
> .jovi
> --
> To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
> the body of a message to [email protected]
> More majordomo info at  http://vger.kernel.org/majordomo-info.html
> Please read the FAQ at  http://www.tux.org/lkml/
>

Subject: RE: Compile one file in kernel

Apparently not, you should run "rm -f <filename>.o" firstly, then "make <filename>.o"
Maybe you can write a script to do this if you want to.

-----Original Message-----
From: ext zhanglx [mailto:[email protected]]
Sent: Wednesday, August 11, 2010 12:07 PM
To: 'Xiaotian Feng'; Zhang, Wei-Jovi (NSN - CN/Hangzhou)
Cc: [email protected]
Subject: RE: Compile one file in kernel

If .o file is not cleaned, make will automatically select the changed files
to compile and link?

-----Original Message-----
From: [email protected]
[mailto:[email protected]] On Behalf Of Xiaotian Feng
Sent: Wednesday, August 11, 2010 9:50 AM
To: Zhang, Wei-Jovi (NSN - CN/Hangzhou)
Cc: [email protected]
Subject: Re: Compile one file in kernel

On Wed, Aug 11, 2010 at 8:59 AM, Zhang, Wei-Jovi (NSN - CN/Hangzhou)
<[email protected]> wrote:
> Hi,
> ? ? ? ?I always using command make, then it will compile all files. How
> about just compile one c file(just make sure some modify can compile
> successful), how should I do? Is there any command to allow me to doing
> this?

make <filename>.o

> ? ? ? ?Thanks.
> .jovi
> --
> To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
> the body of a message to [email protected]
> More majordomo info at ?http://vger.kernel.org/majordomo-info.html
> Please read the FAQ at ?http://www.tux.org/lkml/
>

2010-08-11 04:23:14

by Cong Wang

[permalink] [raw]
Subject: Re: Compile one file in kernel

On Wed, Aug 11, 2010 at 08:59:06AM +0800, Zhang, Wei-Jovi (NSN - CN/Hangzhou) wrote:
>Hi,
> I always using command make, then it will compile all files. How
>about just compile one c file(just make sure some modify can compile
>successful), how should I do? Is there any command to allow me to doing
>this?


You can always find these info in `make help`:

...
dir/ - Build all files in dir and below
dir/file.[oisS] - Build specified target only
dir/file.lst - Build specified mixed source/assembly target only
(requires a recent binutils and recent build (System.map))
dir/file.ko - Build module including final link
...

Subject: RE: Compile one file in kernel

Sorry, I forgot it, make will compare the timestamp of .c and .o file


-----Original Message-----
From: ext zhanglx [mailto:[email protected]]
Sent: Wednesday, August 11, 2010 12:48 PM
To: Zhang, Wei-Jovi (NSN - CN/Hangzhou); 'Xiaotian Feng'
Cc: [email protected]
Subject: RE: Compile one file in kernel

You mean make will not compare the timestamp of .c and .o file?

-----Original Message-----
From: [email protected]
[mailto:[email protected]] On Behalf Of Zhang, Wei-Jovi
(NSN - CN/Hangzhou)
Sent: Wednesday, August 11, 2010 12:10 PM
To: ext zhanglx; Xiaotian Feng
Cc: [email protected]
Subject: RE: Compile one file in kernel

Apparently not, you should run "rm -f <filename>.o" firstly, then "make
<filename>.o"
Maybe you can write a script to do this if you want to.

-----Original Message-----
From: ext zhanglx [mailto:[email protected]]
Sent: Wednesday, August 11, 2010 12:07 PM
To: 'Xiaotian Feng'; Zhang, Wei-Jovi (NSN - CN/Hangzhou)
Cc: [email protected]
Subject: RE: Compile one file in kernel

If .o file is not cleaned, make will automatically select the changed files
to compile and link?

-----Original Message-----
From: [email protected]
[mailto:[email protected]] On Behalf Of Xiaotian Feng
Sent: Wednesday, August 11, 2010 9:50 AM
To: Zhang, Wei-Jovi (NSN - CN/Hangzhou)
Cc: [email protected]
Subject: Re: Compile one file in kernel

On Wed, Aug 11, 2010 at 8:59 AM, Zhang, Wei-Jovi (NSN - CN/Hangzhou)
<[email protected]> wrote:
> Hi,
> ? ? ? ?I always using command make, then it will compile all files. How
> about just compile one c file(just make sure some modify can compile
> successful), how should I do? Is there any command to allow me to doing
> this?

make <filename>.o

> ? ? ? ?Thanks.
> .jovi
> --
> To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
> the body of a message to [email protected]
> More majordomo info at ?http://vger.kernel.org/majordomo-info.html
> Please read the FAQ at ?http://www.tux.org/lkml/
>