Index: src/Makefile
--- src/Makefile.orig	2019-03-05 23:16:59.000000000 +0100
+++ src/Makefile	2019-03-05 23:17:10.058564000 +0100
@@ -13,7 +13,7 @@
     suffix := .debug
 else
     ifeq ($(debug),no)
-        CXXFLAGS += -O3
+        CXXFLAGS += -O2
         suffix := .opt
     else
         $(error debug should be either yes or no)
@@ -52,40 +52,17 @@
 DESTDIR ?= # root dir
 
 bindir := $(DESTDIR)$(PREFIX)/bin
-sharedir := $(DESTDIR)$(PREFIX)/share/kak
-docdir := $(DESTDIR)$(PREFIX)/share/doc/kak
-mandir := $(DESTDIR)$(PREFIX)/share/man/man1
+sharedir := $(DESTDIR)$(PREFIX)/share/kakoune
+docdir := $(DESTDIR)$(PREFIX)/share/kakoune/doc
+mandir := $(DESTDIR)$(PREFIX)/man/man1
 
 os := $(shell uname)
 
-ifeq ($(os),Darwin)
-    LIBS += -lncurses
-    CPPFLAGS += -I$(PREFIX)/opt/ncurses/include -I/opt/local/include
-    LDFLAGS += -L$(PREFIX)/opt/ncurses/lib -L/opt/local/lib
-else ifeq ($(os),FreeBSD)
-    LIBS += -ltinfow -lncursesw
-    CPPFLAGS += -I/usr/local/include
-    LDFLAGS += -L/usr/local/lib
-else ifeq ($(os),Haiku)
-    LIBS += -lncursesw -lnetwork -lbe
-else ifeq ($(os),OpenBSD)
-    LIBS += -lncursesw
-    CPPFLAGS += -D'KAK_BIN_PATH="$(bindir)/kak"' -I/usr/local/include
-    LDFLAGS += -L/usr/local/lib
-else ifneq (,$(findstring CYGWIN,$(os)))
-    CPPFLAGS += -D_XOPEN_SOURCE=700
-    LIBS += -lncursesw -ldbghelp
-else
-    ifeq ($(PKG_CONFIG),)
-    	$(error "pkg-config not found in PATH")
-    endif
-
-    LIBS += $(shell $(PKG_CONFIG) $(PKG_CONFIG_FLAGS) --libs ncursesw)
-    CPPFLAGS += $(shell $(PKG_CONFIG) $(PKG_CONFIG_FLAGS) --cflags ncursesw)
-    LDFLAGS += -rdynamic
-endif
+LIBS += -lncursesw -lboost_regex
+CPPFLAGS += -I$(PREFIX)/include -I$(PREFIX)/include/ncurses
+LDFLAGS += -L$(PREFIX)/lib
 
-CXXFLAGS += -pedantic -std=c++17 -g -Wall -Wextra -Wno-unused-parameter -Wno-sign-compare -Wno-address
+CXXFLAGS += -std=c++17 -Wno-unused-parameter -Wno-sign-compare -Wno-address
 
 all : kak
 
