summaryrefslogtreecommitdiff
path: root/Makefile
diff options
context:
space:
mode:
authorPeter Wu <lekensteyn@gmail.com>2013-07-08 22:18:56 +0200
committerPeter Wu <lekensteyn@gmail.com>2013-07-09 00:08:23 +0200
commit2523835aaccc6663f9884b82c778abcccaddbd82 (patch)
treeba00c3221aa8bbccb83c79e6f418c8633031696a /Makefile
downloadfemtomail-2523835aaccc6663f9884b82c778abcccaddbd82.tar.gz
Initial commit
Diffstat (limited to 'Makefile')
-rw-r--r--Makefile35
1 files changed, 35 insertions, 0 deletions
diff --git a/Makefile b/Makefile
new file mode 100644
index 0000000..8fe0fc5
--- /dev/null
+++ b/Makefile
@@ -0,0 +1,35 @@
+SBINDIR ?= /usr/sbin
+OBJDIR ?= .
+DESTDIR ?=
+
+INSTALL ?= install
+RM ?= rm
+LN ?= ln
+SETCAP ?= setcap
+
+CFLAGS ?= -Wall -Wextra -O2 -g
+ifneq ($(MAILBOX_PATH),)
+ override CFLAGS += -DMAILBOX_PATH="$(MAILBOX_PATH)"
+endif
+
+all: $(OBJDIR)/femtomail
+.PHONY: all install install-link-sendmail setcap clean
+
+$(OBJDIR)/femtomail: femtomail.c
+ifeq ($(USERNAME),)
+ $(error USERNAME must be set and non-empty)
+endif
+ $(CC) -DUSERNAME="$(USERNAME)" $(CFLAGS) -o $(DESTDIR)$@ $<
+
+clean:
+ $(RM) $(OBJDIR)/femtomail
+
+install: $(OBJDIR)/femtomail
+ $(INSTALL) -m 755 -d $(DESTDIR)$(SBINDIR)
+ $(INSTALL) -m 755 $(OBJDIR)/femtomail $(DESTDIR)$(SBINDIR)/femtomail
+
+install-link-sendmail: install
+ $(LN) -s femtomail $(DESTDIR)$(SBINDIR)/sendmail
+
+setcap: install
+ $(SETCAP) cap_setuid,cap_setgid=ep $(DESTDIR)$(SBINDIR)/femtomail