diff options
author | Egor Tensin <Egor.Tensin@gmail.com> | 2016-06-13 18:28:40 +0300 |
---|---|---|
committer | Egor Tensin <Egor.Tensin@gmail.com> | 2016-06-13 18:28:40 +0300 |
commit | 1e0dac984294a514353f7b300b563ee810eb64c4 (patch) | |
tree | 62274434c0e6b972432efdb96c54505b440476c1 | |
parent | trimbom8 -> trimbom (diff) | |
download | linux-home-1e0dac984294a514353f7b300b563ee810eb64c4.tar.gz linux-home-1e0dac984294a514353f7b300b563ee810eb64c4.zip |
add runc/runcpp functions
-rw-r--r-- | .bashrc | 38 |
1 files changed, 38 insertions, 0 deletions
@@ -322,3 +322,41 @@ update_checksums_distr() { verify_checksums() { sha1sum --check "$checksums_path" } + +runc() ( + set -o errexit + + local -a src_files + local src_file + + for src_file in "$@"; do + src_files+=("$( realpath "$src_file" )") + done + + local build_dir="$( mktemp -d )" + pushd "$build_dir" > /dev/null + + set +o errexit + + gcc -Wall -Wextra "${src_files[@]}" && ./a.exe + popd > /dev/null && rm -rf "$build_dir" +) + +runcpp() ( + set -o errexit + + local -a src_files + local src_file + + for src_file in "$@"; do + src_files+=("$( realpath "$src_file" )") + done + + local build_dir="$( mktemp -d )" + pushd "$build_dir" > /dev/null + + set +o errexit + + g++ -std=c++14 -Wall -Wextra "${src_files[@]}" && ./a.exe + popd > /dev/null && rm -rf "$build_dir" +) |