commit 182126080ec334dc1bf6ad0c5e28177297a66a28
parent c494126720cad85e4b40cec6035485f2f04862cd
Author: Joris Vink <joris@coders.se>
Date: Fri, 12 Dec 2014 12:40:44 +0100
Merge pull request #25 from apfohl/prefix
Added ability to set path prefix during make.
Diffstat:
2 files changed, 9 insertions(+), 2 deletions(-)
diff --git a/Makefile b/Makefile
@@ -1,9 +1,10 @@
# Kore Makefile
CC?=gcc
+PREFIX?=/usr/local
KORE=kore
-INSTALL_DIR=/usr/local/bin
-INCLUDE_DIR=/usr/local/include/kore
+INSTALL_DIR=$(PREFIX)/bin
+INCLUDE_DIR=$(PREFIX)/include/kore
S_SRC= src/kore.c src/accesslog.c src/auth.c src/buf.c src/cli.c src/config.c \
src/connection.c src/domain.c src/http.c src/mem.c src/module.c \
@@ -14,6 +15,7 @@ S_OBJS= $(S_SRC:.c=.o)
CFLAGS+=-Wall -Wstrict-prototypes -Wmissing-prototypes
CFLAGS+=-Wmissing-declarations -Wshadow -Wpointer-arith -Wcast-qual
CFLAGS+=-Wsign-compare -Iincludes -g
+CFLAGS+=-DPREFIX='"$(PREFIX)"'
LDFLAGS+=-rdynamic -lssl -lcrypto -lz
ifneq ("$(DEBUG)", "")
@@ -60,6 +62,7 @@ all: $(S_OBJS)
install:
mkdir -p $(INCLUDE_DIR)
+ mkdir -p $(INSTALL_DIR)
install -m 555 $(KORE) $(INSTALL_DIR)/$(KORE)
install -m 644 includes/*.h $(INCLUDE_DIR)
diff --git a/src/cli.c b/src/cli.c
@@ -844,7 +844,11 @@ cli_compile_cfile(void *arg)
args[idx++] = compiler;
args[idx++] = ipath[0];
args[idx++] = ipath[1];
+#if defined(PREFIX)
+ (void)cli_vasprintf(&args[idx++], "-I%s/include", PREFIX);
+#else
args[idx++] = "-I/usr/local/include";
+#endif
#if defined(KORE_USE_PGSQL)
(void)cli_vasprintf(&ppath, "-I%s", PGSQL_INCLUDE_PATH);