Commit ebadf47e authored by nagayama15's avatar nagayama15

cJSONへの埋め込み実験を追加

parent afaa67f8
......@@ -7,3 +7,6 @@
[submodule "example/lua/lua"]
path = example/lua/lua
url = git://github.com/lua/lua.git
[submodule "example/cJSON/cJSON"]
path = example/cJSON/cJSON
url = git://github.com/DaveGamble/cJSON.git
......@@ -5,6 +5,7 @@ all:
${MAKE} -C 8cc all
${MAKE} -C zlib all
${MAKE} -C lua all
${MAKE} -C cJSON all
${MAKE} -C fizzbuzz-rs all
${MAKE} -C numguess-rs all
......@@ -13,6 +14,7 @@ test:
${MAKE} -C 8cc test
${MAKE} -C zlib test
${MAKE} -C lua test
${MAKE} -C cJSON test
${MAKE} -C fizzbuzz-rs test
${MAKE} -C numguess-rs test
......
include ../../common.mk
WATERMARK := cJSON-watermarking
CFLAGS :=
CFLAGS_debug := -O0
CFLAGS_release := -O2 -DNDEBUG
CFLAGS += ${CFLAGS_${BUILD_TYPE}}
SRCS := \
cJSON/cJSON.c \
cJSON/cJSON_Utils.c
LLS := ${SRCS:cJSON/%.c=${OBJ_DIR}/%.ll}
LLS_WM := ${LLS:%.ll=%-wm.ll}
OBJS := ${LLS:.ll=.o}
OBJS_WM := ${LLS_WM:.ll=.o}
.PRECIOUS: ${LLS} ${LLS_WM}
all: \
${BIN_DIR}/libcjson.a \
${BIN_DIR}/libcjson-wm.a
test: \
${BIN_DIR}/libcjson.a \
${BIN_DIR}/libcjson-wm.a
${BIN_DIR}/libcjson.a: ${OBJS}
${BIN_DIR}/libcjson-wm.a: ${OBJS_WM}
%.a:
@mkdir -p ${@D}
${AR} rcs $@ $^
${OBJ_DIR}/%.o: ${OBJ_DIR}/%.ll
clang ${CFLAGS} -o $@ -c $^
${OBJ_DIR}/%.ll: cJSON/%.c
@mkdir -p ${@D}
clang ${CFLAGS} -S -emit-llvm -o $@ $<
%-wm.ll: %.ll
opt -load=${ROOT}/bin/${BUILD_TYPE}/src/nykk.so -block-wm -watermark=${WATERMARK} -S -o ${@:%-wm.ll=%-block-wm.ll} $< 2> ${@:%-wm.ll=%-block-wm.txt}
opt -load=${ROOT}/bin/${BUILD_TYPE}/src/nykk.so -inst-wm -watermark=${WATERMARK} -S -o $@ ${@:%-wm.ll=%-block-wm.ll} 2> ${@:%-wm.ll=%-inst-wm.txt}
Subproject commit c69134d01746dcf551dd7724b4edb12f922eb0d1
......@@ -50,6 +50,8 @@ echo "==== zlib block-wm ===="
h1 obj/$1/example/zlib/zlib-block-wm/*-block-wm.txt
echo "==== lua block-wm ===="
h1 obj/$1/example/lua/*-block-wm.txt
echo "==== cJSON block-wm ===="
h1 obj/$1/example/cJSON/*-block-wm.txt
echo "==== fizzbuzz-rs block-wm ===="
h1 obj/$1/example/fizzbuzz-rs/*-block-wm.txt
echo "==== numguess-rs block-wm ===="
......@@ -61,6 +63,8 @@ echo "==== zlib inst-wm ===="
h2 obj/$1/example/zlib/zlib-inst-wm/*-inst-wm.txt
echo "==== lua inst-wm ===="
h2 obj/$1/example/lua/*-inst-wm.txt
echo "==== cJSON inst-wm ===="
h2 obj/$1/example/cJSON/*-inst-wm.txt
echo "==== fizzbuzz-rs inst-wm ===="
h2 obj/$1/example/fizzbuzz-rs/*-inst-wm.txt
echo "==== numguess-rs inst-wm ===="
......
......@@ -24,3 +24,4 @@ h() {
h `ls example/8cc/8cc/*.c | awk -F 'example/8cc/8cc/utiltest.c' '{print $NF}'`
h example/zlib/zlib/*.c
h example/lua/lua/*.c
h example/cJSON/cJSON/cJSON.c example/cJSON/cJSON/cJSON_Utils.c
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment