--- Makefile	2018-12-01 10:49:16.048504860 +0100
+++ Makefile	2018-12-01 10:50:04.173829007 +0100
@@ -6,10 +6,10 @@
 KORE=kore
 KODEV=kodev/kodev
 KORE_CRYPTO?=crypto
-INSTALL_DIR=$(PREFIX)/bin
-MAN_DIR=$(PREFIX)/share/man
-SHARE_DIR=$(PREFIX)/share/kore
-INCLUDE_DIR=$(PREFIX)/include/kore
+INSTALL_DIR=$(DESTDIR)/$(PREFIX)/bin
+MAN_DIR=$(DESTDIR)/$(PREFIX)/share/man
+SHARE_DIR=$(DESTDIR)/$(PREFIX)/share/kore
+INCLUDE_DIR=$(DESTDIR)/$(PREFIX)/include/kore
 
 VERSION=src/version.c
 
@@ -21,7 +21,7 @@
 FEATURES=
 FEATURES_INC=
 
-CFLAGS+=-Wall -Werror -Wstrict-prototypes -Wmissing-prototypes
+CFLAGS::=$(CFLAGS) -Wall -Werror -Wstrict-prototypes -Wmissing-prototypes
 CFLAGS+=-Wmissing-declarations -Wshadow -Wpointer-arith -Wcast-qual
 CFLAGS+=-Wsign-compare -Iinclude/kore -std=c99 -pedantic
 CFLAGS+=-DPREFIX='"$(PREFIX)"' -fstack-protector-all
--- kodev/Makefile.orig	2018-12-01 10:53:51.779628063 +0100
+++ kodev/Makefile	2018-12-01 10:54:18.675249411 +0100
@@ -4,7 +4,7 @@
 PREFIX?=/usr/local
 OBJDIR?=obj
 KODEV=kodev
-INSTALL_DIR=$(PREFIX)/bin
+INSTALL_DIR=$(DESTDIR)/$(PREFIX)/bin
 
 S_SRC=	../src/cli.c
 
