aboutsummaryrefslogtreecommitdiff
path: root/Makefile
diff options
context:
space:
mode:
Diffstat (limited to 'Makefile')
-rw-r--r--Makefile36
1 files changed, 20 insertions, 16 deletions
diff --git a/Makefile b/Makefile
index d7420d2..06b7d5a 100644
--- a/Makefile
+++ b/Makefile
@@ -5,13 +5,17 @@
# make CC=clang CFLAGS=-O3
# make install PREFIX=/usr/local
+### Project information.
+PROJ=marsond
+VERSION=0.1
+
### Compiler and options.
CC=gcc
# CC=clang works, too
COPT=-O2
CWARN=-Wall
-CFLAGS=-std=c99 $(COPT) $(CWARN)
+CFLAGS=-std=c99 $(COPT) $(CWARN) -DVERSION='"$(VERSION)"'
### Install paths. Not compiled into the binary.
@@ -21,7 +25,7 @@ PREFIX=/usr
SBINDIR=$(PREFIX)/sbin
MANDIR=$(PREFIX)/man
MAN8DIR=$(PREFIX)/man8
-DOCDIR=/usr/doc/marsond-$(VERSION)
+DOCDIR=/usr/doc/$(PROJ)-$(VERSION)
UDEVDIR=/etc/udev/rules.d
INSTALL=install
@@ -37,29 +41,29 @@ GZIP=gzip -9
RULESUFFIX=
### No user-serviceable parts below (I hope).
-all: marsond marsond.1 99-marsond.rules
+all: $(PROJ) $(PROJ).1 99-$(PROJ).rules
-marsond: marsond.c usage.c
+$(PROJ): $(PROJ).c usage.c
-usage.c: mkusage.pl marsond.1
- perl mkusage.pl marsond.rst > usage.c
+usage.c: mkusage.pl $(PROJ).1
+ perl mkusage.pl $(PROJ).rst > usage.c
-marsond.1: marsond.rst
- rst2man marsond.rst > marsond.1
+$(PROJ).1: $(PROJ).rst
+ rst2man $(PROJ).rst > $(PROJ).1
-99-marsond.rules:
- sed 's,@SBINDIR@,$(SBINDIR),' < 99-marsond.rules.in > 99-marsond.rules
+99-$(PROJ).rules:
+ sed 's,@SBINDIR@,$(SBINDIR),' < 99-$(PROJ).rules.in > 99-$(PROJ).rules
clean:
- rm -f marsond core *.o
+ rm -f $(PROJ) core *.o
realclean: clean
- rm -f marsond.1 usage.c
+ rm -f $(PROJ).1 usage.c
install: all
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
- $(INSTALL_UDEV) 99-marsond.rules $(DESTDIR)/$(UDEVDIR)$(RULESUFFIX)
+ $(INSTALL_BIN) $(PROJ) $(DESTDIR)/$(SBINDIR)
+ $(INSTALL_MAN) $(PROJ).1 $(DESTDIR)/$(MAN8DIR)
+ $(GZIP) $(DESTDIR)/$(MAN8DIR)/$(PROJ).1 || true
+ $(INSTALL_UDEV) 99-$(PROJ).rules $(DESTDIR)/$(UDEVDIR)$(RULESUFFIX)
$(INSTALL_DOC) README TODO LICENSE $(DESTDIR)/$(DOCDIR)