changed build fail behavior, added clean checks

This commit is contained in:
Noah Swerhun 2021-12-24 10:49:26 -06:00
parent c29f47851f
commit 3a9379f32c
2 changed files with 13 additions and 6 deletions

BIN
a.out Executable file

Binary file not shown.

View file

@ -117,22 +117,29 @@ build() {
export_vars export_vars
make -f "${MAKEFILE}" -e "${TARGET}" -n | grep "^${CC}" | wc -l > .cbuild_prog.tmp make -f "${MAKEFILE}" -e "${TARGET}" -n | grep "^${CC}" | wc -l > .cbuild_prog.tmp
info "Beginning build..." info "Beginning build..."
make -f "${MAKEFILE}" -e "${TARGET}" && make -f "${MAKEFILE}" -e "${TARGET}"
ret=$?
[ "${ret}" = 0 ] &&
info "Build SUCCESSFUL" || info "Build SUCCESSFUL" ||
err "Build FAILURE" err "Build FAILURE"
rm .cbuild_prog.tmp rm .cbuild_prog.tmp
return "${ret}"
} }
clean() { clean() {
rm -rf "${OBJDIR}" [ -d "${OBJDIR}" ] &&
chmod +w "${MAKEFILE}" rm -rf "${OBJDIR}"
rm "${TARGET}" "${MAKEFILE}" [ -f "${MAKEFILE}" ] &&
chmod +w "${MAKEFILE}"
[ -f "${TARGET}" ] && [ -f "${MAKEFILE}" ] &&
rm "${TARGET}" "${MAKEFILE}"
} }
run() { run() {
build build || exit $?
info "Running ./${TARGET}" info "Running ./${TARGET}"
"./${TARGET}" "./${TARGET}" ||
err "Run FAILURE ./${TARGET} returned $?"
} }
dry_run() { dry_run() {