mk-project code formatters¶
Introduction¶
mk-project provide severals utilities with many predefined targets for formatting your source code.
For C or C++ source code:¶
- indent
- astyle
- bcpp
Using the indent
utility¶
mk-project provide following predefined indent styles:
make indent-kr # Format all source files in the kr style.
make indent-gnu # Format all source files in the gnu style.
make indent-linux # Format all source files in the linux style.
make indent-orig # Format all source files in the original style.
make indent-user # Format all source files in the user defined style.
make indent-clean # Remove all formatted files with suffix.
note: | The indent-user target use the given options during the project configuration for formatting your source code. |
---|
Note
By launching any code formatting target mk-project will output a copy of all your source files suffixed with the corresponding target name:
Per example by using the indent-kr
target a file named main.c
will ouput as main-kr.c
.
For overwriting your source files really you must set the make variable OVERWRITE on the value T.
$ make indent-kr OVERWRITE=T
Using the astyle
utility¶
mk-project provide following predefined indent styles:
make astyle-ansi # Format all source files in the ansi style.
make astyle-java # Format all source files in the java style.
make astyle-kr # Format all source files in the kr style.
make astyle-stroustrup # Format all source files in the stroustrup style.
make astyle-whitesmith # Format all source files in the whitesmith style.
make astyle-banner # Format all source files in the banner style.
make astyle-gnu # Format all source files in the gnu style.
make astyle-linux # Format all source files in the linux style.
make astyle-horstmann # Format all source files in the horstmann style.
make astyle-lisp # Format all source files in the lisp style.
make astyle-pico # Format all source files in the pico style.
make astyle-python # Format all source files in the python style.
make astyle-user # Format all source files in the user defined style.
make astyle-clean # Remove all formatted files with suffix.
note: | The astyle-user target use the given options during the project configuration for formatting your source code. |
---|
Note
By launching any code formatting target mk-project will output a copy of all your source files suffixed with the corresponding target name:
Per example by using the astyle-kr
target a file named main.c
will ouput as main-kr.c
.
For overwriting your source files really you must set the make variable OVERWRITE on the value T.
$ make astyle-kr OVERWRITE=T