diff mbox

Makefile: Include vendor common library in include search path

Message ID 20151110145519.GA5952@ogun.home
State New
Headers show

Commit Message

Nishanth Menon Nov. 10, 2015, 2:55 p.m. UTC
On 12:25-20151110, Masahiro Yamada wrote:
> 2015-11-10 5:24 GMT+09:00 Simon Glass <sjg@chromium.org>:

> >>> I am unhappy because I was hoping

> >>> we could stop creating symbolic links during building

> >>> in a long run.

> >

> > But how? I don't see that it is possible if we want to have a sensible

> > prefix for each include.

> 

> 

> [step 1] move SoC-specific headers to  arch/<arch>/mach-<soc>/include/mach

> 

> [step 2] change  #include <asm/arch/foo.h> to #include <mach/foo.h>

> 

> [step 3] Drop CONFIG_CREATE_ARCH_SYMLINK

> 

> 

> For example, mach-uniphier finished [1] and [2],

> so it does not require the symbolic link.

> (several ARM SoCs finished [1])

> 

> 

> I think this is the way ARM should do, at least.

> 

> The topic of debate is PowerPC.  Should we introduce mach-<soc>

> directories or not?

> 


OK: Option 4:

How about this guys? include/board-common is an actual directory
and instead of headers being located in board/$(VENDOR)/common or
board/$(VENDOR)/common/include, we move the common headers to
include/board/$(VENDOR)/ Directory. This will make the usage as follows:

#include <$(VENDOR)/xyz.h>

I know this does not exactly meet Simon's suggestion here of being
identifiably board-common/xyz.h -> but at least knowing the prefix as
vendor name implies a board common header.


How does this sound?
-- 
Regards,
Nishanth Menon
_______________________________________________
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot

Comments

Nishanth Menon Nov. 10, 2015, 3:34 p.m. UTC | #1
On 11/10/2015 08:55 AM, Nishanth Menon wrote:
> On 12:25-20151110, Masahiro Yamada wrote:

>> 2015-11-10 5:24 GMT+09:00 Simon Glass <sjg@chromium.org>:

>>>>> I am unhappy because I was hoping

>>>>> we could stop creating symbolic links during building

>>>>> in a long run.

>>>

>>> But how? I don't see that it is possible if we want to have a sensible

>>> prefix for each include.

>>

>>

>> [step 1] move SoC-specific headers to  arch/<arch>/mach-<soc>/include/mach

>>

>> [step 2] change  #include <asm/arch/foo.h> to #include <mach/foo.h>

>>

>> [step 3] Drop CONFIG_CREATE_ARCH_SYMLINK

>>

>>

>> For example, mach-uniphier finished [1] and [2],

>> so it does not require the symbolic link.

>> (several ARM SoCs finished [1])

>>

>>

>> I think this is the way ARM should do, at least.

>>

>> The topic of debate is PowerPC.  Should we introduce mach-<soc>

>> directories or not?

>>

> 

> OK: Option 4:

> 

> How about this guys? include/board-common is an actual directory

> and instead of headers being located in board/$(VENDOR)/common or

> board/$(VENDOR)/common/include, we move the common headers to

> include/board/$(VENDOR)/ Directory. This will make the usage as follows:

> 

> #include <$(VENDOR)/xyz.h>

> 

> I know this does not exactly meet Simon's suggestion here of being

> identifiably board-common/xyz.h -> but at least knowing the prefix as

> vendor name implies a board common header.

> 

> diff --git a/Makefile b/Makefile

> index 3c21f8ddf9e9..2bd684199512 100644

> --- a/Makefile

> +++ b/Makefile

> @@ -620,6 +620,7 @@ c_flags := $(KBUILD_CFLAGS) $(cpp_flags)

>  # U-Boot objects....order is important (i.e. start must be first)

>  

>  HAVE_VENDOR_COMMON_LIB = $(if $(wildcard $(srctree)/board/$(VENDOR)/common/Makefile),y,n)

> +UBOOTINCLUDE += $(if $(HAVE_VENDOR_COMMON_LIB:y=1), -I$(srctree)/include/board-common)

>  

>  libs-y += lib/

>  libs-$(HAVE_VENDOR_COMMON_LIB) += board/$(VENDOR)/common/

> 

> How does this sound?

> 

Spin off from option 4 is option 5 -> where we dont have the Makefile
change. the board includes are located in
include/board-common/$(VENDOR)/ directory.


Usage will be:

#include <board-common/$(VENDOR)/xyz.h>


Almost meets Simon's needs(identifiable as board common header) and I
think matches what Masahiro-san wants as well(no symlinks).


OK, i am out of ideas at least for now... Any other suggestions / opinions?
-- 
Regards,
Nishanth Menon
_______________________________________________
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot
Nishanth Menon Nov. 12, 2015, 4:45 p.m. UTC | #2
On 11/12/2015 10:22 AM, Tom Rini wrote:
> On Thu, Nov 12, 2015 at 09:16:00AM -0700, Simon Glass wrote:

>> Hi,

>>

>> On 10 November 2015 at 08:34, Nishanth Menon <nm@ti.com> wrote:

>>> On 11/10/2015 08:55 AM, Nishanth Menon wrote:

>>>> On 12:25-20151110, Masahiro Yamada wrote:

>>>>> 2015-11-10 5:24 GMT+09:00 Simon Glass <sjg@chromium.org>:

>>>>>>>> I am unhappy because I was hoping

>>>>>>>> we could stop creating symbolic links during building

>>>>>>>> in a long run.

>>>>>>

>>>>>> But how? I don't see that it is possible if we want to have a sensible

>>>>>> prefix for each include.

>>>>>

>>>>>

>>>>> [step 1] move SoC-specific headers to  arch/<arch>/mach-<soc>/include/mach

>>>>>

>>>>> [step 2] change  #include <asm/arch/foo.h> to #include <mach/foo.h>

>>>>>

>>>>> [step 3] Drop CONFIG_CREATE_ARCH_SYMLINK

>>>>>

>>>>>

>>>>> For example, mach-uniphier finished [1] and [2],

>>>>> so it does not require the symbolic link.

>>>>> (several ARM SoCs finished [1])

>>>>>

>>>>>

>>>>> I think this is the way ARM should do, at least.

>>>>>

>>>>> The topic of debate is PowerPC.  Should we introduce mach-<soc>

>>>>> directories or not?

>>>>>

>>>>

>>>> OK: Option 4:

>>>>

>>>> How about this guys? include/board-common is an actual directory

>>>> and instead of headers being located in board/$(VENDOR)/common or

>>>> board/$(VENDOR)/common/include, we move the common headers to

>>>> include/board/$(VENDOR)/ Directory. This will make the usage as follows:

>>>>

>>>> #include <$(VENDOR)/xyz.h>

>>>>

>>>> I know this does not exactly meet Simon's suggestion here of being

>>>> identifiably board-common/xyz.h -> but at least knowing the prefix as

>>>> vendor name implies a board common header.

>>>>

>>>> diff --git a/Makefile b/Makefile

>>>> index 3c21f8ddf9e9..2bd684199512 100644

>>>> --- a/Makefile

>>>> +++ b/Makefile

>>>> @@ -620,6 +620,7 @@ c_flags := $(KBUILD_CFLAGS) $(cpp_flags)

>>>>  # U-Boot objects....order is important (i.e. start must be first)

>>>>

>>>>  HAVE_VENDOR_COMMON_LIB = $(if $(wildcard $(srctree)/board/$(VENDOR)/common/Makefile),y,n)

>>>> +UBOOTINCLUDE += $(if $(HAVE_VENDOR_COMMON_LIB:y=1), -I$(srctree)/include/board-common)

>>>>

>>>>  libs-y += lib/

>>>>  libs-$(HAVE_VENDOR_COMMON_LIB) += board/$(VENDOR)/common/

>>>>

>>>> How does this sound?

>>>>

>>> Spin off from option 4 is option 5 -> where we dont have the Makefile

>>> change. the board includes are located in

>>> include/board-common/$(VENDOR)/ directory.

>>>

>>>

>>> Usage will be:

>>>

>>> #include <board-common/$(VENDOR)/xyz.h>

>>>

>>>

>>> Almost meets Simon's needs(identifiable as board common header) and I

>>> think matches what Masahiro-san wants as well(no symlinks).

>>>

>>>

>>> OK, i am out of ideas at least for now... Any other suggestions / opinions?

>>

>> If we don't want a symlink then option 5 seems good to me. Thanks very

>> much for looking into this in so much detail, Nishanth.

>>

>> Thoughts - Masahiro? Tom?

> 

> No symlink should mean Masahiro is happy, so if you're fine with #5 then

> that works for me too, thanks!

> 


I just have yet another option 6 variation -> looking at the mach
strategy:

UBOOTINCLUDE += $(if $(HAVE_VENDOR_COMMON_LIB:y=1),
-I$(srctree)/board/$(VENDOR)/common/include)

vendors should create common headers in
board/$(VENDOR)/include/board-common/xyz.h

the users then can do:
#include <board-common/xyz.h>

How does that sound? ofcourse, similar to mach, it requires some
discipline..

-- 
Regards,
Nishanth Menon
_______________________________________________
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot
diff mbox

Patch

diff --git a/Makefile b/Makefile
index 3c21f8ddf9e9..2bd684199512 100644
--- a/Makefile
+++ b/Makefile
@@ -620,6 +620,7 @@  c_flags := $(KBUILD_CFLAGS) $(cpp_flags)
 # U-Boot objects....order is important (i.e. start must be first)
 
 HAVE_VENDOR_COMMON_LIB = $(if $(wildcard $(srctree)/board/$(VENDOR)/common/Makefile),y,n)
+UBOOTINCLUDE += $(if $(HAVE_VENDOR_COMMON_LIB:y=1), -I$(srctree)/include/board-common)
 
 libs-y += lib/
 libs-$(HAVE_VENDOR_COMMON_LIB) += board/$(VENDOR)/common/