writing-rules.txt 2.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091
  1. // -*- mode:doc; -*-
  2. // vim: set syntax=asciidoc:
  3. Coding style
  4. ------------
  5. Overall, these coding style rules are here to help you to add new files in
  6. OpenADK or refactor existing ones.
  7. [[writing-rules-config-in]]
  8. +Config.in+
  9. ~~~~~~~~~~~
  10. +Config.in+ files contain entries for almost anything configurable in
  11. OpenADK. Mostly all Config.in files for packages are autogenerated and
  12. should not be manually edited. The following rules apply for the top level
  13. Config.in, for the files in target/config and target/linux/config.
  14. An entry has the following pattern:
  15. ---------------------
  16. config ADK_TARGET_FOO
  17. bool "foo"
  18. depends on ADK_PACKAGE_LIBBAZ
  19. select BR2_PACKAGE_LIBBAR
  20. help
  21. This is a comment that explains what foo is.
  22. http://foo.org/foo/
  23. ---------------------
  24. * The +bool+, +depends on+, +select+ and +help+ lines are indented
  25. with one tab.
  26. * The help text itself should be indented with one tab and two
  27. spaces.
  28. The +Config.in+ files are the input for the configuration tool
  29. used in OpenADK, which is the regular _Kconfig_. For further
  30. details about the _Kconfig_ language, refer to
  31. http://kernel.org/doc/Documentation/kbuild/kconfig-language.txt[].
  32. [[writing-rules-mk]]
  33. +Makefile+
  34. ~~~~~~~~~~
  35. * Header: The file starts with a license header.
  36. +
  37. ---------------------
  38. # This file is part of the OpenADK project. OpenADK is copyrighted
  39. # material, please see the LICENCE file in the top-level directory.
  40. ---------------------
  41. +
  42. * Assignment: use +=+ followed by two tabs:
  43. +
  44. ---------------------
  45. PKG_VERSION:= 1.0
  46. PKG_BUILDDEP+= libfoo
  47. ---------------------
  48. +
  49. * Indentation: use tab only:
  50. +
  51. ---------------------
  52. libfoo-install:
  53. $(CP) $(WRKINST)/usr/lib/libfoo*.so* \
  54. $(IDIR_LIBFOO)/usr/lib
  55. ---------------------
  56. +
  57. * Optional dependency:
  58. ** Prefer multi-line syntax.
  59. ---------------------
  60. ifeq ($(ADK_PACKAGE_LIBFOO_WITH_PYTHON),y)
  61. CONFIGURE_ARGS+= --with-python-support
  62. else
  63. CONFIGURE_ARGS+= --without-python-support
  64. endif
  65. ---------------------
  66. Documentation
  67. ~~~~~~~~~~~~~
  68. The documentation uses the
  69. http://www.methods.co.nz/asciidoc/[asciidoc] format.
  70. For further details about the http://www.methods.co.nz/asciidoc/[asciidoc]
  71. syntax, refer to http://www.methods.co.nz/asciidoc/userguide.html[].