diff options
author | Christian Pointner <equinox@anytun.org> | 2009-02-06 20:56:52 +0000 |
---|---|---|
committer | Christian Pointner <equinox@anytun.org> | 2009-02-06 20:56:52 +0000 |
commit | c4768a15b33ff40187c084e3388c06d6fe1bfed8 (patch) | |
tree | bd349e259fb0c57ba9e2bdc3b7562f111a655727 /src | |
parent | finished kamikaze initscript (diff) |
added install target to make file
Diffstat (limited to 'src')
-rw-r--r-- | src/Makefile | 47 | ||||
-rwxr-xr-x | src/configure | 22 |
2 files changed, 67 insertions, 2 deletions
diff --git a/src/Makefile b/src/Makefile index 1d0d5c6..89570a2 100644 --- a/src/Makefile +++ b/src/Makefile @@ -56,7 +56,7 @@ endif SRC := $(OBJ:%.o=%.c) -.PHONY: distclean clean +.PHONY: clean distclean manpage install install-bin install-etc install-man remove purge all: $(EXECUTABLE) @@ -85,3 +85,48 @@ clean: rm -f *.o rm -f *.d rm -f $(EXECUTABLE) + +manpage: + $(MAKE) --directory="../doc/" manpage + +install: install-bin install-etc install-man + +install-bin: $(EXECUTABLE) + mkdir -p $(DESTDIR)$(SBINDIR) + install -m 755 $(EXECUTABLE) $(DESTDIR)$(SBINDIR) + $(STRIP) $(DESTDIR)$(SBINDIR)/$(EXECUTABLE) + +install-etc: + mkdir -p $(DESTDIR)$(ETCDIR)/uanytun + install -m 644 ../etc/uanytun/autostart $(DESTDIR)$(ETCDIR)/uanytun/autostart + @( cd '../etc/uanytun/' ; \ + for dir in `ls`; do \ + if [ -d $$dir ]; then \ + echo "install $$dir configuration" ; \ + cd $$dir ; \ + mkdir -p $(DESTDIR)$(ETCDIR)/uanytun/$$dir ; \ + install -m 600 config $(DESTDIR)$(ETCDIR)/uanytun/$$dir/config ; \ + if [ -e 'post-up.sh' ]; then \ + install -m 755 post-up.sh $(DESTDIR)$(ETCDIR)/uanytun/$$dir/post-up.sh ; \ + fi ; \ + cd .. ; \ + fi ; \ + done \ + ) + mkdir -p $(DESTDIR)$(ETCDIR)/init.d + install -m 755 ../etc/init.d/uanytun $(DESTDIR)$(ETCDIR)/init.d/$(EXECUTABLE) + @ sed -i 's#DAEMON=/usr/sbin/uanytun#DAEMON=$(SBINDIR)/$(EXECUTABLE)#' $(DESTDIR)$(ETCDIR)/init.d/$(EXECUTABLE) + @ sed -i 's#CONFIG_DIR=/etc/uanytun#CONFIG_DIR=$(ETCDIR)/uanytun#' $(DESTDIR)$(ETCDIR)/init.d/$(EXECUTABLE) + +install-man: manpage + mkdir -p $(DESTDIR)$(MANDIR)/man8/ + cp ../doc/uanytun.8 $(DESTDIR)$(MANDIR)/man8/$(EXECUTABLE).8 + gzip $(DESTDIR)$(MANDIR)/man8/$(EXECUTABLE).8 + +remove: + rm -f $(DESTDIR)$(SBINDIR)/$(EXECUTABLE) + rm -f $(DESTDIR)$(MANDIR)/man8/$(EXECUTABLE).8.gz + rm -f $(DESTDIR)$(ETCDIR)/init.d/$(EXECUTABLE) + +purge: remove + rm -rf $(DESTDIR)$(ETCDIR)/uanytun/ diff --git a/src/configure b/src/configure index cad9c57..a1608ef 100755 --- a/src/configure +++ b/src/configure @@ -43,9 +43,12 @@ ANYTUN_02_COMPAT=0 PASSPHRASE=1 V4_MAPPED=1 +PREFIX='/usr/local' + print_usage() { echo "configure --help print this" - echo " --target=<TARGET> build target i.e. Linux" + echo " --target=<TARGET> build target i.e. Linux (default: autodetect)" + echo " --prefix=<PREFIX> the installation prefix (default: /usr/local)" echo " --use-ssl-crypto use ssl crypto library instead of libgcrypt" echo " --disable-crypto disable crypto at all (only NULL cipher)" echo " --enable-anytun02-compat enable compatiblity mode for anytun 0.2.x and prior" @@ -60,6 +63,9 @@ do --target=*) TARGET=${arg#--target=} ;; + --prefix=*) + PREFIX=${arg#--prefix=} + ;; --use-ssl-crypto) CRYPTO_LIB='ssl' ;; @@ -144,11 +150,25 @@ if [ $V4_MAPPED -eq 0 ]; then echo "WARNING: disabling V4 mapped addresses, this prevents uanytun from using IPv6 as outer Protocol" fi +if [ "x$PREFIX" = "x/usr" ]; then + ETCDIR=/etc +else + ETCDIR=$PREFIX/etc +fi + cat >> include.mk <<EOF +# this file was created automatically +# do not edit this file directly +# use ./configure instead + TARGET := $TARGET CC := gcc CFLAGS := $CFLAGS LDFLAGS := $LDFLAGS + +SBINDIR := $PREFIX/sbin +MANDIR := $PREFIX/share/man +ETCDIR := $ETCDIR EOF exit 0 |