From 49b1fb917eba60decc6e4817468c540ed45116af Mon Sep 17 00:00:00 2001 From: ItsDrike Date: Mon, 16 Aug 2021 03:18:07 +0200 Subject: [PATCH] Add compile script --- home/.local/bin/scripts/comp | 13 +++++++++++++ 1 file changed, 13 insertions(+) create mode 100755 home/.local/bin/scripts/comp diff --git a/home/.local/bin/scripts/comp b/home/.local/bin/scripts/comp new file mode 100755 index 0000000..7efa12c --- /dev/null +++ b/home/.local/bin/scripts/comp @@ -0,0 +1,13 @@ +#!/bin/sh +# Compile given file + +file=$(readlink -f "$1") +base="$(dirname "$file")/$(basename "$file" | sed 's/\..*//')" + +case "$file" in + *.md) pandoc --filter pandoc-crossref "$file" -o "$base".pdf ;; + *.asm) nasm -f elf64 "$file" -o "$base".o && ld "$base".o -o "$base" ;; + *.c) gcc "$file" -o "$base" ;; + *.cpp) g++ "$file" -o "$base" ;; + *) echo "Can't compile!" && exit 1 ;; +esac