summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChristian Pointner <equinox@helsinki.at>2009-11-25 17:09:55 +0000
committerChristian Pointner <equinox@helsinki.at>2009-11-25 17:09:55 +0000
commit7d2f7bbeeb420ddd8adf3be465d7aaf7f49deb83 (patch)
tree159a4aa5b0f86312b16994e5f48fd9d96b1d33e9
parentadded manpage (diff)
added install target to Makefile
-rw-r--r--Makefile39
-rwxr-xr-xconfigure68
2 files changed, 104 insertions, 3 deletions
diff --git a/Makefile b/Makefile
index 0bcac73..b3bf3fd 100644
--- a/Makefile
+++ b/Makefile
@@ -74,3 +74,42 @@ cleanall: clean
manpage:
$(MAKE) --directory="doc/" manpage
+
+
+INSTALL_TARGETS := install-bin install-etc
+REMOVE_TARGETS := remove-bin remove-etc
+
+ifdef MANDIR
+INSTALL_TARGETS += install-man
+REMOVE_TARGETS += remove-man
+endif
+
+install: all $(INSTALL_TARGETS)
+
+install-bin: $(EXECUTABLE)
+ $(INSTALL) -d $(DESTDIR)$(BINDIR)
+ $(INSTALL) -m 755 $(EXECUTABLE) $(DESTDIR)$(BINDIR)
+
+install-etc:
+ $(INSTALL) -d $(DESTDIR)$(ETCDIR)/$(EXECUTABLE)
+ $(INSTALL) -m 755 newfile.sh $(DESTDIR)$(ETCDIR)/$(EXECUTABLE)/
+
+install-man: manpage
+ $(INSTALL) -d $(DESTDIR)$(MANDIR)/man8/
+ $(INSTALL) -m 644 doc/rhdropbox.8 $(DESTDIR)$(MANDIR)/man8/$(EXECUTABLE).8
+
+uninstall: remove
+
+remove: $(REMOVE_TARGETS)
+
+remove-bin:
+ rm -f $(DESTDIR)$(BINDIR)/$(EXECUTABLE)
+
+remove-etc:
+ rm -f $(DESTDIR)$(ETCDIR)/init.d/$(EXECUTABLE)
+
+remove-man:
+ rm -f $(DESTDIR)$(MANDIR)/man8/$(EXECUTABLE).8
+
+purge: remove
+ rm -rf $(DESTDIR)$(ETCDIR)/$(EXECUTABLE)/
diff --git a/configure b/configure
index 1af8e01..59861b7 100755
--- a/configure
+++ b/configure
@@ -23,12 +23,25 @@
TARGET=`uname -s`
+EBUILD_COMPAT=0
+
CFLAGS='-g -O2'
LDFLAGS='-g -Wall -O2'
+PREFIX='/usr/local'
+BINDIR=''
+ETCDIR=''
+MANDIR=''
+INSTALLMANPAGE=1
+
print_usage() {
echo "configure --help print this"
echo " --target=<TARGET> build target i.e. Linux (default: autodetect)"
+ echo " --prefix=<PREFIX> the installation prefix (default: /usr/local)"
+ echo " --bindir=<DIR> the path to the bin directory (default: $PREFIX/bin)"
+ echo " --sysconfdir=<DIR> the path to the system configuration directory (default: $PREFIX/etc"
+ echo " --mandir=<DIR> the path to the system man pages (default: $PREFIX/share/man)"
+ echo " --no-manpage dont't install manpage"
}
for arg
@@ -37,18 +50,43 @@ do
--target=*)
TARGET=${arg#--target=}
;;
+ --prefix=*)
+ PREFIX=${arg#--prefix=}
+ ;;
+ --bindir=*)
+ BINDIR=${arg#--bindir=}
+ ;;
+ --sysconfdir=*)
+ ETCDIR=${arg#--sysconfdir=}
+ ;;
+ --mandir=*)
+ MANDIR=${arg#--mandir=}
+ ;;
+ --no-manpage)
+ INSTALLMANPAGE=0
+ ;;
+ --ebuild-compat)
+ EBUILD_COMPAT=1
+ ;;
--help)
print_usage
exit 0
;;
*)
- echo "Unknown argument: $arg"
- print_usage
- exit 1
+ ERRORS="$ERRORS $arg"
;;
esac
done
+if [ -n "$ERRORS" ] && [ $EBUILD_COMPAT -ne 1 ]; then
+ for error in $ERRORS; do
+ echo "Unknown argument: $error"
+ done
+
+ print_usage
+ exit 1
+fi
+
rm -f include.mk
case $TARGET in
Linux)
@@ -65,6 +103,18 @@ case $TARGET in
;;
esac
+if [ -z "$BINDIR" ]; then
+ BINDIR=$PREFIX/bin
+fi
+
+if [ -z "$ETCDIR" ]; then
+ ETCDIR=$PREFIX/etc
+fi
+
+if [ -z "$MANDIR" ]; then
+ MANDIR=$PREFIX/share/man
+fi
+
cat >> include.mk <<EOF
# this file was created automatically
# do not edit this file directly
@@ -74,6 +124,18 @@ TARGET := $TARGET
CC := gcc
CFLAGS := $CFLAGS
LDFLAGS := $LDFLAGS
+INSTALL := install
+
+PREFIX := $PREFIX
+BINDIR := $BINDIR
+ETCDIR := $ETCDIR
EOF
+if [ $INSTALLMANPAGE -eq 1 ]; then
+ echo "MANDIR := $MANDIR" >> include.mk
+ echo "installing manpage"
+else
+ echo "not installing manpage"
+fi
+
exit 0