diff mbox

[U-Boot,V2,01/12] Makefile: Include vendor common library in include search path

Message ID 1447393422-4169-2-git-send-email-nm@ti.com
State Rejected
Delegated to: Tom Rini
Headers show

Commit Message

Nishanth Menon Nov. 13, 2015, 5:43 a.m. UTC
When the vendor common libraries exists, then board should be able to
reference headers located from a generic base, rather than having to
do weird logic such as '#include "../common/xyz.h"'.

There are multiple options of implementation, the current strategy
expects that:
a) Vendor boards that need generic files will define build in:
	board/$(VENDOR)/common
b) Vendor boards that expose generic functions from (a) for usage
from other board specific files will provide these headers in:
	board/$(VENDOR)/common/include/board-common
c) Vendor board files that need these function services will refer
	#include <board-common/xyz.h>
	Where, xyz.h is an example header exposing generic vendor common
	functions.

Cc: Simon Glass <sjg@chromium.org>
Cc: Tom Rini <trini@konsulko.com>
Cc: Masahiro Yamada <yamada.masahiro@socionext.com>
Cc: Daniel Schwierzeck <daniel.schwierzeck@gmail.com>
Cc: Michal Marek <mmarek@suse.cz>
Cc: Stefan Roese <sr@denx.de>
Cc: Bin Meng <bmeng.cn@gmail.com>

Signed-off-by: Nishanth Menon <nm@ti.com>
---
 Makefile | 3 +++
 1 file changed, 3 insertions(+)

Comments

Igor Grinberg Nov. 15, 2015, 2:45 p.m. UTC | #1
Hi Nishanth,

On 11/13/15 07:43, Nishanth Menon wrote:
> When the vendor common libraries exists, then board should be able to
> reference headers located from a generic base, rather than having to
> do weird logic such as '#include "../common/xyz.h"'.
> 
> There are multiple options of implementation, the current strategy
> expects that:
> a) Vendor boards that need generic files will define build in:
> 	board/$(VENDOR)/common
> b) Vendor boards that expose generic functions from (a) for usage
> from other board specific files will provide these headers in:
> 	board/$(VENDOR)/common/include/board-common

I would agree with Simon - no need for additional /common/ in the path.

> c) Vendor board files that need these function services will refer
> 	#include <board-common/xyz.h>
> 	Where, xyz.h is an example header exposing generic vendor common
> 	functions.
> 
> Cc: Simon Glass <sjg@chromium.org>
> Cc: Tom Rini <trini@konsulko.com>
> Cc: Masahiro Yamada <yamada.masahiro@socionext.com>
> Cc: Daniel Schwierzeck <daniel.schwierzeck@gmail.com>
> Cc: Michal Marek <mmarek@suse.cz>
> Cc: Stefan Roese <sr@denx.de>
> Cc: Bin Meng <bmeng.cn@gmail.com>
> 
> Signed-off-by: Nishanth Menon <nm@ti.com>
> ---
>  Makefile | 3 +++
>  1 file changed, 3 insertions(+)
> 
> diff --git a/Makefile b/Makefile
> index 61050adb13f5..e7a3e2b4de51 100644
> --- a/Makefile
> +++ b/Makefile
> @@ -626,6 +626,9 @@ 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)
> +# Include vendor headers - they should be in the following location.
> +# board/$(VENDOR)/common/include/board-common
> +UBOOTINCLUDE += $(if $(HAVE_VENDOR_COMMON_LIB:y=1), -I$(srctree)/board/$(VENDOR)/common/include)
>  
>  libs-y += lib/
>  libs-$(HAVE_VENDOR_COMMON_LIB) += board/$(VENDOR)/common/
>
diff mbox

Patch

diff --git a/Makefile b/Makefile
index 61050adb13f5..e7a3e2b4de51 100644
--- a/Makefile
+++ b/Makefile
@@ -626,6 +626,9 @@  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)
+# Include vendor headers - they should be in the following location.
+# board/$(VENDOR)/common/include/board-common
+UBOOTINCLUDE += $(if $(HAVE_VENDOR_COMMON_LIB:y=1), -I$(srctree)/board/$(VENDOR)/common/include)
 
 libs-y += lib/
 libs-$(HAVE_VENDOR_COMMON_LIB) += board/$(VENDOR)/common/