Patchwork MARS: fix makefile kernel lib build order

login
register
mail settings
Submitter Yuji Mano
Date Sept. 9, 2008, 8:58 p.m.
Message ID <48C6E362.7070007@am.sony.com>
Download mbox | patch
Permalink /patch/224/
State Superseded
Delegated to: Yuji Mano
Headers show

Comments

Yuji Mano - Sept. 9, 2008, 8:58 p.m.
This fixes a bug in the Makefile that would build the kernel before the lib
which the kernel is dependent on.

This also makes sure the kernel links the lib in the build source and not just
any libmars.a it finds in the library search path.

Signed-off-by: Yuji Mano <yuji.mano@am.sony.com>
Kazunori Asayama - Sept. 10, 2008, 1:52 a.m.
Yuji Mano wrote:
> This fixes a bug in the Makefile that would build the kernel before the lib
> which the kernel is dependent on.
> 
> This also makes sure the kernel links the lib in the build source and not just
> any libmars.a it finds in the library search path.
> 
> Signed-off-by: Yuji Mano <yuji.mano@am.sony.com>
> 
> ---
>  src/mpu/Makefile.am        |    2 +-
>  src/mpu/kernel/Makefile.am |    3 +--
>  2 files changed, 2 insertions(+), 3 deletions(-)
> 
> --- a/src/mpu/Makefile.am
> +++ b/src/mpu/Makefile.am
> @@ -36,7 +36,7 @@
>  #  LIBRARY OR THE USE OR OTHER DEALINGS IN THE LIBRARY.
>  #
>  
> -SUBDIRS = kernel lib
> +SUBDIRS = lib kernel
>  
>  EXTRA_DIST = \
>  	bootstrap \
> --- a/src/mpu/kernel/Makefile.am
> +++ b/src/mpu/kernel/Makefile.am
> @@ -54,13 +54,12 @@ mars_kernel_CFLAGS = \
>  	-Wmissing-declarations
>  
>  mars_kernel_LDFLAGS = \
> -	-L../lib \
>  	-Wl,--defsym=__stack=0x0fff0 \
>  	-Wl,-gc-sections \
>  	-Wl,-N \
>  	-Wl,-s
>  
> -mars_kernel_LDADD = -lmars
> +mars_kernel_LDADD = $(srcdir)/../lib/libmars.a

I think $(builddir) should be used here instead of $(srcdir).

>  
>  mars_kernel_SOURCES = \
>  	mars_kernel.c \
> 
> 
>
Geert Uytterhoeven - Sept. 10, 2008, 9:31 a.m.
On Tue, 9 Sep 2008, Yuji Mano wrote:
> This fixes a bug in the Makefile that would build the kernel before the lib
> which the kernel is dependent on.
> 
> This also makes sure the kernel links the lib in the build source and not just
> any libmars.a it finds in the library search path.
> 
> Signed-off-by: Yuji Mano <yuji.mano@am.sony.com>
> 
> ---
>  src/mpu/Makefile.am        |    2 +-
>  src/mpu/kernel/Makefile.am |    3 +--
>  2 files changed, 2 insertions(+), 3 deletions(-)
> 
> --- a/src/mpu/Makefile.am
> +++ b/src/mpu/Makefile.am
> @@ -36,7 +36,7 @@
>  #  LIBRARY OR THE USE OR OTHER DEALINGS IN THE LIBRARY.
>  #
>  
> -SUBDIRS = kernel lib
> +SUBDIRS = lib kernel

Does this work with `make -j'? Probably you need an explicit dependency on
`lib' for `kernel'.

With kind regards,

Geert Uytterhoeven
Software Architect

Sony Techsoft Centre Europe
The Corporate Village · Da Vincilaan 7-D1 · B-1935 Zaventem · Belgium

Phone:    +32 (0)2 700 8453
Fax:      +32 (0)2 700 8622
E-mail:   Geert.Uytterhoeven@sonycom.com
Internet: http://www.sony-europe.com/

A division of Sony Europe (Belgium) N.V.
VAT BE 0413.825.160 · RPR Brussels
Fortis · BIC GEBABEBB · IBAN BE41293037680010
Yuji Mano - Sept. 10, 2008, 6:08 p.m.
Geert Uytterhoeven wrote:
> On Tue, 9 Sep 2008, Yuji Mano wrote:
>> This fixes a bug in the Makefile that would build the kernel before the lib
>> which the kernel is dependent on.
>> 
>> This also makes sure the kernel links the lib in the build source and not just
>> any libmars.a it finds in the library search path.
>> 
>> Signed-off-by: Yuji Mano <yuji.mano@am.sony.com>
>> 
>> ---
>>  src/mpu/Makefile.am        |    2 +-
>>  src/mpu/kernel/Makefile.am |    3 +--
>>  2 files changed, 2 insertions(+), 3 deletions(-)
>> 
>> --- a/src/mpu/Makefile.am
>> +++ b/src/mpu/Makefile.am
>> @@ -36,7 +36,7 @@
>>  #  LIBRARY OR THE USE OR OTHER DEALINGS IN THE LIBRARY.
>>  #
>>  
>> -SUBDIRS = kernel lib
>> +SUBDIRS = lib kernel
> 
> Does this work with `make -j'? Probably you need an explicit dependency on
> `lib' for `kernel'.

I tried building with 'make -j' and it seems to build ok.

Regards,
Yuji

Patch

--- a/src/mpu/Makefile.am
+++ b/src/mpu/Makefile.am
@@ -36,7 +36,7 @@ 
 #  LIBRARY OR THE USE OR OTHER DEALINGS IN THE LIBRARY.
 #
 
-SUBDIRS = kernel lib
+SUBDIRS = lib kernel
 
 EXTRA_DIST = \
 	bootstrap \
--- a/src/mpu/kernel/Makefile.am
+++ b/src/mpu/kernel/Makefile.am
@@ -54,13 +54,12 @@  mars_kernel_CFLAGS = \
 	-Wmissing-declarations
 
 mars_kernel_LDFLAGS = \
-	-L../lib \
 	-Wl,--defsym=__stack=0x0fff0 \
 	-Wl,-gc-sections \
 	-Wl,-N \
 	-Wl,-s
 
-mars_kernel_LDADD = -lmars
+mars_kernel_LDADD = $(srcdir)/../lib/libmars.a
 
 mars_kernel_SOURCES = \
 	mars_kernel.c \