Re: the file with the same name

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

 



On Sun, 23 Nov 2014 16:25:11 +0800, �建� said:

> I found there's many files with same name in kernel.
> e.g:
> include/asm/linkage.h
> arch/x86/include/asm/linkage.h
>
> I know when compile for x86, kbuild will use x86 linkage.h.

The secret is in the -I include directives - it will search for linkage.h
in directories in order of -I on the compile command line, and use the first
one it finds.  So x86 gets built with "-I arch/x86/include/asm -I include/asm".

The neat thing is that this allows a generic version for each .h to live
in include/, and if a given architecthre FooVax doesn't use a custom version
of that header, it finds it in include/,and if it *does* have a custom
version, it finds it in -I arch/FooVax/include.

(A nice benefit when porting - it means that even if you know that eventually
you'll need a custom linkage.h due to the API, or whatever, you can still do
compile-testing of other code while you're still writing linkage.h)

To see the compile command line in gory detail, use 'make V=1'.

Attachment: pgpxwwRxNNB2m.pgp
Description: PGP signature

_______________________________________________
Kernelnewbies mailing list
Kernelnewbies@xxxxxxxxxxxxxxxxx
http://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies

[Index of Archives]     [Newbies FAQ]     [Linux Kernel Mentors]     [Linux Kernel Development]     [IETF Annouce]     [Git]     [Networking]     [Security]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux RAID]     [Linux SCSI]     [Linux ACPI]
  Powered by Linux