From 727cf8701027f1d043f75941417dcf315ce5f875 Mon Sep 17 00:00:00 2001 From: Andre Noll Date: Sun, 16 Apr 2017 13:56:09 +0200 Subject: [PATCH] build: Add target install and install-strip. It has always been a bit clumsy to copy the executable and the manual page to their proper locations by hand, so this commit adds the two standard targets "install" and "install-strip" which install both files. The installation prefix defaults to /usr/local and can be set with PREFIX. Moreover, there is DESTDIR which may be given to prepend another directory (useful for for "staged installs", where the installed files are not placed directly into their expected location but are instead copied into a temporary location). --- INSTALL | 13 ++++++++++--- Makefile | 17 ++++++++++++++++- 2 files changed, 26 insertions(+), 4 deletions(-) diff --git a/INSTALL b/INSTALL index f48784b..113ed14 100644 --- a/INSTALL +++ b/INSTALL @@ -8,9 +8,16 @@ Type make -in the dss source directory to build the dss executable and copy it -to some directory that is included in your PATH, e.g. to `$HOME/bin` -or to `/usr/local/bin`. +in the dss source directory to build the dss executable and the +man page. Then type + + sudo make install + +to install in /usr/local, or + + make install PREFIX=/somewhere/else + +to install in /somewhere/else. Also make sure that [rsync](http://rsync.samba.org/) is installed on your system. Version 2.6.1 or newer is required. diff --git a/Makefile b/Makefile index 42adf47..c6780ef 100644 --- a/Makefile +++ b/Makefile @@ -1,7 +1,13 @@ +PREFIX ?= /usr/local +INSTALL ?= install +INSTALL_PROGRAM ?= $(INSTALL) +INSTALL_DATA ?= $(INSTALL) -m 644 +MKDIR_P := mkdir -p + VERSION_STRING = 0.1.7 dss_objects := dss.o str.o file.o exec.o sig.o daemon.o df.o tv.o snap.o ipc.o dss.lsg.o -all: dss +all: dss dss.1 man: dss.1 DEBUG_CFLAGS ?= @@ -47,6 +53,15 @@ dss: $(dss_objects) clean: rm -f *.o dss dss.1 dss.1.html Makefile.deps *.png *~ index.html dss.lsg.h dss.lsg.c +ifneq ($(findstring strip, $(MAKECMDGOALS)),) + strip_option := -s +endif +bindir := $(DESTDIR)$(PREFIX)/bin +mandir := $(DESTDIR)$(PREFIX)/share/man/man1 +install install-strip: all + $(MKDIR_P) $(bindir) $(mandir) + $(INSTALL_PROGRAM) $(strip_option) dss $(bindir) + $(INSTALL_DATA) dss.1 $(mandir) index.html: dss.1.html index.html.in INSTALL README NEWS sed -e '/@README@/,$$d' index.html.in > $@ -- 2.39.2