mirror of
https://github.com/gbdev/rgbds.git
synced 2025-11-20 10:12:06 +00:00
Create makefile target to check all warnings
Remove '-Werror' from the default make target to make it easy for regular users of RGBDS to compile the source code. Only a few basic warnings are left in that target. All the warnings have been moved to a new target called 'develop'. This target is now the one used in Travis CI to check for problems during compilation. Signed-off-by: Antonio Niño Díaz <antonio_nd@outlook.com>
This commit is contained in:
@@ -70,24 +70,29 @@ copyright and the reference to the MIT License.
|
||||
3. Create a new branch to work on. You could still work on ``develop``, but it's
|
||||
easier that way.
|
||||
|
||||
4. Sign off your commits: ``git commit -s``
|
||||
4. Compile your changes with ``make develop`` instead of just ``make``. This
|
||||
target checks for additional warnings. Your patches shouldn't introduce any
|
||||
new warning (but it may be possible to remove some warning checks if it makes
|
||||
the code much easier).
|
||||
|
||||
5. Follow the Linux kernel coding style, which can be found in the file
|
||||
5. Sign off your commits: ``git commit -s``
|
||||
|
||||
6. Follow the Linux kernel coding style, which can be found in the file
|
||||
``Documentation/process/coding-style.rst`` in the Linux kernel repository.
|
||||
Note that the coding style isn't writen on stone, if there is a good reason
|
||||
to deviate from it, it should be fine.
|
||||
|
||||
6. Download the files ``checkpatch.pl``, ``const_structs.checkpatch`` and
|
||||
7. Download the files ``checkpatch.pl``, ``const_structs.checkpatch`` and
|
||||
``spelling.txt`` from the folder ``scripts`` in the Linux kernel repository.
|
||||
|
||||
7. To use ``checkpatch.pl`` you can use ``make checkpatch``, which will check
|
||||
8. To use ``checkpatch.pl`` you can use ``make checkpatch``, which will check
|
||||
the coding style of all patches between the current one and the upstream
|
||||
code. By default, the Makefile expects the script (and associate files) to be
|
||||
located in ``../linux/scripts/``, but you can place them anywhere you like as
|
||||
long as you specify it when executing the command:
|
||||
``CHECKPATCH=../path/to/folder make checkpatch``.
|
||||
|
||||
8. Create a pull request against the branch ``develop``.
|
||||
9. Create a pull request against the branch ``develop``.
|
||||
|
||||
9. Be prepared to get some comments about your code and to modify it. Tip: Use
|
||||
``git rebase -i origin/develop`` to modify chains of commits.
|
||||
10. Be prepared to get some comments about your code and to modify it. Tip: Use
|
||||
``git rebase -i origin/develop`` to modify chains of commits.
|
||||
|
||||
29
Makefile
29
Makefile
@@ -26,14 +26,7 @@ PNGLDLIBS := `${PKG_CONFIG} --static --libs-only-l libpng`
|
||||
|
||||
VERSION_STRING := `git describe --tags --dirty --always 2>/dev/null`
|
||||
|
||||
WARNFLAGS := -Werror -Wall -Wextra -Wpedantic -Wno-sign-compare -Wchkp \
|
||||
-Wformat=2 -Wformat-overflow=2 -Wformat-truncation=1 \
|
||||
-Wformat-y2k -Wswitch-enum -Wunused -Wuninitialized \
|
||||
-Wunknown-pragmas -Wstrict-overflow=5 -Wstringop-overflow=4 \
|
||||
-Walloc-zero -Wduplicated-cond -Wfloat-equal -Wshadow \
|
||||
-Wcast-qual -Wcast-align -Wlogical-op -Wnested-externs \
|
||||
-Wno-aggressive-loop-optimizations -Winline -Wundef \
|
||||
-Wstrict-prototypes -Wold-style-definition
|
||||
WARNFLAGS := -Wall
|
||||
|
||||
# Overridable CFLAGS
|
||||
CFLAGS := -g
|
||||
@@ -167,6 +160,7 @@ install: all
|
||||
|
||||
# Target used to check the coding style of the whole codebase. '.y' and '.l'
|
||||
# files aren't checked, unfortunately...
|
||||
|
||||
checkcodebase:
|
||||
$Qfor file in `git ls-files | grep -E '\.c|\.h' | grep -v '\.html'`; do \
|
||||
${CHECKPATCH} -f "$$file"; \
|
||||
@@ -176,6 +170,7 @@ checkcodebase:
|
||||
# to the HEAD. Runs checkpatch once for each commit between the current HEAD and
|
||||
# the first common commit between the HEAD and origin/develop. '.y' and '.l'
|
||||
# files aren't checked, unfortunately...
|
||||
|
||||
checkpatch:
|
||||
$Qeval COMMON_COMMIT=$$(git merge-base HEAD origin/develop); \
|
||||
for commit in `git rev-list $$COMMON_COMMIT..HEAD`; do \
|
||||
@@ -200,6 +195,20 @@ wwwman:
|
||||
$Qmandoc ${MANDOC} src/link/rgblink.5 > docs/rgblink.5.html
|
||||
$Qmandoc ${MANDOC} src/gfx/rgbgfx.1 > docs/rgbgfx.1.html
|
||||
|
||||
# This target is used during development in order to prevent adding new issues
|
||||
# to the source code. All warnings are treated as errors in order to block the
|
||||
# compilation and make the continous integration infrastructure return failure.
|
||||
|
||||
develop:
|
||||
$Qenv make -j WARNFLAGS="-Werror -Wall -Wextra -Wpedantic \
|
||||
-Wno-sign-compare -Wchkp -Wformat=2 -Wformat-overflow=2 \
|
||||
-Wformat-truncation=1 -Wformat-y2k -Wswitch-enum -Wunused \
|
||||
-Wuninitialized -Wunknown-pragmas -Wstrict-overflow=5 \
|
||||
-Wstringop-overflow=4 -Walloc-zero -Wduplicated-cond \
|
||||
-Wfloat-equal -Wshadow -Wcast-qual -Wcast-align -Wlogical-op \
|
||||
-Wnested-externs -Wno-aggressive-loop-optimizations -Winline \
|
||||
-Wundef -Wstrict-prototypes -Wold-style-definition"
|
||||
|
||||
# Targets for the project maintainer to easily create Windows exes.
|
||||
# This is not for Windows users!
|
||||
# If you're building on Windows with Cygwin or Mingw, just follow the Unix
|
||||
@@ -207,7 +216,7 @@ wwwman:
|
||||
|
||||
mingw32:
|
||||
$Qenv PKG_CONFIG_PATH=/usr/i686-w64-mingw32/sys-root/mingw/lib/pkgconfig/ \
|
||||
make CC=i686-w64-mingw32-gcc YACC=bison WARNFLAGS= -j
|
||||
make CC=i686-w64-mingw32-gcc YACC=bison -j
|
||||
$Qmv rgbasm rgbasm.exe
|
||||
$Qmv rgblink rgblink.exe
|
||||
$Qmv rgbfix rgbfix.exe
|
||||
@@ -215,7 +224,7 @@ mingw32:
|
||||
|
||||
mingw64:
|
||||
$Qenv PKG_CONFIG_PATH=/usr/x86_64-w64-mingw32/sys-root/mingw/lib/pkgconfig/ \
|
||||
make CC=x86_64-w64-mingw32-gcc YACC=bison WARNFLAGS= -j
|
||||
make CC=x86_64-w64-mingw32-gcc YACC=bison -j
|
||||
$Qmv rgbasm rgbasm.exe
|
||||
$Qmv rgblink rgblink.exe
|
||||
$Qmv rgbfix rgbfix.exe
|
||||
|
||||
Reference in New Issue
Block a user