aboutsummaryrefslogtreecommitdiffstats
path: root/Makefile
diff options
context:
space:
mode:
authorMattias Andrée <maandree@operamail.com>2014-09-23 01:56:07 +0200
committerMattias Andrée <maandree@operamail.com>2014-09-23 01:56:07 +0200
commitbf97a42ac16ac031cddc6d67eff2db9e9a6e221f (patch)
tree35fff8077201177190a1a5b7805b99ea83d96d17 /Makefile
parentadd readme (diff)
downloadorphan-reaper-bf97a42ac16ac031cddc6d67eff2db9e9a6e221f.tar.gz
orphan-reaper-bf97a42ac16ac031cddc6d67eff2db9e9a6e221f.tar.bz2
orphan-reaper-bf97a42ac16ac031cddc6d67eff2db9e9a6e221f.tar.xz
m + rename the command orphan-reaper and exec to reapd1
Signed-off-by: Mattias Andrée <maandree@operamail.com>
Diffstat (limited to 'Makefile')
-rw-r--r--Makefile27
1 files changed, 21 insertions, 6 deletions
diff --git a/Makefile b/Makefile
index cbe44c2..a7ebec0 100644
--- a/Makefile
+++ b/Makefile
@@ -8,10 +8,14 @@
PREFIX ?= /usr
# The binary path excluding prefix.
BIN ?= /bin
+# The library binary path excluding prefix.
+LIBEXEC ?= /libexec
# The resource path excluding prefix.
DATA ?= /share
# The binary path including prefix.
BINDIR ?= $(PREFIX)$(BIN)
+# The library binary path including prefix.
+LIBEXECDIR ?= $(PREFIX)$(LIBEXEC)
# The resource path including prefix.
DATADIR ?= $(PREFIX)$(DATA)
# The license base path including prefix.
@@ -22,19 +26,27 @@ LICENSEDIR ?= $(DATADIR)/licenses
PKGNAME ?= orphan-reaper
# The name of the command as it should be installed.
-COMMAND ?= reapd
+COMMAND ?= orphan-reaper
+
+
+# Flags to compile with.
+USER_FLAGS = $(CFLAGS) $(LDFLAGS) $(CPPFLAGS)
+WARN = -Wall -Wextra -pedantic
+OPTIMISE = -O3
+DEFS = -D'LIBEXECDIR="$(LIBEXECDIR)"'
+C_FLAGS = $(OPTIMISE) $(WARN) $(DEFS) $(USER_FLAGS)
# Build rules.
.PHONY: all
-all: bin/reapd
+all: bin/orphan-reaper bin/reapd
-bin/reapd: src/reapd.c
+bin/%: src/%.c
mkdir -p bin
- $(CC) -O3 -Wall -Wextra -pedantic $(CFLAGS) $(LDFLAGS) $(CPPFLAGS) -o $@ $<
+ $(CC) $(C_FLAGS) -o $@ $<
# Install rules.
@@ -50,9 +62,11 @@ install-base: install-cmd install-copyright
.PHONY: install-cmd
-install-cmd: bin/reapd
+install-cmd: bin/orphan-reaper bin/reapd
install -dm755 -- "$(DESTDIR)$(BINDIR)"
- install -m755 $< -- "$(DESTDIR)$(BINDIR)/$(COMMAND)"
+ install -dm755 -- "$(DESTDIR)$(LIBEXECDIR)"
+ install -m755 bin/orphan-reaper -- "$(DESTDIR)$(BINDIR)/$(COMMAND)"
+ install -m755 bin/reapd -- "$(DESTDIR)$(LIBEXECDIR)/reapd"
.PHONY: install-copyright
@@ -75,6 +89,7 @@ install-license:
.PHONY: uninstall
uninstall:
-rm -- "$(DESTDIR)$(BINDIR)/$(COMMAND)"
+ -rm -- "$(DESTDIR)$(LIBEXECDIR)/reapd"
-rm -- "$(DESTDIR)$(LICENSEDIR)/$(PKGNAME)/COPYING"
-rm -- "$(DESTDIR)$(LICENSEDIR)/$(PKGNAME)/LICENSE"