From 502561df6ac9d0f7f6fd4e3d971f3a1289054870 Mon Sep 17 00:00:00 2001 From: Sergey Matveev Date: Sun, 10 May 2015 20:52:40 +0300 Subject: [PATCH] Created installation targets for ease of porting Signed-off-by: Sergey Matveev --- Makefile | 30 +++++++++++++++++++++++++++++- doc/installation.texi | 3 +++ 2 files changed, 32 insertions(+), 1 deletion(-) diff --git a/Makefile b/Makefile index 305108c..0670d39 100644 --- a/Makefile +++ b/Makefile @@ -1,7 +1,12 @@ GOPATH != pwd VERSION != cat VERSION -LDFLAGS=-X govpn.Version $(VERSION) +LDFLAGS = -X govpn.Version $(VERSION) +PREFIX ?= /usr/local +BINDIR = $(DESTDIR)$(PREFIX)/bin +INFODIR = $(DESTDIR)$(PREFIX)/info +SHAREDIR = $(DESTDIR)$(PREFIX)/share/govpn +DOCDIR = $(DESTDIR)$(PREFIX)/share/doc/govpn all: govpn-client govpn-server govpn-verifier @@ -19,3 +24,26 @@ govpn-verifier: depends bench: cd src/govpn ; GOPATH=$(GOPATH) GOMAXPROC=2 go test -bench . + +clean: + rm -f govpn-client govpn-server govpn-verifier + +doc: + $(MAKE) -C doc + +install: all doc + mkdir -p $(BINDIR) + cp -f govpn-client govpn-server govpn-verifier $(BINDIR) + chmod 755 $(BINDIR)/govpn-client $(BINDIR)/govpn-server $(BINDIR)/govpn-verifier + mkdir -p $(INFODIR) + cp -f doc/govpn.info $(INFODIR) + chmod 644 $(INFODIR)/govpn.info + mkdir -p $(SHAREDIR) + cp -f utils/newclient.sh utils/storekey.sh $(SHAREDIR) + chmod 755 $(SHAREDIR)/newclient.sh $(SHAREDIR)/storekey.sh + mkdir -p $(DOCDIR) + cp -f -L AUTHORS INSTALL NEWS README THANKS $(DOCDIR) + chmod 644 $(DOCDIR)/AUTHORS $(DOCDIR)/INSTALL $(DOCDIR)/NEWS $(DOCDIR)/README $(DOCDIR)/THANKS + +install-strip: install + strip $(BINDIR)/govpn-client $(BINDIR)/govpn-server $(BINDIR)/govpn-verifier diff --git a/doc/installation.texi b/doc/installation.texi index 75ee444..6d3cf7d 100644 --- a/doc/installation.texi +++ b/doc/installation.texi @@ -27,6 +27,9 @@ binaries will be build in the current directory. % make -C govpn-2.3 all @end example +There is @code{install} target respecting @code{DESTDIR}. It will +install binaries, info-documentation and utilities. + @menu * Prepared tarballs:: * Development source code:: -- 2.44.0