From d06645d8eddce3a22144a9ef8961a8f7599d319e Mon Sep 17 00:00:00 2001 From: Eric Andersen Date: Thu, 10 Feb 2005 03:06:39 +0000 Subject: There is no need to have a separate 'Makefile.in' file in the general case, therefore, combine the toplevel Makefile options such as setting TARGETS into the per-package *.mk file --- docs/buildroot-documentation.html | 63 +++++++++++++++++++-------------------- 1 file changed, 31 insertions(+), 32 deletions(-) (limited to 'docs') diff --git a/docs/buildroot-documentation.html b/docs/buildroot-documentation.html index 35b824a7c..8897ff67e 100644 --- a/docs/buildroot-documentation.html +++ b/docs/buildroot-documentation.html @@ -292,7 +292,7 @@ skeleton. -

Each directory contains at least 3 files :

+

Each directory contains at least 2 files :

The main Makefile do the job through the following steps (once the @@ -343,9 +339,10 @@ target/default/target_skeleton and then removes useless CVS/ directories. -

  • Make the TARGETS dependency. This is where all the job - is done : all Makefile.in files "subscribe" targets into - this global variable, so that the needed tools gets compiled.
  • +
  • Add the TARGETS dependency. This should generally check + if the configuration option for this package is enabled, and if so then + "subscribe" this package to be compiled by adding it to the TARGETS + global variable.
  • Using the @@ -441,26 +438,6 @@ config BR2_PACKAGE_FOO

    Of course, you can add other options to configure particular things in your software.

    -

    Makefile.in file

    - -

    Then, write a Makefile.in file. Basically, this is - a very short Makefile that adds the name of the software to - the list of TARGETS that Buildroot will generate. In - fact, the name of the software is the the identifier of the target - inside the real Makefile that will do everything (download, - compile, install), and that we study below. Back to - Makefile.in, here is an example :

    - -
    -ifeq ($(strip $(BR2_PACKAGE_FOO)),y)
    -TARGETS+=foo
    -endif
    -
    - -

    As you can see, this short Makefile simply adds the - target foo to the list of targets handled by Buildroot - if software foo was selected using the configuration tool.

    -

    The real Makefile

    Finally, here's the hardest part. Create a file named @@ -520,6 +497,15 @@ endif 48 foo-dirclean: 49 rm -rf $(FOO_DIR) 50 + 51 ############################################################# + 52 # + 53 # Toplevel Makefile options + 54 # + 55 ############################################################# + 56 ifeq ($(strip $(BR2_PACKAGE_FOO)),y) + 57 TARGETS+=foo + 58 endif +

    First of all, this Makefile example works for a single @@ -602,11 +588,13 @@ endif removed to save space.

    Line 40 defines the main target of the software, the one - referenced in the Makefile.in file. This targets - should first of all depends on the dependecies of the software (in - our example, uclibc and ncurses), and then to the + that will be eventually be used by the top level + Makefile to download, compile, and then install + this package. This target should first of all depends on all + needed dependecies of the software (in our example, + uclibc and ncurses), and also depend on the final binary. This last dependency will call all previous - dependencies in the right order.

    + dependencies in the correct order.

    Line 42 defines a simple target that only downloads the code source. This is not used during normal operation of Buildroot, but @@ -619,6 +607,17 @@ endif directory in which the software was uncompressed, configured and compiled.

    +

    Lines 51-58 adds the target foo to the list + of targets to be compiled by Buildroot by first checking if + the configuration option for this package has been enabled + using the configuration tool, and if so then "subscribes" + this package to be compiled by adding it to the TARGETS + global variable. The name added to the TARGETS global + variable is the name of this package's target, as defined on + line 40, which is used by Buildroot to download, compile, and + then install this package.

    + +

    Conclusion

    As you can see, adding a software to buildroot is simply a -- cgit v1.2.3