summary refs log tree commit diff
diff options
context:
space:
mode:
-rw-r--r--.gitignore1
-rw-r--r--Makefile8
-rwxr-xr-xconfigure11
3 files changed, 15 insertions, 5 deletions
diff --git a/.gitignore b/.gitignore
index 64b2b13..4cc4220 100644
--- a/.gitignore
+++ b/.gitignore
@@ -1,3 +1,4 @@
 *.o
 catgirl
+config.mk
 tags
diff --git a/Makefile b/Makefile
index 213ecb5..5380d20 100644
--- a/Makefile
+++ b/Makefile
@@ -1,9 +1,7 @@
-LIBRESSL_PREFIX = /usr/local
-CFLAGS += -I${LIBRESSL_PREFIX}/include
-LDFLAGS += -L${LIBRESSL_PREFIX}/lib
-
 CFLAGS += -std=c11 -Wall -Wextra -Wpedantic
-LDLIBS = -lcurses -lcrypto -ltls
+LDLIBS = -lcrypto -ltls -lncursesw
+
+-include config.mk
 
 OBJS += chat.o
 OBJS += command.o
diff --git a/configure b/configure
new file mode 100755
index 0000000..90e1173
--- /dev/null
+++ b/configure
@@ -0,0 +1,11 @@
+#!/bin/sh
+set -eu
+
+libs='libcrypto libtls ncursesw'
+pkg-config --print-errors $libs
+
+cat >config.mk <<EOF
+CFLAGS += $(pkg-config --cflags $libs)
+LDFLAGS += $(pkg-config --libs-only-L $libs)
+LDLIBS = $(pkg-config --libs-only-l $libs)
+EOF