kore

An easy to use, scalable and secure web application framework for writing web APIs in C.
Commits | Files | Refs | README | LICENSE | git clone https://git.kore.io/kore.git

commit 81d119ff93067385ac0ca975a55ea343dfd3ae8d
parent 3682c759f97ebf6074ee5ce6c808dd0ad1144a7a
Author: Joris Vink <joris@coders.se>
Date:   Thu, 11 Jun 2015 19:20:08 +0200

Let kore build pickup any environment CFLAGS.

Diffstat:
src/cli.c | 15+++++++++++++--
1 file changed, 13 insertions(+), 2 deletions(-)

diff --git a/src/cli.c b/src/cli.c @@ -57,6 +57,7 @@ #endif #define LD_FLAGS_MAX 10 +#define CFLAGS_MAX 10 struct cmd { const char *name; @@ -868,9 +869,10 @@ cli_generate_certs(void) static void cli_compile_cfile(void *arg) { - int idx; + int idx, f, i; struct cfile *cf = arg; - char *args[24], *ipath[2], *p, *cppstandard; + char *flags[CFLAGS_MAX], *p; + char *args[30 + CFLAGS_MAX], *ipath[2], *cppstandard; #if defined(KORE_USE_PGSQL) char *ppath; #endif @@ -892,6 +894,15 @@ cli_compile_cfile(void *arg) args[idx++] = "-I/usr/local/include"; #endif + /* Add any user specified flags. */ + if ((p = getenv("CFLAGS")) != NULL) + f = kore_split_string(p, " ", flags, CFLAGS_MAX); + else + f = 0; + + for (i = 0; i < f; i++) + args[idx++] = flags[i]; + #if defined(KORE_USE_PGSQL) (void)cli_vasprintf(&ppath, "-I%s", PGSQL_INCLUDE_PATH); args[idx++] = ppath;