Merge pull request #765 from konimex/make

Misc: Add back Makefile
This commit is contained in:
Herdiansyah 2017-07-12 14:07:03 +07:00 committed by GitHub
commit 20185e51a6
2 changed files with 28 additions and 37 deletions

28
Makefile Normal file
View file

@ -0,0 +1,28 @@
PREFIX = /usr
SYSCONFDIR = /etc
all:
@echo Run \'make install\' to install Neofetch.
install:
@echo 'Making directories...'
@mkdir -p $(DESTDIR)$(PREFIX)/bin
@mkdir -p $(DESTDIR)$(PREFIX)/share/neofetch/ascii/distro
@mkdir -p $(DESTDIR)$(PREFIX)/share/man/man1
@mkdir -p $(DESTDIR)$(SYSCONFDIR)/neofetch
@echo 'Installing binaries...'
@sed "s|ASCIIDIR|$(PREFIX)/share/neofetch/ascii/distro|g;s|CONFDIR|$(SYSCONFDIR)/neofetch|g" < neofetch > $(DESTDIR)$(PREFIX)/bin/neofetch
@chmod 755 $(DESTDIR)$(PREFIX)/bin/neofetch
@echo 'Installing ASCII files, man page and config file...'
@cp -p ascii/distro/* $(DESTDIR)$(PREFIX)/share/neofetch/ascii/distro
@cp -p neofetch.1 $(DESTDIR)$(PREFIX)/share/man/man1
@cp -p config/config.conf $(DESTDIR)$(SYSCONFDIR)/neofetch/config.conf
uninstall:
@echo 'Removing files...'
@rm -rf $(DESTDIR)$(PREFIX)/bin/neofetch
@rm -rf $(DESTDIR)$(PREFIX)/share/man/man1/neofetch.1*
@rm -rf $(DESTDIR)$(PREFIX)/share/neofetch
@rm -rf $(DESTDIR)$(SYSCONFDIR)/neofetch

View file

@ -1,37 +0,0 @@
#!/bin/sh
while [ "$1" ]; do
case "$1" in
"--destdir") DESTDIR="$2" ;;
"--bindir") BINDIR="$2" ;;
"--confdir") CONFDIR="$2" ;;
"--prefix") PREFIX="$2" ;;
"--asciidir") ASCIIDIR="$2" ;;
"--mandir") MANDIR="$2" ;;
esac
shift
done
if [ -z "$PREFIX" ]; then
[ -z "$BINDIR" ] && BINDIR="/usr/bin"
[ -z "$ASCIIDIR" ] && ASCIIDIR="/usr/share/neofetch/ascii/distro"
[ -z "$MANDIR" ] && MANDIR="/usr/share/man/man1"
else
[ -z "$BINDIR" ] && BINDIR="/bin"
[ -z "$ASCIIDIR" ] && ASCIIDIR="/share/neofetch/ascii/distro"
[ -z "$MANDIR" ] && MANDIR="/share/man/man1"
fi
[ -z "$CONFDIR" ] && CONFDIR="/etc/neofetch"
mkdir -p "${DESTDIR}""${PREFIX}""${BINDIR}"
mkdir -p "${DESTDIR}""${PREFIX}""${CONFDIR}"
mkdir -p "${DESTDIR}""${PREFIX}""${ASCIIDIR}"
mkdir -p "${DESTDIR}""${PREFIX}""${MANDIR}"
sed -i -e "s|CONFDIR|${PREFIX}${CONFDIR}|g" neofetch
sed -i -e "s|ASCIIDIR|${PREFIX}${ASCIIDIR}|g" neofetch
cp -p neofetch "${DESTDIR}""${PREFIX}""${BINDIR}"
cp -p config/config.conf "${DESTDIR}""${PREFIX}""${CONFDIR}"
cp -p ascii/distro/* "${DESTDIR}""${PREFIX}""${ASCIIDIR}"
cp -p neofetch.1 "${DESTDIR}""${PREFIX}""${MANDIR}"