separate JSON2TSV_* CFLAGS, LDFLAGS, use unlocked I/O by default - json2tsv - JSON to TSV converter
(HTM) git clone git://git.codemadness.org/json2tsv
(DIR) Log
(DIR) Files
(DIR) Refs
(DIR) README
(DIR) LICENSE
---
(DIR) commit 770996c13b04532dacf3a190f57dd0c06ed4e7a7
(DIR) parent 917726e20fb722b0097e5be8a2f68ba385c58d66
(HTM) Author: Hiltjo Posthuma <hiltjo@codemadness.org>
Date: Thu, 29 Apr 2021 12:57:45 +0200
separate JSON2TSV_* CFLAGS, LDFLAGS, use unlocked I/O by default
Diffstat:
M Makefile | 12 ++++++++++--
M json.c | 4 +++-
2 files changed, 13 insertions(+), 3 deletions(-)
---
(DIR) diff --git a/Makefile b/Makefile
@@ -10,6 +10,14 @@ DOCPREFIX = ${PREFIX}/share/doc/${NAME}
RANLIB = ranlib
+# use system flags.
+JSON2TSV_CFLAGS = ${CFLAGS}
+JSON2TSV_LDFLAGS = ${LDFLAGS}
+JSON2TSV_CPPFLAGS = -D_DEFAULT_SOURCE
+
+# uncomment for conservative locked I/O.
+#JSON2TSV_CPPFLAGS = -D_DEFAULT_SOURCE -DGETNEXT=getchar
+
BIN = ${NAME}
SRC = ${BIN:=.c}
HDR = json.h
@@ -33,10 +41,10 @@ OBJ = ${SRC:.c=.o} ${LIBJSONOBJ}
${OBJ}: ${HDR}
.o:
- ${CC} ${LDFLAGS} -o $@ $< ${LIB}
+ ${CC} ${JSON2TSV_LDFLAGS} -o $@ $< ${LIB}
.c.o:
- ${CC} ${CFLAGS} ${CPPFLAGS} -o $@ -c $<
+ ${CC} ${JSON2TSV_CFLAGS} ${JSON2TSV_CPPFLAGS} -o $@ -c $<
${LIBJSON}: ${LIBJSONOBJ}
${AR} -rc $@ $?
(DIR) diff --git a/json.c b/json.c
@@ -5,7 +5,9 @@
#include <stdlib.h>
#include <string.h>
-#define GETNEXT getchar
+#ifndef GETNEXT
+#define GETNEXT getchar_unlocked
+#endif
#include "json.h"