You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

148 lines
5.7 KiB

  1. /** @page primerautotools OpenOCD Autotools Primer
  2. This page provides an overview to OpenOCD's use of the GNU autotool suite:
  3. - @ref primerautoconf
  4. - @ref primerautomake
  5. - @ref primerlibtool
  6. Most developers do not need to concern themselves with these tools, as
  7. the @ref primerbootstrap script runs these tools in the required sequence.
  8. @section primerbootstrap Autotools Bootstrap
  9. The @c bootstrap script should be used by developers to run the
  10. autotools in the correct sequence.
  11. When run after a fresh checkout, this script generates the build files
  12. required to compile the project, producing the project configure script.
  13. After running @c configure, the @ref primermaintainermode settings will
  14. handle most situations that require running these tools again. In some
  15. cases, a fresh bootstrap may be still required.
  16. @subsection primerbootstrapcures Problems Solved By Bootstrap
  17. For example, the build system can fail in unexpected ways after running
  18. <code>git pull</code>. Here, the <code>make maintainer-clean</code>
  19. should be used to remove all of the files generated by the @c bootstrap
  20. script and subsequent build processes.
  21. In this particular case, one may also need to remove stray files by hand
  22. after running this command to ensure everything is rebuilt properly.
  23. This step should be necessary only if the @c maintainer-clean was run
  24. @b after altering the build system files with git. If it is run
  25. @b before any updates, the build system should never leave artifacts
  26. in the tree.
  27. Without such precautions, changes can be introduced that leave the tree
  28. timestamps in an inconsistent state, producing strange compile errors
  29. that are resolve after such diligence.
  30. @subsection primermaintainerclean Autotools Cleaning
  31. Normally, all files generated by the bootstrap script, configure
  32. process, and build system should be removed after running <code>make
  33. maintainer-clean</code>. Automatically generated files that remain
  34. after this should be listed in @c MAINTAINERCLEANFILES,
  35. @c DISTCLEANFILES, or @c CLEANFILES, depending on which stage of the
  36. build process they are produced.
  37. @section primerautoconf Autoconf Configuration Script
  38. The @c autoconf program generates the @c configure script from
  39. @c, using serious Perl voodoo. The resulting script is
  40. included in the project distribution packages and run by users to
  41. configure the build process for their system.
  42. @section primerautomake Automake Makefiles
  43. The @c automake program generates @c files (from @c
  44. files). These files are later processed by the configure
  45. script produced by @c autoconf.
  46. @subsection primerautomakenewfiles Creating Files
  47. This section shows how to add a @c in a new directory (or
  48. one that lacks one).
  49. -# The new directory must be listed in the @c SUBDIRS variable in the
  50. parent directory's
  51. @code
  52. $ echo 'SUBDIRS += directory' >>../
  53. @endcode
  54. -# Create an bare-bones file in directory that needs it:
  55. @code
  57. @endcode
  58. -# The @c script must be updated, so it generates the required
  59. Makefile when the @a configure script is run by the user:
  60. @verbatim
  61. AC_OUTPUT([
  62. ...
  63. path/to/new/Makefile
  64. ])
  65. @endverbatim
  66. Note: these instructions are @b not meant to be used literally, rather
  67. they are shown for demonstration purposes.
  68. The default MAINTAINERCLEANFILES rule ensures that the
  69. automake-generated @c file will be removed when developers
  70. run <code>make maintainer-clean</code>. Additional rules may be added
  71. after this; however, the project should bootstrap and tear down cleanly
  72. after taking these minimal steps, with the new directory being visited
  73. during the @c make sequence.
  74. @subsection primerautomaketweaks Updating Files
  75. Adding, removing, and renaming files from the project tree usually
  76. requires updating the autotools inputs. This section will help describe
  77. how to do this as questions arise.
  78. @section primerlibtool Libtool and Libraries
  79. The @c libtool program provides the means of generating libraries in a
  80. portable and painless manner (relatively speaking).
  81. This section will contain an answer to "what does libtool give OpenOCD?"
  82. and "what do developers need to consider in new code?"
  83. @section primerautotoolsmation Autotools Automation
  84. This section outlines three ways the autotools provides automation to
  85. assist with testing and distribution:
  86. - @ref primerautocheck -- automatic unit and smoke tests
  87. - @ref primerautodistcheck -- automatic distribution and packaging tests
  88. @subsection primerautocheck make check
  89. The <code>make check</code> command will run the OpenOCD test suite,
  90. once it has been integrated as such. This section will contain
  91. information about how to extend the testing build system components to
  92. implement new checks.
  93. @subsection primerautodistcheck make distcheck
  94. The <code>make distcheck</code> command produces an archive of the
  95. project deliverables (using <code>make dist</code>) and verifies its
  96. integrity for distribution by attemptng to use the package in the same
  97. manner as a user.
  98. These checks includes the following steps:
  99. -# Unpack the project archive into its expected directory.
  100. -# Configure and build the project in a temporary out-of-tree directory.
  101. -# Run <code>make check</code> to ensure the distributed code passes all tests.
  102. -# Run <code>make install</code> into a temporary installation directory.
  103. -# Check that <code>make uninstall</code> removes all files that were installed.
  104. -# Check that <code>make distclean</code> removes all files created
  105. during all other steps (except the first).
  106. If all of these steps complete successfully, the @c make process will
  107. output a friendly message indicating the archive is ready to be
  108. distributed.
  109. */
  110. /** @file
  111. This file contains the @ref primerautotools page.
  112. */