writing-rules.txt 2.2 KB

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