diff options
-rw-r--r-- | src/Makefile | 42 | ||||
-rwxr-xr-x | src/configure | 13 |
2 files changed, 40 insertions, 15 deletions
diff --git a/src/Makefile b/src/Makefile index fbc97c3..f3c9801 100644 --- a/src/Makefile +++ b/src/Makefile @@ -198,12 +198,18 @@ clean: manpage: @cd man ; $(MAKE) + +INSTALL_TARGETS := install-bin install-etc +REMOVE_TARGETS := remove-bin remove-etc + +ifdef MANDIR +INSTALL_TARGETS += install-man +REMOVE_TARGETS += remove-man +endif + ifdef EXAMPLESDIR -INSTALL_TARGETS := install-bin install-etc install-examples install-man -REMOVE_TARGETS := remove-examples -else -INSTALL_TARGETS := install-bin install-etc install-man -REMOVE_TARGETS := +INSTALL_TARGETS += install-examples +REMOVE_TARGETS += remove-examples endif install: all $(INSTALL_TARGETS) @@ -220,11 +226,12 @@ install-etc: $(INSTALL) -d $(DESTDIR)$(ETCDIR)/anytun @ echo "example configurations can be found at $(EXAMPLESDIR)/anytun" > $(DESTDIR)$(ETCDIR)/anytun/README $(INSTALL) -d $(DESTDIR)$(ETCDIR)/init.d - $(INSTALL) -m 755 ../etc/init.d/anytun $(DESTDIR)$(ETCDIR)/init.d/anytun - @ sed -i 's#DAEMON=/usr/sbin/anytun#DAEMON=$(SBINDIR)/anytun#' $(DESTDIR)$(ETCDIR)/init.d/anytun - @ sed -i 's#ANYTUNCONFIG=/usr/bin/anytun-config#ANYTUNCONFIG=$(BINDIR)/anytun-config#' $(DESTDIR)$(ETCDIR)/init.d/anytun - @ sed -i 's#CONTROLDAEMON=/usr/bin/anytun-controld#CONTROLDAEMON=$(BINDIR)/anytun-controld#' $(DESTDIR)$(ETCDIR)/init.d/anytun - @ sed -i 's#CONFIG_DIR=/etc/anytun#CONFIG_DIR=$(ETCDIR)/anytun#' $(DESTDIR)$(ETCDIR)/init.d/anytun + @ sed -e 's#DAEMON=/usr/sbin/anytun#DAEMON=$(SBINDIR)/anytun#' \ + -e 's#ANYTUNCONFIG=/usr/bin/anytun-config#ANYTUNCONFIG=$(BINDIR)/anytun-config#' \ + -e 's#CONTROLDAEMON=/usr/bin/anytun-controld#CONTROLDAEMON=$(BINDIR)/anytun-controld#' \ + -e 's#CONFIG_DIR=/etc/anytun#CONFIG_DIR=$(ETCDIR)/anytun#' ../etc/init.d/anytun > ../etc/init.d/anytun.bak + $(INSTALL) -m 755 ../etc/init.d/anytun.bak $(DESTDIR)$(ETCDIR)/init.d/anytun + rm -f ../etc/init.d/anytun.bak install-examples: $(INSTALL) -d $(DESTDIR)$(EXAMPLESDIR)/anytun @@ -263,19 +270,26 @@ install-man: manpage uninstall: remove + remove: $(REMOVE_TARGETS) + +remove-bin: rm -f $(DESTDIR)$(SBINDIR)/anytun rm -f $(DESTDIR)$(BINDIR)/anytun-config rm -f $(DESTDIR)$(BINDIR)/anytun-controld rm -f $(DESTDIR)$(BINDIR)/anytun-showtables - rm -f $(DESTDIR)$(MANDIR)/man8/anytun.8 - rm -f $(DESTDIR)$(MANDIR)/man8/anytun-config.8 - rm -f $(DESTDIR)$(MANDIR)/man8/anytun-controld.8 - rm -f $(DESTDIR)$(MANDIR)/man8/anytun-showtables.8 + +remove-etc: rm -f $(DESTDIR)$(ETCDIR)/init.d/anytun remove-examples: rm -rf $(DESTDIR)$(EXAMPLESDIR)/anytun/ +remove-man: + rm -f $(DESTDIR)$(MANDIR)/man8/anytun.8 + rm -f $(DESTDIR)$(MANDIR)/man8/anytun-config.8 + rm -f $(DESTDIR)$(MANDIR)/man8/anytun-controld.8 + rm -f $(DESTDIR)$(MANDIR)/man8/anytun-showtables.8 + purge: remove rm -rf $(DESTDIR)$(ETCDIR)/anytun/ diff --git a/src/configure b/src/configure index 0f3750c..5381010 100755 --- a/src/configure +++ b/src/configure @@ -47,6 +47,7 @@ BINDIR='' SBINDIR='' ETCDIR='' MANDIR='' +INSTALLMANPAGE=1 EXAMPLESDIR='' INSTALLEXAMPLES=1 @@ -58,6 +59,7 @@ print_usage() { echo " --sbindir=<DIR> the path to the sbin directory (default: $PREFIX/sbin)" 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 manpages" echo " --examplesdir=<DIR> the path to the examples files (default: $PREFIX/share/examples)" echo " --no-examples dont't install example files" echo " --use-ssl-crypto use ssl crypto library instead of libgcrypt" @@ -89,6 +91,9 @@ do --mandir=*) MANDIR=${arg#--mandir=} ;; + --no-manpage) + INSTALLMANPAGE=0 + ;; --examplesdir=*) EXAMPLESDIR=${arg#--examplesdir=} ;; @@ -220,9 +225,15 @@ PREFIX := $PREFIX BINDIR := $BINDIR SBINDIR := $SBINDIR ETCDIR := $ETCDIR -MANDIR := $MANDIR EOF +if [ $INSTALLMANPAGE -eq 1 ]; then + echo "MANDIR := $MANDIR" >> include.mk + echo "installing manpage" +else + echo "not installing manpage" +fi + if [ $INSTALLEXAMPLES -eq 1 ]; then echo "EXAMPLESDIR := $EXAMPLESDIR" >> include.mk echo "installing example files" |