Skip to content

Commit

Permalink
Add install target
Browse files Browse the repository at this point in the history
  • Loading branch information
herrhotzenplotz committed Oct 1, 2022
1 parent 7e19180 commit d390d9a
Show file tree
Hide file tree
Showing 2 changed files with 35 additions and 1 deletion.
5 changes: 4 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
.PHONY: all clean check
.PHONY: all clean check install
all:
./build.sh

Expand All @@ -8,3 +8,6 @@ clean:

check:
./build.sh check

install:
PREFIX="${PREFIX}" DESTDIR="${DESTDIR}" ./build.sh install
31 changes: 31 additions & 0 deletions build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -320,6 +320,34 @@ build_test_programs()
build_test_program tests/pgen-tests
}

#################################################################################
# Install target
#################################################################################
doinstall()
{
[ -x ./gcli ] || die "You need to build gcli first"

[ "x$PREFIX" != "x" ] || PREFIX="/usr/local"
[ "x$DESTDIR" != "x" ] || DESTDIR="/"

BINDIR=${DESTDIR}${PREFIX}/bin
MANDIR=${DESTDIR}${PREFIX}/man

[ -d $BINDIR ] || mkdir -p $BINDIR
[ -d $MANDIR ] || mkdir -p $MANDIR
[ -d $MANDIR/man1 ] || mkdir -p $MANDIR/man1

echo "Installing gcli"
echo " cp gcli $BINDIR"
cp gcli $BINDIR || die "install command failed"

for MANPAGE in docs/gcli*.1; do
echo "Installing ${MANPAGE#docs/}"
echo " gzip < $MANPAGE > $MANDIR/man1/${MANPAGE#docs/}.gz"
gzip < $MANPAGE > $MANDIR/man1/${MANPAGE#docs/}.gz || die "install command failed"
done
}

# Start it!

case $1 in
Expand All @@ -333,6 +361,9 @@ case $1 in
kyua test || die "Tests failed"
cd ..
;;
install)
doinstall
;;
*)
die "unknown subcommand"
;;
Expand Down

0 comments on commit d390d9a

Please sign in to comment.