* [Buildroot] How to include Buildroot defines? @ 2013-05-23 12:53 Morten Kvistgaard 2013-05-23 13:06 ` Thomas Petazzoni 0 siblings, 1 reply; 3+ messages in thread From: Morten Kvistgaard @ 2013-05-23 12:53 UTC (permalink / raw) To: buildroot Hello, I'm currently converting my uClinux to Buildroot. In my uClinux I could include the "KConfig result" in my programs. That way I could customize a program in the menuconfig. Eg. with extra options or by including apps etc. This could look something like: #include <config/autoconf.h> #ifdef CONFIG_USER_MYAPP_OPTION //Menuconfig tells me to build featureX #endif This was an easy way to handle static options. I can see that Buildroot also has a autoconf.h. It's located in output/build/buildroot-config/. How do I include this in a correct way? Or is this a bad way to do it? Regards, Morten Kvistgaard -------------- next part -------------- An HTML attachment was scrubbed... URL: <http://lists.busybox.net/pipermail/buildroot/attachments/20130523/e7097416/attachment.html> ^ permalink raw reply [flat|nested] 3+ messages in thread
* [Buildroot] How to include Buildroot defines? 2013-05-23 12:53 [Buildroot] How to include Buildroot defines? Morten Kvistgaard @ 2013-05-23 13:06 ` Thomas Petazzoni 2013-05-23 13:33 ` Morten Kvistgaard 0 siblings, 1 reply; 3+ messages in thread From: Thomas Petazzoni @ 2013-05-23 13:06 UTC (permalink / raw) To: buildroot Dear Morten Kvistgaard, On Thu, 23 May 2013 14:53:15 +0200, Morten Kvistgaard wrote: > I'm currently converting my uClinux to Buildroot. Nice. Which hardware platform are you working with? > In my uClinux I could include the "KConfig result" in my programs. > That way I could customize a program in the menuconfig. Eg. with > extra options or by including apps etc. This could look something > like: > > #include <config/autoconf.h> > > #ifdef CONFIG_USER_MYAPP_OPTION > //Menuconfig tells me to build featureX > #endif > > > This was an easy way to handle static options. > I can see that Buildroot also has a autoconf.h. It's located in > output/build/buildroot-config/. > > How do I include this in a correct way? Or is this a bad way to do it? Yes, I would say it's not how things should be done. Instead, your package recipe maybe be passing different options to your program configure or build process, depending on Buildroot Kconfig options. That's what we do for all the packages. For example in package/yourprog/Config.in: config BR2_PACKAGE_YOURPROG bool "yourprog" help This option enables the build of your program. config BR2_PACKAGE_YOURPROG_OPTIONA bool "feature A" depends on BR2_PACKAGE_YOURPROG help This option enables some feature A in your program and then, in package/yourprog/yourprog.mk: ifeq ($(BR2_PACKAGE_YOURPROG_OPTIONA),y) YOURPROG_CONF_OPT += --enable-featurea endif if your package is autotools based. Or, if it's just a simple Makefile that takes some environment variables: ifeq ($(BR2_PACKAGE_YOURPROG_OPTIONA),y) YOURPROG_MAKE_ENV += FEATUREA=YES endif define YOURPROG_BUILD_CMDS $(YOURPROG_MAKE_ENV) $(MAKE) -C $(@D) endef And that's it. Thomas -- Thomas Petazzoni, Free Electrons Kernel, drivers, real-time and embedded Linux development, consulting, training and support. http://free-electrons.com ^ permalink raw reply [flat|nested] 3+ messages in thread
* [Buildroot] How to include Buildroot defines? 2013-05-23 13:06 ` Thomas Petazzoni @ 2013-05-23 13:33 ` Morten Kvistgaard 0 siblings, 0 replies; 3+ messages in thread From: Morten Kvistgaard @ 2013-05-23 13:33 UTC (permalink / raw) To: buildroot Hello Thomas, > Nice. Which hardware platform are you working with? I'm using several blackfin (Analog Devices) based platforms. > Yes, I would say it's not how things should be done ... Yes, I thought that might be case. Takes a bit of work to convert the Config.mk options to ENV options though :-/ Thanks for the YOURPROG_MAKE_ENV sample. Very useful. Regards, Morten Kvistgaard -----Original Message----- From: Thomas Petazzoni [mailto:thomas.petazzoni at free-electrons.com] Sent: 23. maj 2013 15:07 To: Morten Kvistgaard Cc: buildroot at busybox.net Subject: Re: [Buildroot] How to include Buildroot defines? Dear Morten Kvistgaard, On Thu, 23 May 2013 14:53:15 +0200, Morten Kvistgaard wrote: > I'm currently converting my uClinux to Buildroot. Nice. Which hardware platform are you working with? > In my uClinux I could include the "KConfig result" in my programs. > That way I could customize a program in the menuconfig. Eg. with extra > options or by including apps etc. This could look something > like: > > #include <config/autoconf.h> > > #ifdef CONFIG_USER_MYAPP_OPTION > //Menuconfig tells me to build featureX #endif > > > This was an easy way to handle static options. > I can see that Buildroot also has a autoconf.h. It's located in > output/build/buildroot-config/. > > How do I include this in a correct way? Or is this a bad way to do it? Yes, I would say it's not how things should be done. Instead, your package recipe maybe be passing different options to your program configure or build process, depending on Buildroot Kconfig options. That's what we do for all the packages. For example in package/yourprog/Config.in: config BR2_PACKAGE_YOURPROG bool "yourprog" help This option enables the build of your program. config BR2_PACKAGE_YOURPROG_OPTIONA bool "feature A" depends on BR2_PACKAGE_YOURPROG help This option enables some feature A in your program and then, in package/yourprog/yourprog.mk: ifeq ($(BR2_PACKAGE_YOURPROG_OPTIONA),y) YOURPROG_CONF_OPT += --enable-featurea endif if your package is autotools based. Or, if it's just a simple Makefile that takes some environment variables: ifeq ($(BR2_PACKAGE_YOURPROG_OPTIONA),y) YOURPROG_MAKE_ENV += FEATUREA=YES endif define YOURPROG_BUILD_CMDS $(YOURPROG_MAKE_ENV) $(MAKE) -C $(@D) endef And that's it. Thomas -- Thomas Petazzoni, Free Electrons Kernel, drivers, real-time and embedded Linux development, consulting, training and support. http://free-electrons.com ^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2013-05-23 13:33 UTC | newest] Thread overview: 3+ messages (download: mbox.gz follow: Atom feed -- links below jump to the message on this page -- 2013-05-23 12:53 [Buildroot] How to include Buildroot defines? Morten Kvistgaard 2013-05-23 13:06 ` Thomas Petazzoni 2013-05-23 13:33 ` Morten Kvistgaard
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox