aboutsummaryrefslogtreecommitdiff
path: root/Makefile
diff options
context:
space:
mode:
Diffstat (limited to 'Makefile')
-rw-r--r--Makefile37
1 files changed, 23 insertions, 14 deletions
diff --git a/Makefile b/Makefile
index f1432ba..d7420d2 100644
--- a/Makefile
+++ b/Makefile
@@ -1,5 +1,10 @@
# Makefile for marsond. Should be fine with any make (GNU, BSD, etc).
+# Remember, all these assignments, you can override on the make
+# command line rather than editing this file. Examples:
+# make CC=clang CFLAGS=-O3
+# make install PREFIX=/usr/local
+
### Compiler and options.
CC=gcc
# CC=clang works, too
@@ -9,27 +14,30 @@ CWARN=-Wall
CFLAGS=-std=c99 $(COPT) $(CWARN)
### Install paths. Not compiled into the binary.
+
+# These are appropriate for Slackware. Most other distros will need
+# MANDIR=$(PREFIX)/share/man, and DOCDIR=$(PREFIX)/share/doc/marsond.
PREFIX=/usr
SBINDIR=$(PREFIX)/sbin
MANDIR=$(PREFIX)/man
MAN8DIR=$(PREFIX)/man8
+DOCDIR=/usr/doc/marsond-$(VERSION)
+UDEVDIR=/etc/udev/rules.d
INSTALL=install
INSTALL_MAN=$(INSTALL)
+INSTALL_UDEV=$(INSTALL)
+INSTALL_DOC=$(INSTALL)
INSTALL_BIN=$(INSTALL) -s -m0755
-INSTALL_RC=$(INSTALL) -m0755
+
+# Build with GZIP=false to avoid gzipping the man page.
GZIP=gzip -9
-# Leave blank to skip installing the Slackware-style rc.marsond SysV
-# init script. Most distros no longer use rc scripts. Mine does,
-# and doesn't have systemd, so I didn't try to write a systemd service
-# file for this.
-# For Slackware, this should be:
-# RCDIR=/etc/rc.d
-RCDIR=
+# When building a Slackware package, use RULESUFFIX=.new
+RULESUFFIX=
### No user-serviceable parts below (I hope).
-all: marsond
+all: marsond marsond.1 99-marsond.rules
marsond: marsond.c usage.c
@@ -39,6 +47,9 @@ usage.c: mkusage.pl marsond.1
marsond.1: marsond.rst
rst2man marsond.rst > marsond.1
+99-marsond.rules:
+ sed 's,@SBINDIR@,$(SBINDIR),' < 99-marsond.rules.in > 99-marsond.rules
+
clean:
rm -f marsond core *.o
@@ -46,11 +57,9 @@ realclean: clean
rm -f marsond.1 usage.c
install: all
- mkdir -p $(DESTDIR)/$(SBINDIR) $(DESTDIR)/$(MAN8DIR)
+ mkdir -p $(DESTDIR)/$(SBINDIR) $(DESTDIR)/$(MAN8DIR) $(DESTDIR)/$(UDEVDIR) $(DESTDIR)/$(DOCDIR)
$(INSTALL_BIN) marsond $(DESTDIR)/$(SBINDIR)
$(INSTALL_MAN) marsond.1 $(DESTDIR)/$(MAN8DIR)
$(GZIP) $(DESTDIR)/$(MAN8DIR)/marsond.1 || true
- [ "$(RCDIR)" != "" ] && \
- mkdir -p $(DESTDIR)/$(RCDIR) && \
- $(INSTALL_RC) rc.marsond $(DESTDIR)$(RCDIR)
-
+ $(INSTALL_UDEV) 99-marsond.rules $(DESTDIR)/$(UDEVDIR)$(RULESUFFIX)
+ $(INSTALL_DOC) README TODO LICENSE $(DESTDIR)/$(DOCDIR)