From 35d858363a88f1d985ba36cf0e18de6ab0ccfcd1 Mon Sep 17 00:00:00 2001 From: Egor Tensin Date: Wed, 17 Aug 2016 22:58:15 +0200 Subject: move .bashrc_* to .bash_utils/ --- .bashrc_cxx | 118 ------------------------------------------------------------ 1 file changed, 118 deletions(-) delete mode 100644 .bashrc_cxx (limited to '.bashrc_cxx') diff --git a/.bashrc_cxx b/.bashrc_cxx deleted file mode 100644 index 49d4549..0000000 --- a/.bashrc_cxx +++ /dev/null @@ -1,118 +0,0 @@ -#!/usr/bin/env bash - -# Copyright (c) 2016 Egor Tensin -# This file is part of the "Cygwin configuration files" project. -# For details, see https://github.com/egor-tensin/cygwin-home. -# Distributed under the MIT License. - -runc_flags=('-Wall' '-Wextra') - -runc() ( - set -o errexit -o nounset -o pipefail - - local -a c_flags=("${runc_flags[@]+"${runc_flags[@]}"}") - local -a src_files - local -a prog_flags - - while [ "$#" -gt 0 ]; do - case "$1" in - -c|--c-flags) - if [ "$#" -le 1 ]; then - echo "${FUNCNAME[0]}: missing argument for parameter: $1" >&2 - return 1 - fi - shift - c_flags+=("$1") - shift - ;; - - -h|--help) - echo "usage: ${FUNCNAME[0]} [-h|--help] [-c|--c-flags FLAG]" - return 0 - ;; - - --) - shift - break - ;; - - *) - src_files+=("$( realpath "$1" )") - shift - ;; - esac - done - - prog_flags=("$@") - - local build_dir - build_dir="$( mktemp --directory )" - - trap "$( printf 'popd > /dev/null && rm -rf %q' "$build_dir" )" 0 - pushd "$build_dir" > /dev/null - - local output_name - output_name="$( mktemp --tmpdir=. "${FUNCNAME[0]}XXX.exe" )" - - gcc -o "$output_name" \ - "${c_flags[@]+"${c_flags[@]}"}" \ - "${src_files[@]+"${src_files[@]}"}" - - "$output_name" "${prog_flags[@]+"${prog_flags[@]}"}" -) - -runcxx_flags=('-Wall' '-Wextra' '-std=c++14') - -runcxx() ( - set -o errexit -o nounset -o pipefail - - local -a cxx_flags=("${runcxx_flags[@]+"${runcxx_flags[@]}"}") - local -a src_files - local -a prog_flags - - while [ "$#" -gt 0 ]; do - case "$1" in - -c|--cxx-flags) - if [ "$#" -le 1 ]; then - echo "${FUNCNAME[0]}: missing argument for parameter: $1" >&2 - return 1 - fi - shift - cxx_flags+=("$1") - shift - ;; - - -h|--help) - echo "usage: ${FUNCNAME[0]} [-h|--help] [-c|--cxx-flags FLAG]" - return 0 - ;; - - --) - shift - break - ;; - - *) - src_files+=("$( realpath "$1" )") - shift - ;; - esac - done - - prog_flags=("$@") - - local build_dir - build_dir="$( mktemp --directory )" - - trap "$( printf 'popd > /dev/null && rm -rf %q' "$build_dir" )" 0 - pushd "$build_dir" > /dev/null - - local output_name - output_name="$( mktemp --tmpdir=. "${FUNCNAME[0]}XXX.exe" )" - - g++ -o "$output_name" \ - "${cxx_flags[@]+"${cxx_flags[@]}"}" \ - "${src_files[@]+"${src_files[@]}"}" - - "$output_name" "${prog_flags[@]+"${prog_flags[@]}"}" -) -- cgit v1.2.3