summaryrefslogtreecommitdiff
path: root/docs/writing-rules.txt
blob: 60f496eaf01c05540584c955d15c6146089b2e69 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
// -*- mode:doc; -*-
// vim: set syntax=asciidoc:

Coding style
------------

Overall, these coding style rules are here to help you to add new files in
OpenADK or refactor existing ones.

[[writing-rules-config-in]]

+Config.in+
~~~~~~~~~~~

+Config.in+ files contain entries for almost anything configurable in
OpenADK. Mostly all Config.in files for packages are autogenerated and
should not be manually edited. The following rules apply for the top level
Config.in, for the files in target/config and target/linux/config.

An entry has the following pattern:

---------------------
config ADK_TARGET_FOO
	bool "foo"
	select BR2_PACKAGE_LIBBAR
	depends on ADK_PACKAGE_LIBBAZ
	default n
	help
	  This is a comment that explains what foo is.

	  http://foo.org/foo/
---------------------

* The +bool+, +depends on+, +default+, +select+ and +help+ lines are indented
  with one tab.

* The help text itself should be indented with one tab and two
  spaces.

The +Config.in+ files are the input for the configuration tool
used in OpenADK, which is an enhanced version of _Kconfig_. For further
details about the _Kconfig_ language, refer to
http://kernel.org/doc/Documentation/kbuild/kconfig-language.txt[].

[[writing-rules-mk]]

+Makefile+
~~~~~~~~~~

* Header: The file starts with a license header.
+
---------------------
# This file is part of the OpenADK project. OpenADK is copyrighted
# material, please see the LICENCE file in the top-level directory.
---------------------
+
* Assignment: use +:=+ or ++=+ followed by two tabs:
+
---------------------
PKG_VERSION:=		1.0
PKG_BUILDDEP+=		libfoo
---------------------
+

* Indentation: use tab only:
+
---------------------
libfoo-install:
	$(CP) $(WRKINST)/usr/lib/libfoo*.so* \
		$(IDIR_LIBFOO)/usr/lib
---------------------
+

* Optional dependency:

** Prefer multi-line syntax.
---------------------
ifeq ($(ADK_PACKAGE_LIBFOO_WITH_PYTHON),y)
CONFIGURE_ARGS+=	--with-python-support
else
CONFIGURE_ARGS+=	--without-python-support
endif
---------------------

Documentation
~~~~~~~~~~~~~

The documentation uses the
http://www.methods.co.nz/asciidoc/[asciidoc] format.

For further details about the http://www.methods.co.nz/asciidoc/[asciidoc]
syntax, refer to http://www.methods.co.nz/asciidoc/userguide.html[].