You can set byte-compile-error-on-warn value other than zero, as in:
$ emacs -Q --batch \ --eval '(setq byte-compile-error-on-warn t)' \ -f batch-byte-compile *.el
Now the byte compiler stops at the first warning, so you should make this parameter optional in your Makefile and use it only in CI settings.
If you need more sophisticated control than this, you should write your own post-processor, for example. A Python script that analyzes the output from the byte compiler and adjusts the exit code and / or output accordingly, or writes its own version of batch-byte-compile , which performs more complex processing.
source share