diff options
| author | littleblack111 <jerrylam110209@gmail.com> | 2023-07-23 09:14:34 +0800 |
|---|---|---|
| committer | littleblack111 <jerrylam110209@gmail.com> | 2023-07-23 09:14:34 +0800 |
| commit | 9b8128a9342500fa4dd43331bd2eb6c8b4ed9b07 (patch) | |
| tree | adda4f289032db1e3847b766112e83a5141116f3 /compile | |
| parent | b8aa6b6a516ac4ae5a104d7de96f31ced7f16d55 (diff) | |
updated
Diffstat (limited to 'compile')
| l---------[-rwxr-xr-x] | compile | 92 |
1 files changed, 1 insertions, 91 deletions
@@ -1,91 +1 @@ -#!/usr/bin/env bash - -RED='\033[0;31m\033[1m' -NC='\033[0m' # No Color - -function iferrorcomp () { - if [[ error -eq 1 ]]; then - printf "$RED\nCrit: ERROR had occured during compile!!\n" - fi -} - -if [[ ! -f $1 || ! $1 && ! -f Makefile ]]; then - printf "$RED No file/arguments given.\n" - exit 1 -fi - -if [[ ${1##*.} == "asm" ]]; then - printf "\$ nasm -f elf64 -g -F dwarf $1 -l ${1%.*}.lst -o ${1%.*}.o\n" - nasm -f elf64 -g -F dwarf $1 -l ${1%.*}.lst -o ${1%.*}.o || error=1 - if [[ error -eq 1 ]]; then - printf "\n\$ nasm -f elf64 -g -F dwarf $1 -; ${1%.*}.lst -o ${1%.*}.o: $RED\error had occured\n" - exit 1 - fi - printf "compiled into ${1%.*}.o\n" - printf "\$ ld ${1%.*}.o -o ${1%.*}" || error=1 - if [[ error -eq 1 ]]; then - printf "\n\$ ld ${1%.*}.o -o ${1%.*}" || error=1 - exit 1 - fi - ld ${1%.*}.o -o ${1%.*} - printf "linked into ${1%.*}\n" - printf "compiled into executable" -elif [[ ${1##*.} == "c" || ${1##*.} == "cc" ]]; then - printf "\$ gcc $1 -o ${1%.*}\n" - gcc $1 -o ${1%.*} || error=1 - if [[ error -eq 1 ]]; then - printf "\n\$ gcc $1 -o ${1%.*}: $RED\error had occured\n" - exit 1 - fi - printf "compiled into ${1%.*}\n" -elif [[ ${1##*.} == "cpp" ]]; then - printf "\$ g++ $1 -o ${1%.*}\n" - g++ $1 -o ${1%.*} || error=1 - if [[ error -eq 1 ]]; then - printf "\n\$ g++ $1 -o ${1%.*}: $RED\error had occured\n" - exit 1 - fi - printf "compiled into ${1%.*}\n" -elif [[ ${1##*.} == "go" ]]; then - printf "\$ go build $1\n" - go build $1 - printf "compiled into ${1%.*}\n" -elif [[ ${1##*.} == "cs" ]]; then - printf "\$ csc $1\n" - csc $1 - printf "compiled into ${1%.*}.exe\n" -elif [[ ${1##*.} == "java" ]]; then - printf "\$ javac $1\n" - javac $1 - printf "compiled into ${1%.*}.class\n" -elif [[ ${1##*.} == "py" ]]; then - printf "\$ pyinstaller -F $1\n" - #python -m py_compile $1 - pyinstaller -F $1 - printf "compiled into dist/${1%.*}\n" -elif [[ ${1##*.} == "rb" ]]; then - printf "\$ ruby -wc $1\n" - ruby -wc $1 - printf "compiled into ${1%.*}\n" -elif [[ ${1##*.} == "js" ]]; then - printf "\$ node $1\n" - node $1 - printf "compiled into ${1%.*}\n" -elif [[ ${1##*.} == "ts" ]]; then - printf "\$ tsc $1\n" - tsc $1 - printf "compiled into ${1%.*}.js\n" -elif [[ ${1##*.} == "dart" ]]; then - printf "\$ dart compile exe $1\n" - dart compile exe $1 - printf "compiled into ${1%.*}\n" -elif [[ ${1##*.} == "rs" ]]; then - printf "\$ rustc $1\n" - rustc $1 - printf "compiled into ${1%.*}\n" -elif [ -e "Makefile" ]; then - make - sudo make install -else - printf "${RED}ERROR: nothing compiled.\n" -fi +/home/system/Code/shell-script/compile-compilerun/compile
\ No newline at end of file |
