log/build: Use 'if' conditional not 'test'

Test exits with error code 1 if a condition is not met, so should not be
used to perform conditional actions as this will cause make to exit
with an error.