summaryrefslogtreecommitdiff
path: root/Makefile
diff options
context:
space:
mode:
authorSam Nystrom <sam@samnystrom.dev>2024-01-15 13:35:27 -0500
committerSam Nystrom <sam@samnystrom.dev>2024-01-15 13:35:27 -0500
commit2bdd00aa69b901e5230c9b8c24727011626ebeaa (patch)
tree27967a3ccc64ac477cb0336f4e61282e8ab832ff /Makefile
Diffstat (limited to 'Makefile')
-rw-r--r--Makefile45
1 files changed, 45 insertions, 0 deletions
diff --git a/Makefile b/Makefile
new file mode 100644
index 0000000..30472c8
--- /dev/null
+++ b/Makefile
@@ -0,0 +1,45 @@
+.POSIX:
+.SUFFIXES:
+
+CFLAGS = -Os -Wall -Wextra -pedantic
+LDFLAGS = -static
+LIBS = -lskarnet
+
+PREFIX = /usr/local
+BINDIR = $(PREFIX)/bin
+SHAREDIR = $(PREFIX)/share
+MANDIR = $(SHAREDIR)/man
+
+all: cdbget cdbdump cdbmake
+
+cdbget: cdbget.c
+ $(CC) $(CFLAGS) $(LDFLAGS) $< -o $@ $(LIBS)
+
+cdbdump: cdbdump.c
+ $(CC) $(CFLAGS) $(LDFLAGS) $< -o $@ $(LIBS)
+
+cdbmake: cdbmake.c
+ $(CC) $(CFLAGS) $(LDFLAGS) $< -o $@ $(LIBS)
+
+clean:
+ rm -f cdbget cdbdump cdbmake
+
+install:
+ install -Dm755 cdbget $(BINDIR)/cdbget
+ install -Dm755 cdbdump $(BINDIR)/cdbdump
+ install -Dm755 cdbmake $(BINDIR)/cdbmake
+ install -Dm644 cdb.5 $(MANDIR)/man5/cdb.5
+ install -Dm644 cdbget.1 $(MANDIR)/man1/cdbget.1
+ install -Dm644 cdbdump.1 $(MANDIR)/man1/cdbdump.1
+ install -Dm644 cdbmake.1 $(MANDIR)/man1/cdbmake.1
+
+uninstall:
+ rm -f $(BINDIR)/cdbget
+ rm -f $(BINDIR)/cdbdump
+ rm -f $(BINDIR)/cdbmake
+ rm -f $(MANDIR)/man5/cdb.5
+ rm -f $(MANDIR)/man1/cdbget.1
+ rm -f $(MANDIR)/man1/cdbdump.1
+ rm -f $(MANDIR)/man1/cdbmake.1
+
+.PHONY: all clean install uninstall