Jimmy Brisson | 0862f01 | 2020-04-02 15:19:12 -0500 | [diff] [blame] | 1 | Checking source code style |
| 2 | -------------------------- |
| 3 | |
| 4 | When making changes to the source for submission to the project, the source must |
| 5 | be in compliance with the Linux style guide. To assist with this, the project |
| 6 | Makefile provides two targets, which both utilise the ``checkpatch.pl`` script |
| 7 | that ships with the Linux source tree. |
| 8 | |
| 9 | To check the entire source tree, you must first download copies of |
| 10 | ``checkpatch.pl``, ``spelling.txt`` and ``const_structs.checkpatch`` available |
| 11 | in the `Linux master tree`_ scripts directory, then set the ``CHECKPATCH`` |
| 12 | environment variable to point to ``checkpatch.pl`` (with the other 2 files in |
| 13 | the same directory). |
| 14 | |
| 15 | Then use the following command: |
| 16 | |
| 17 | :: |
| 18 | |
| 19 | make CHECKPATCH=<path-to-linux>/linux/scripts/checkpatch.pl checkcodebase |
| 20 | |
| 21 | To limit the coding style checks to your local changes, use: |
| 22 | |
| 23 | :: |
| 24 | |
| 25 | make CHECKPATCH=<path-to-linux>/linux/scripts/checkpatch.pl checkpatch |
| 26 | |
| 27 | By default, this will check all patches between ``origin/master`` and your local |
| 28 | branch. If you wish to use a different reference commit, this can be specified |
| 29 | using the ``BASE_COMMIT`` variable. |
| 30 | |
| 31 | -------------- |
| 32 | |
| 33 | *Copyright (c) 2019, Arm Limited. All rights reserved.* |
| 34 | |
| 35 | .. _Linux master tree: https://github.com/torvalds/linux/tree/master/ |