2 // vim: set syntax=asciidoc:
6 Overall, these coding style rules are here to help you to add new files in
7 Buildroot or refactor existing ones.
9 If you slightly modify some existing file, the important thing is
10 to keep the consistency of the whole file, so you can:
12 * either follow the potentially deprecated coding style used in this
15 * or entirely rework it in order to make it comply with these rules.
17 [[writing-rules-config-in]]
21 +Config.in+ files contain entries for almost anything configurable in
24 An entry has the following pattern:
27 config BR2_PACKAGE_LIBFOO
29 depends on BR2_PACKAGE_LIBBAZ
30 select BR2_PACKAGE_LIBBAR
32 This is a comment that explains what libfoo is.
34 http://foosoftware.org/libfoo/
37 * The +bool+, +depends on+, +select+ and +help+ lines are indented
40 * The help text itself should be indented with one tab and two
43 * The help text should be wrapped to fit 72 columns.
45 The +Config.in+ files are the input for the configuration tool
46 used in Buildroot, which is the regular _Kconfig_. For further
47 details about the _Kconfig_ language, refer to
48 http://kernel.org/doc/Documentation/kbuild/kconfig-language.txt[].
54 * Header: The file starts with a header. It contains the module name,
55 preferably in lowercase, enclosed between separators made of 80 hashes. A
56 blank line is mandatory after the header:
59 ################################################################################
63 ################################################################################
66 * Assignment: use +=+ preceded and followed by one space:
70 LIBFOO_CONF_OPTS += --without-python-support
73 Do not align the +=+ signs.
75 * Indentation: use tab only:
78 define LIBFOO_REMOVE_DOC
79 $(RM) -fr $(TARGET_DIR)/usr/share/libfoo/doc \
80 $(TARGET_DIR)/usr/share/man/man3/libfoo*
84 Note that commands inside a +define+ block should always start with a tab,
85 so _make_ recognizes them as commands.
87 * Optional dependency:
89 ** Prefer multi-line syntax.
94 ifeq ($(BR2_PACKAGE_PYTHON),y)
95 LIBFOO_CONF_OPTS += --with-python-support
96 LIBFOO_DEPENDENCIES += python
98 LIBFOO_CONF_OPTS += --without-python-support
100 ---------------------
104 ---------------------
105 LIBFOO_CONF_OPTS += --with$(if $(BR2_PACKAGE_PYTHON),,out)-python-support
106 LIBFOO_DEPENDENCIES += $(if $(BR2_PACKAGE_PYTHON),python,)
107 ---------------------
109 ** Keep configure options and dependencies close together.
111 * Optional hooks: keep hook definition and assignment together in one
116 ---------------------
117 ifneq ($(BR2_LIBFOO_INSTALL_DATA),y)
118 define LIBFOO_REMOVE_DATA
119 $(RM) -fr $(TARGET_DIR)/usr/share/libfoo/data
121 LIBFOO_POST_INSTALL_TARGET_HOOKS += LIBFOO_REMOVE_DATA
123 ---------------------
127 ---------------------
128 define LIBFOO_REMOVE_DATA
129 $(RM) -fr $(TARGET_DIR)/usr/share/libfoo/data
132 ifneq ($(BR2_LIBFOO_INSTALL_DATA),y)
133 LIBFOO_POST_INSTALL_TARGET_HOOKS += LIBFOO_REMOVE_DATA
135 ---------------------
137 === The documentation
139 The documentation uses the
140 http://www.methods.co.nz/asciidoc/[asciidoc] format.
142 For further details about the http://www.methods.co.nz/asciidoc/[asciidoc]
143 syntax, refer to http://www.methods.co.nz/asciidoc/userguide.html[].