1
0
mirror of git://projects.qi-hardware.com/eda-tools.git synced 2024-11-22 19:17:10 +02:00

genex: added install/uninstall targets and wrapper generator

This commit is contained in:
Werner Almesberger 2012-04-17 18:17:01 -03:00
parent fff142c6de
commit 54ecc10cbb
2 changed files with 72 additions and 1 deletions

View File

@ -9,6 +9,8 @@
# (at your option) any later version.
#
PREFIX ?= /usr/local
OBJS = genex.o comp.o libs.o pdf.o
SHELL = /bin/bash
@ -31,7 +33,7 @@ else
DEPEND = $(DEPEND_quiet)
endif
.PHONY: all clean spotless
.PHONY: all clean spotless install uninstall
all: genex-bin
@ -53,3 +55,23 @@ clean:
spotless: clean
rm -f genex-bin
#
# Note: we use .../lib/genex/ instead of .../libexec/genex/ because FHS-3.0
# does not define libexec under the /usr/local/ hierarchy. (And older versions
# of FHS don't define libexec at all.)
#
install: all
mkdir -p $(DESTDIR)/$(PREFIX)/bin
mkdir -p $(DESTDIR)/$(PREFIX)/lib/genex
./mkgenex-wrapper -m 755 -p $(DESTDIR)/$(PREFIX)/lib/genex/ \
$(DESTDIR)/$(PREFIX)/bin/genex
install -m 755 genex-bin $(DESTDIR)/$(PREFIX)/lib/genex/
install -m 755 sym2xps $(DESTDIR)/$(PREFIX)/lib/genex/
install -m 755 expand-pintype $(DESTDIR)/$(PREFIX)/lib/genex/
uninstall:
rm -f $(DESTDIR)/$(PREFIX)/bin/genex
rm -rf $(DESTDIR)/$(PREFIX)/lib/genex

49
genex/mkgenex-wrapper Executable file
View File

@ -0,0 +1,49 @@
#!/bin/sh -e
#
# mkgenex-wrapper - Generate wrapper script for genex
#
# Copyright 2012 by Werner Almesberger
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
#
MODE=555
DIR=
usage()
{
echo "usage: $0 [-m mode] [-p directory] wrapper-path" 1>&2
exit 1
}
while [ "$1" ]; do
case "$1" in
-m) shift
MODE=$1;;
-p) shift
DIR=$1;;
-*) usage;;
*) break;;
esac
shift
done
: ${DIR:=`dirname $1`}
[ -d "$DIR" ] && [ "$1" ] && [ -z "$2" ] || usage
trap "rm -f _wrapper" 0
cat <<EOF >_wrapper
#!/bin/sh
PATH=\$PATH:$DIR
exec genex-bin "\$@"
EOF
chmod $MODE _wrapper
mv _wrapper "$1"