Return the build status as return code from the `main` helper function.
In the process convert the handling if the file was sourced or directly
executed into an explicit if/else statement to make the intent clearer.
In case of an build error the error is now reported at the build step,
where the error happened.
Fixes: https://github.com/InfiniTimeOrg/InfiniTime/issues/1292