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 +Config.in+ files are the input for the configuration tool
44 used in Buildroot, which is the regular _Kconfig_. For further
45 details about the _Kconfig_ language, refer to
46 http://kernel.org/doc/Documentation/kbuild/kconfig-language.txt[].
52 * Header: The file starts with a header. It contains the module name,
53 preferably in lowercase, enclosed between separators made of 80 hashes. A
54 blank line is mandatory after the header:
57 ################################################################################
61 ################################################################################
64 * Assignment: use +=+ preceded and followed by one space:
68 LIBFOO_CONF_OPTS += --without-python-support
71 Do not align the +=+ signs.
73 * Indentation: use tab only:
76 define LIBFOO_REMOVE_DOC
77 $(RM) -fr $(TARGET_DIR)/usr/share/libfoo/doc \
78 $(TARGET_DIR)/usr/share/man/man3/libfoo*
82 Note that commands inside a +define+ block should always start with a tab,
83 so _make_ recognizes them as commands.
85 * Optional dependency:
87 ** Prefer multi-line syntax.
92 ifeq ($(BR2_PACKAGE_PYTHON),y)
93 LIBFOO_CONF_OPTS += --with-python-support
94 LIBFOO_DEPENDENCIES += python
96 LIBFOO_CONF_OPTS += --without-python-support
102 ---------------------
103 LIBFOO_CONF_OPTS += --with$(if $(BR2_PACKAGE_PYTHON),,out)-python-support
104 LIBFOO_DEPENDENCIES += $(if $(BR2_PACKAGE_PYTHON),python,)
105 ---------------------
107 ** Keep configure options and dependencies close together.
109 * Optional hooks: keep hook definition and assignment together in one
114 ---------------------
115 ifneq ($(BR2_LIBFOO_INSTALL_DATA),y)
116 define LIBFOO_REMOVE_DATA
117 $(RM) -fr $(TARGET_DIR)/usr/share/libfoo/data
119 LIBFOO_POST_INSTALL_TARGET_HOOKS += LIBFOO_REMOVE_DATA
121 ---------------------
125 ---------------------
126 define LIBFOO_REMOVE_DATA
127 $(RM) -fr $(TARGET_DIR)/usr/share/libfoo/data
130 ifneq ($(BR2_LIBFOO_INSTALL_DATA),y)
131 LIBFOO_POST_INSTALL_TARGET_HOOKS += LIBFOO_REMOVE_DATA
133 ---------------------
135 === The documentation
137 The documentation uses the
138 http://www.methods.co.nz/asciidoc/[asciidoc] format.
140 For further details about the http://www.methods.co.nz/asciidoc/[asciidoc]
141 syntax, refer to http://www.methods.co.nz/asciidoc/userguide.html[].