aboutsummaryrefslogtreecommitdiffstats
path: root/Makefile
diff options
context:
space:
mode:
Diffstat (limited to 'Makefile')
-rw-r--r--Makefile43
1 files changed, 43 insertions, 0 deletions
diff --git a/Makefile b/Makefile
new file mode 100644
index 0000000..982352c
--- /dev/null
+++ b/Makefile
@@ -0,0 +1,43 @@
+# Copyright (C) 2018 Tomasz Kramkowski <tk@the-tk.com>
+# SPDX-License-Identifier: MIT
+-include config.mk
+
+PROG := bie
+MANPAGE := $(PROG).1
+VERSION != git describe --tags 2>/dev/null || echo "v0.1"
+
+EPRINTF_PATH ?= ../eprintf
+PKG_CONFIG ?= pkg-config
+LN ?= ln -sf
+
+CPPFLAGS += -DVERSION=\"$(VERSION)\"
+CFLAGS += -std=c11 -MMD -MP
+
+OBJ := bie.o eprintf.o
+DEP := $(OBJ:.o=.d)
+
+prefix ?= /usr/local
+exec_prefix ?= $(prefix)
+bindir = $(exec_prefix)/bin
+datarootdir = $(prefix)/share
+mandir = $(datarootdir)/man
+man1dir = $(mandir)/man1
+
+all: $(PROG) $(MANPAGE)
+$(PROG): $(OBJ)
+bie.o: eprintf.h
+$(MANPAGE): $(MANPAGE).in
+ m4 -DVERSION=$(VERSION) $^ >$@
+
+install: $(PROG) $(MANPAGE)
+ install -Dm755 -s $(PROG) -t $(DESTDIR)$(bindir)
+ install -Dm644 $(MANPAGE) -t $(DESTDIR)$(man1dir)
+
+clean:
+ $(RM) $(OBJ) $(DEP) $(PROG) $(MANPAGE)
+
+include $(EPRINTF_PATH)/module.mk
+
+-include $(DEP)
+
+.PHONY: all install clean