• Skip to sidebar navigation
  • Skip to content

Bitbucket

  • More
    ProjectsRepositories
  • Help
    • Online help
    • Learn Git
    • Welcome to Bitbucket
    • Keyboard shortcuts
  • Log In
Alexander Dahl
  1. Alexander Dahl

buildroot

Public
Actions
  • Clone
  • Compare

Learn more about cloning repositories

You have read-only access

Navigation
  • Source
  • Commits
  • Branches
  • All Branches Graph
  • Forks
  1. Alexander Dahl
  2. buildroot

Source

buildroot/docs/manual/writing-rules.txt
Thomas PetazzoniThomas Petazzoni committed 7ca9fc3170d01 Jul 2017
Raw file
Source viewDiff to previous
xxxxxxxxxx
 
1
// -*- mode:doc; -*-
2
// vim: set syntax=asciidoc:
3
​
4
== Coding style
5
​
6
Overall, these coding style rules are here to help you to add new files in
7
Buildroot or refactor existing ones.
8
​
9
If you slightly modify some existing file, the important thing is
10
to keep the consistency of the whole file, so you can:
11
​
12
* either follow the potentially deprecated coding style used in this
13
file,
14
​
15
* or entirely rework it in order to make it comply with these rules.
16
​
17
[[writing-rules-config-in]]
18
​
19
=== +Config.in+ file
20
​
21
+Config.in+ files contain entries for almost anything configurable in
22
Buildroot.
23
​
24
An entry has the following pattern:
25
​
26
---------------------
27
config BR2_PACKAGE_LIBFOO
28
    bool "libfoo"
29
    depends on BR2_PACKAGE_LIBBAZ
30
    select BR2_PACKAGE_LIBBAR
31
    help
32
      This is a comment that explains what libfoo is. The help text
33
      should be wrapped.
34
​
35
      http://foosoftware.org/libfoo/
36
---------------------
37
​
38
* The +bool+, +depends on+, +select+ and +help+ lines are indented
39
  with one tab.
40
​
41
* The help text itself should be indented with one tab and two
42
  spaces.
43
​
44
* The help text should be wrapped to fit 72 columns, where tab counts
45
  for 8, so 62 characters in the text itself.
46
​
47
The +Config.in+ files are the input for the configuration tool
48
used in Buildroot, which is the regular _Kconfig_. For further
49
details about the _Kconfig_ language, refer to
50
http://kernel.org/doc/Documentation/kbuild/kconfig-language.txt[].
51
​
52
[[writing-rules-mk]]
53
​
54
=== The +.mk+ file
55
​
56
* Header: The file starts with a header. It contains the module name,
57
preferably in lowercase, enclosed between separators made of 80 hashes. A
58
blank line is mandatory after the header:
59
+
60
---------------------
61
################################################################################
62
#
63
# libfoo
64
#
65
################################################################################
66
---------------------
67
+
68
* Assignment: use +=+ preceded and followed by one space:
69
+
70
---------------------
71
LIBFOO_VERSION = 1.0
72
LIBFOO_CONF_OPTS += --without-python-support
73
---------------------
74
+
75
Do not align the +=+ signs.
76
​
77
* Indentation: use tab only:
78
+
79
---------------------
80
define LIBFOO_REMOVE_DOC
81
    $(RM) -fr $(TARGET_DIR)/usr/share/libfoo/doc \
82
        $(TARGET_DIR)/usr/share/man/man3/libfoo*
83
endef
84
---------------------
85
+
86
Note that commands inside a +define+ block should always start with a tab,
87
so _make_ recognizes them as commands.
88
​
89
* Optional dependency:
90
​
91
** Prefer multi-line syntax.
92
+
  • Git repository management for enterprise teams powered by Atlassian Bitbucket
  • Atlassian Bitbucket v6.7.2
  • Documentation
  • Request a feature
  • About
  • Contact Atlassian
Atlassian

Everything looks good. We'll let you know here if there's anything you should know about.