From 9b8128a9342500fa4dd43331bd2eb6c8b4ed9b07 Mon Sep 17 00:00:00 2001 From: littleblack111 Date: Sun, 23 Jul 2023 09:14:34 +0800 Subject: updated --- compile | 92 +---------------------------------------------------------------- 1 file changed, 1 insertion(+), 91 deletions(-) mode change 100755 => 120000 compile (limited to 'compile') diff --git a/compile b/compile deleted file mode 100755 index fa2b74a..0000000 --- a/compile +++ /dev/null @@ -1,91 +0,0 @@ -#!/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 diff --git a/compile b/compile new file mode 120000 index 0000000..b577c85 --- /dev/null +++ b/compile @@ -0,0 +1 @@ +/home/system/Code/shell-script/compile-compilerun/compile \ No newline at end of file -- cgit v1.2.3