Added ability to set path prefix during make.

This commit is contained in:
Andreas Pfohl 2014-12-11 23:58:15 +01:00
parent c494126720
commit 24e1d3928d
2 changed files with 9 additions and 2 deletions

View File

@ -1,9 +1,10 @@
# Kore Makefile # Kore Makefile
CC?=gcc CC?=gcc
PREFIX?=/usr/local
KORE=kore KORE=kore
INSTALL_DIR=/usr/local/bin INSTALL_DIR=$(PREFIX)/bin
INCLUDE_DIR=/usr/local/include/kore 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 \ 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 \ 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+=-Wall -Wstrict-prototypes -Wmissing-prototypes
CFLAGS+=-Wmissing-declarations -Wshadow -Wpointer-arith -Wcast-qual CFLAGS+=-Wmissing-declarations -Wshadow -Wpointer-arith -Wcast-qual
CFLAGS+=-Wsign-compare -Iincludes -g CFLAGS+=-Wsign-compare -Iincludes -g
CFLAGS+=-DPREFIX='"$(PREFIX)"'
LDFLAGS+=-rdynamic -lssl -lcrypto -lz LDFLAGS+=-rdynamic -lssl -lcrypto -lz
ifneq ("$(DEBUG)", "") ifneq ("$(DEBUG)", "")
@ -60,6 +62,7 @@ all: $(S_OBJS)
install: install:
mkdir -p $(INCLUDE_DIR) mkdir -p $(INCLUDE_DIR)
mkdir -p $(INSTALL_DIR)
install -m 555 $(KORE) $(INSTALL_DIR)/$(KORE) install -m 555 $(KORE) $(INSTALL_DIR)/$(KORE)
install -m 644 includes/*.h $(INCLUDE_DIR) install -m 644 includes/*.h $(INCLUDE_DIR)

View File

@ -844,7 +844,11 @@ cli_compile_cfile(void *arg)
args[idx++] = compiler; args[idx++] = compiler;
args[idx++] = ipath[0]; args[idx++] = ipath[0];
args[idx++] = ipath[1]; args[idx++] = ipath[1];
#if defined(PREFIX)
(void)cli_vasprintf(&args[idx++], "-I%s/include", PREFIX);
#else
args[idx++] = "-I/usr/local/include"; args[idx++] = "-I/usr/local/include";
#endif
#if defined(KORE_USE_PGSQL) #if defined(KORE_USE_PGSQL)
(void)cli_vasprintf(&ppath, "-I%s", PGSQL_INCLUDE_PATH); (void)cli_vasprintf(&ppath, "-I%s", PGSQL_INCLUDE_PATH);