writing-rules.txt 2.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192
  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. select BR2_PACKAGE_LIBBAR
  19. depends on ADK_PACKAGE_LIBBAZ
  20. default n
  21. help
  22. This is a comment that explains what foo is.
  23. http://foo.org/foo/
  24. ---------------------
  25. * The +bool+, +depends on+, +default+, +select+ and +help+ lines are indented
  26. with one tab.
  27. * The help text itself should be indented with one tab and two
  28. spaces.
  29. The +Config.in+ files are the input for the configuration tool
  30. used in OpenADK, which is an enhanced version of _Kconfig_. For further
  31. details about the _Kconfig_ language, refer to
  32. http://kernel.org/doc/Documentation/kbuild/kconfig-language.txt[].
  33. [[writing-rules-mk]]
  34. +Makefile+
  35. ~~~~~~~~~~
  36. * Header: The file starts with a license header.
  37. +
  38. ---------------------
  39. # This file is part of the OpenADK project. OpenADK is copyrighted
  40. # material, please see the LICENCE file in the top-level directory.
  41. ---------------------
  42. +
  43. * Assignment: use +:=+ or ++=+ followed by two tabs:
  44. +
  45. ---------------------
  46. PKG_VERSION:= 1.0
  47. PKG_BUILDDEP+= libfoo
  48. ---------------------
  49. +
  50. * Indentation: use tab only:
  51. +
  52. ---------------------
  53. libfoo-install:
  54. $(CP) $(WRKINST)/usr/lib/libfoo*.so* \
  55. $(IDIR_LIBFOO)/usr/lib
  56. ---------------------
  57. +
  58. * Optional dependency:
  59. ** Prefer multi-line syntax.
  60. ---------------------
  61. ifeq ($(ADK_PACKAGE_LIBFOO_WITH_PYTHON),y)
  62. CONFIGURE_ARGS+= --with-python-support
  63. else
  64. CONFIGURE_ARGS+= --without-python-support
  65. endif
  66. ---------------------
  67. Documentation
  68. ~~~~~~~~~~~~~
  69. The documentation uses the
  70. http://www.methods.co.nz/asciidoc/[asciidoc] format.
  71. For further details about the http://www.methods.co.nz/asciidoc/[asciidoc]
  72. syntax, refer to http://www.methods.co.nz/asciidoc/userguide.html[].