From 29c621147821dc7eb0ff032ed413e383d5101148 Mon Sep 17 00:00:00 2001 From: Mattias Andrée Date: Mon, 30 Sep 2013 02:01:09 +0200 Subject: add makefile MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Mattias Andrée --- .gitignore | 1 + Makefile | 54 ++++++++++++++++++++++++++++++++++++++++++++++++++++++ got | 10 +++++----- 3 files changed, 60 insertions(+), 5 deletions(-) create mode 100644 Makefile diff --git a/.gitignore b/.gitignore index 10dd9a1..6a70782 100644 --- a/.gitignore +++ b/.gitignore @@ -6,4 +6,5 @@ __pycache__/ *.bak *.sw[op] *.py[co] +*.install diff --git a/Makefile b/Makefile new file mode 100644 index 0000000..2e99499 --- /dev/null +++ b/Makefile @@ -0,0 +1,54 @@ +PREFIX = +SYSCONF = /etc +BIN = /bin +SBIN = /sbin +LIBEXEC = /libexec +LICENSES = /usr/share/licenses +COMMAND = got +PKGNAME = gates-of-tartaros + +BASH_SHEBANG = /usr/bin/env bash +PY3_SHEBANG = /usr/bin/env python3 + + + +all: got.install got.py.install got-cmd.install + +got.install: got + cp "$<" "$@" + sed -i 's:#!/usr/bin/env bash:$(BASH_SHEBANG):g' "$@" + sed -i 's:@prefix@:$(PREFIX):g' "$@" + sed -i 's:@etc@:$(SYSCONF):g' "$@" + sed -i 's:@libexec@:$(LIBEXEC):g' "$@" + sed -i 's:@command@:$(COMMAND):g' "$@" + +got.py.install: got.py + cp "$<" "$@" + sed -i 's:#!/usr/bin/env python3:$(PY3_SHEBANG):g' "$@" + +got-cmd.install: got-cmd + cp "$<" "$@" + sed -i 's:#!/usr/bin/env bash:$(BASH_SHEBANG):g' "$@" + + +install: got.install got.py.install got-cmd.install + install -Dm755 -- "got.install" "$(DESTDIR)$(PREFIX)$(SBIN)/got" + install -Dm755 -- "got.py.install" "$(DESTDIR)$(PREFIX)$(LIBEXEC)/got.py" + install -Dm755 -- "got-cmd.install" "$(DESTDIR)$(PREFIX)$(BIN)/got-cmd" + install -Dm755 -- "gotrc" "$(DESTDIR)$(SYSCONF)/gotrc.examples/lower-left-ponysay" + install -Dm755 -- COPYING LICENSE "$(DESTDIR)$(LICENSES)/$(PKGNAME)" + + +uninstall: + -rm -- "$(DESTDIR)$(PREFIX)$(SBIN)/got" + -rm -- "$(DESTDIR)$(PREFIX)$(LIBEXEC)/got.py" + -rm -- "$(DESTDIR)$(PREFIX)$(BIN)/got-cmd" + -rm -- "$(DESTDIR)$(SYSCONF)/gotrc.examples/lower-left-ponysay" + -rm -- "$(DESTDIR)$(LICENSES)/$(PKGNAME)/COPYING" + -rm -- "$(DESTDIR)$(LICENSES)/$(PKGNAME)/LICENSE" + -rm -- "$(DESTDIR)$(LICENSES)/$(PKGNAME)" + + +clean: + -rm *.install 2>/dev/null + diff --git a/got b/got index 65619f2..ee9dfc8 100755 --- a/got +++ b/got @@ -24,12 +24,12 @@ shift 1 NAME="$(uname -o)" ANSI_COLOR='01;34' # must be exactly ANSI_COLOR as it is defined in /etc/os-release -if [ -f "/etc/os-release" ]; then - . "/etc/os-release" +if [ -f "@etc@os-release" ]; then + . "@etc@os-release"p fi -if [ -f "/etc/gotrc" ]; then - . "/etc/gotrc" +if [ -f "@etc@@command@rc" ]; then + . "@etc@@command@rc" else echo -en '\e[H\e[2J' echo -e "\e[${ANSI_COLOR}m${NAME} (${tty})\e[00m" @@ -38,6 +38,6 @@ else fi tty_settings="$(stty --save)" -"$0".py "$@" <> "/dev/${tty}" 2>&1 +@prefix@@libexec@@command@.py "$@" <> "/dev/${tty}" 2>&1 stty "${tty_settings}" -- cgit v1.2.3-70-g09d2