Add DEBUG to td.

This commit is contained in:
Jordan Bancino 2022-08-10 10:49:17 -04:00
parent 2b9b6368ba
commit e0a66ad58a
2 changed files with 10 additions and 0 deletions

View file

@ -880,6 +880,10 @@ builds faster. This recipe makes use of many environment variables:
<li><code>PROG</code>: The name of the output binary</li>
<li><code>DEFINES</code>: Global preprocessor definitions</li>
<li><code>INCLUDES</code>: Header directories to make available</li>
<li><code>DEBUG</code>: If set to "1", append some debug flags to
<code>CFLAGS</code>, and wipe out any <code>LDFLAGS</code> that
would cause the output binary to be optimized. Also appends "-debug"
to <code>PROG</code>.</li>
</ul>
<code>TELODENDRIA_VERSION</code> also makes its way into the output
binary, but it is primarily used for generating releases.

View file

@ -39,6 +39,12 @@ if [ -f "$(pwd)/.env" ]; then
. "$(pwd)/.env"
fi
if [ "$DEBUG" = "1" ]; then
CFLAGS="$CFLAGS -O0 -g"
LDFLAGS=""
PROG="$PROG-debug"
fi
# Check the modificiation time of a file. This is used to do
# incremental builds; we only want to rebuild files that have
# have changed.