summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/json-c-test.c23
-rw-r--r--src/json-c.mk5
2 files changed, 28 insertions, 0 deletions
diff --git a/src/json-c-test.c b/src/json-c-test.c
new file mode 100644
index 0000000..676d6be
--- /dev/null
+++ b/src/json-c-test.c
@@ -0,0 +1,23 @@
+/*
+ * This file is part of MXE.
+ * See index.html for further information.
+ */
+
+#include <json/json.h>
+#include <stdio.h>
+
+int main(int argc, char *argv[])
+{
+ json_object *jobj;
+
+ (void)argc;
+ (void)argv;
+
+ jobj = json_object_new_object();
+ if (!jobj) {
+ return 1;
+ }
+ json_object_object_add(jobj, "key", json_object_new_string("value"));
+ printf("%s", json_object_to_json_string(jobj));
+ return 0;
+}
diff --git a/src/json-c.mk b/src/json-c.mk
index 9533971..e722213 100644
--- a/src/json-c.mk
+++ b/src/json-c.mk
@@ -25,4 +25,9 @@ define $(PKG)_BUILD
--disable-shared
CFLAGS=-Wno-error
$(MAKE) -C '$(1)' -j '$(JOBS)' install
+
+ '$(TARGET)-gcc' \
+ -W -Wall -Werror -ansi -pedantic \
+ '$(2).c' -o '$(PREFIX)/$(TARGET)/bin/test-json-c.exe' \
+ `'$(TARGET)-pkg-config' json --cflags --libs`
endef