diff options
author | B. Watson <urchlay@slackware.uk> | 2025-05-06 04:10:06 -0400 |
---|---|---|
committer | B. Watson <urchlay@slackware.uk> | 2025-05-06 04:10:06 -0400 |
commit | 67ebbac0be7ad917e794ca5ea0496d0a1ead83b8 (patch) | |
tree | d169b8481afe91a394023c294741a21e57cb033f /Makefile | |
parent | c4eda00ddbc16723f3e1d1e943edaaa2c6c2c748 (diff) | |
download | marsond-67ebbac0be7ad917e794ca5ea0496d0a1ead83b8.tar.gz |
much work (options, rc script, make install, etc etc).
Diffstat (limited to 'Makefile')
-rw-r--r-- | Makefile | 46 |
1 files changed, 46 insertions, 0 deletions
@@ -1,5 +1,6 @@ # Makefile for marsond. Should be fine with any make (GNU, BSD, etc). +### Compiler and options. CC=gcc # CC=clang works, too @@ -7,4 +8,49 @@ COPT=-O2 CWARN=-Wall CFLAGS=-std=c99 $(COPT) $(CWARN) +### Install paths. Not compiled into the binary. +PREFIX=/usr +SBINDIR=$(PREFIX)/sbin +MANDIR=$(PREFIX)/man +MAN8DIR=$(PREFIX)/man8 + +INSTALL=install +INSTALL_MAN=$(INSTALL) +INSTALL_BIN=$(INSTALL) -s -m0755 +INSTALL_RC=$(INSTALL) -m0755 +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= + +### No user-serviceable parts below (I hope). all: marsond + +marsond: marsond.c usage.c + +usage.c: mkusage.pl marsond.rst + perl mkusage.pl marsond.rst > usage.c + +marsond.1: marsond.rst + rst2man marsond.rst > marsond.1 + +clean: + rm -f marsond core *.o + +realclean: clean + rm -f marsond.1 usage.c + +install: all + mkdir -p $(DESTDIR)/$(SBINDIR) $(DESTDIR)/$(MAN8DIR) + $(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) + |