Skip to contentSkip to conversation

Is there an include statement in buildroot ?

Buildroot Stefan Fröberg 2 participants 3 messages Sep 3, 2012

lore
Share & tools
lore
#0 lore raw

Hello everyone

My package .mk file is getting quite large now and I would like to break it to more easily
sizeable and logical chunks.

Is there a way to include other .mk files in main .mk file ?

Like something like this:

package/newpackage/A.mk
package/newpackage/C.mk
package/newpackage/D.mk
etc....
package/newpackage/newpackage.mk

And newpackage.mk would have:

include "A.mk"
include "B.mk"
include "C.mk"

etc....

Stefan

#1 lore raw

Hi Stefan,

2012/9/3 Stefan Fr?berg <[email protected]>:

Quoted 7 lines

Hello everyone

My package .mk file is getting quite large now and I would like to break it to more easily
sizeable and logical chunks.

Is there a way to include other .mk files in main .mk file ?

Actually, you don't need to explicitly include .mk files, this is automatically handled in the Makefile at the root of BR. To convince yourself ;-) :
grep -nE 'include .*?mk' Makefile

Quoted 8 lines

Like something like this:

package/newpackage/A.mk
package/newpackage/C.mk
package/newpackage/D.mk
etc....
package/newpackage/newpackage.mk

However, if you there is a specific order for the inclusion, you can do:
package/newpackage/A.mk.in
package/newpackage/B.mk.in
...

Quoted 9 lines

And newpackage.mk would have:

include "A.mk"
include "B.mk"
include "C.mk"

etc....

Then, in the newpackage.mk:
include A.mk.in
include B.mk.in
...

Or just:
include ./*.mk.in

Cheers,

Signature · 1 line
Sam
#2 lore raw

Hi Samuel

4.9.2012 0:50, Samuel Martin kirjoitti:

Quoted 40 lines

Hi Stefan,

2012/9/3 Stefan Fr?berg <[email protected]>:

Quoted 7 lines

Hello everyone

My package .mk file is getting quite large now and I would like to break it to more easily
sizeable and logical chunks.

Is there a way to include other .mk files in main .mk file ?

Actually, you don't need to explicitly include .mk files, this is automatically handled in the Makefile at the root of BR. To convince yourself ;-) :
grep -nE 'include .*?mk' Makefile

Quoted 7 lines

Like something like this:

package/newpackage/A.mk
package/newpackage/C.mk
package/newpackage/D.mk
etc....
package/newpackage/newpackage.mk

However, if you there is a specific order for the inclusion, you can do:
package/newpackage/A.mk.in
package/newpackage/B.mk.in
...

Quoted 8 lines

And newpackage.mk would have:

include "A.mk"
include "B.mk"
include "C.mk"

etc....

Then, in the newpackage.mk:
include A.mk.in
include B.mk.in
...

Quoted 6 lines

Or just:
include ./*.mk.in

Cheers,

I put the following in newpackage.mk :

include package/newpackage/A.mk.in
include package/newpackage/B.mk.in
etc...

And Oh My God, it worked!
All the variables and other stuff from those files were now visible in main newpackage.mk!

Thanks Samuel ! :)

Stefan