Add an 'install' target.

(usable as 'make install' or 'redo install', of course)
This commit is contained in:
Avery Pennarun 2010-12-12 02:33:08 -08:00
commit 6e5ec95c6a
2 changed files with 40 additions and 1 deletions

View file

@ -5,6 +5,6 @@ if [ -e .do_built ]; then
fi fi
[ -z "$DO_BUILT" ] && rm -rf .do_built .do_built.dir [ -z "$DO_BUILT" ] && rm -rf .do_built .do_built.dir
redo t/clean Documentation/clean redo t/clean Documentation/clean
rm -f *~ .*~ */*~ */.*~ *.pyc rm -f *~ .*~ */*~ */.*~ *.pyc install.wrapper
rm -rf t/.redo rm -rf t/.redo
find -name '*.tmp' -exec rm -fv {} \; find -name '*.tmp' -exec rm -fv {} \;

39
install.do Normal file
View file

@ -0,0 +1,39 @@
exec >&2
redo-ifchange Documentation/all
: ${INSTALL:=install}
: ${DESTDIR:=}
: ${PREFIX:=/usr}
: ${MANDIR:=$DESTDIR$PREFIX/share/man}
: ${DOCDIR:=$DESTDIR$PREFIX/share/doc/redo}
: ${BINDIR:=$DESTDIR$PREFIX/bin}
: ${LIBDIR:=$DESTDIR$PREFIX/lib/redo}
echo "Installing to: $DESTDIR$PREFIX"
# make dirs
$INSTALL -d $MANDIR/man1 $DOCDIR $BINDIR $LIBDIR
# docs
$INSTALL -m 0644 Documentation/*.1 $MANDIR/man1
$INSTALL -m 0644 README.md $DOCDIR
# .py files (precompiled to .pyc files for speed)
for d in *.py; do
fix=$(echo $d | sed 's,-,_,g')
$INSTALL -m 0644 $d $LIBDIR/$fix
done
python -mcompileall $LIBDIR
# binaries
for d in redo redo-ifchange redo-ifcreate redo-always redo-stamp redo-oob; do
fix=$(echo $d | sed 's,-,_,g')
cat >install.wrapper <<-EOF
#!/usr/bin/python
import sys;
sys.path.insert(0, '$LIBDIR')
import $fix
EOF
$INSTALL -m 0755 install.wrapper $BINDIR/$d
done
rm -f install.wrapper