From 7d2f7bbeeb420ddd8adf3be465d7aaf7f49deb83 Mon Sep 17 00:00:00 2001 From: Christian Pointner Date: Wed, 25 Nov 2009 17:09:55 +0000 Subject: added install target to Makefile 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= build target i.e. Linux (default: autodetect)" + echo " --prefix= the installation prefix (default: /usr/local)" + echo " --bindir= the path to the bin directory (default: $PREFIX/bin)" + echo " --sysconfdir= the path to the system configuration directory (default: $PREFIX/etc" + echo " --mandir= 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 <> include.mk + echo "installing manpage" +else + echo "not installing manpage" +fi + exit 0 -- cgit v0.10.2