When compiling with PGSQL, note the include dir for "kore build"

This commit is contained in:
Joris Vink 2014-08-03 17:33:40 +02:00
parent 939d948ee2
commit 2b40672ba1
2 changed files with 32 additions and 20 deletions

View File

@ -32,7 +32,8 @@ endif
ifneq ("$(PGSQL)", "") ifneq ("$(PGSQL)", "")
S_SRC+=src/pgsql.c S_SRC+=src/pgsql.c
LDFLAGS+=-L$(shell pg_config --libdir) -lpq LDFLAGS+=-L$(shell pg_config --libdir) -lpq
CFLAGS+=-I$(shell pg_config --includedir) -DKORE_USE_PGSQL CFLAGS+=-I$(shell pg_config --includedir) -DKORE_USE_PGSQL \
-DPGSQL_INCLUDE_PATH="\"$(shell pg_config --includedir)\""
endif endif
ifneq ("$(TASKS)", "") ifneq ("$(TASKS)", "")

View File

@ -793,8 +793,12 @@ cli_generate_certs(void)
static void static void
cli_compile_cfile(void *arg) cli_compile_cfile(void *arg)
{ {
int idx;
struct cfile *cf = arg; struct cfile *cf = arg;
char *args[18], *ipath; char *args[20], *ipath;
#if defined(KORE_USE_PGSQL)
char *ppath;
#endif
(void)cli_vasprintf(&ipath, "-I%s/src", appl); (void)cli_vasprintf(&ipath, "-I%s/src", appl);
@ -802,25 +806,32 @@ cli_compile_cfile(void *arg)
* These compiler options should be settable * These compiler options should be settable
* somehow by the user if they so choose. * somehow by the user if they so choose.
*/ */
args[0] = compiler; idx = 0;
args[1] = ipath; args[idx++] = compiler;
args[2] = "-I/usr/local/include"; args[idx++] = ipath;
args[3] = "-Wall"; args[idx++] = "-I/usr/local/include";
args[4] = "-Wstrict-prototypes";
args[5] = "-Wmissing-prototypes";
args[6] = "-Wmissing-declarations";
args[7] = "-Wshadow";
args[8] = "-Wpointer-arith";
args[9] = "-Wcast-qual";
args[10] = "-Wsign-compare";
args[11] = "-fPIC";
args[12] = "-g";
args[13] = "-c"; #if defined(KORE_USE_PGSQL)
args[14] = cf->fpath; (void)cli_vasprintf(&ppath, "-I%s", PGSQL_INCLUDE_PATH);
args[15] = "-o"; args[idx++] = ppath;
args[16] = cf->opath; #endif
args[17] = NULL;
args[idx++] = "-Wall";
args[idx++] = "-Wstrict-prototypes";
args[idx++] = "-Wmissing-prototypes";
args[idx++] = "-Wmissing-declarations";
args[idx++] = "-Wshadow";
args[idx++] = "-Wpointer-arith";
args[idx++] = "-Wcast-qual";
args[idx++] = "-Wsign-compare";
args[idx++] = "-fPIC";
args[idx++] = "-g";
args[idx++] = "-c";
args[idx++] = cf->fpath;
args[idx++] = "-o";
args[idx++] = cf->opath;
args[idx] = NULL;
execvp(compiler, args); execvp(compiler, args);
} }