diff --git a/Makefile b/Makefile index d720605..2f5588b 100644 --- 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 index 0ecd528..965283f 100644 --- 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);