In shell quotes are pretty important so:
CFLAGS="-c --sysroot=$sysroot"
otherwise BASH interprets it as 2 different argument.
Alternatively you can use arrays to store it:
CFLAGS=("-c" "--sysroot=$sysroot")
And use them later as:
"${CFLAGS[@]}"
very important to quote the array expansion.