Commit 2e0e0053 authored by nagayama15's avatar nagayama15

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

parent ebadf47e
...@@ -10,3 +10,6 @@ ...@@ -10,3 +10,6 @@
[submodule "example/cJSON/cJSON"] [submodule "example/cJSON/cJSON"]
path = example/cJSON/cJSON path = example/cJSON/cJSON
url = git://github.com/DaveGamble/cJSON.git url = git://github.com/DaveGamble/cJSON.git
[submodule "example/tree/tree"]
path = example/tree/tree
url = git://github.com/execjosh/tree.git
...@@ -6,6 +6,7 @@ all: ...@@ -6,6 +6,7 @@ all:
${MAKE} -C zlib all ${MAKE} -C zlib all
${MAKE} -C lua all ${MAKE} -C lua all
${MAKE} -C cJSON all ${MAKE} -C cJSON all
${MAKE} -C tree all
${MAKE} -C fizzbuzz-rs all ${MAKE} -C fizzbuzz-rs all
${MAKE} -C numguess-rs all ${MAKE} -C numguess-rs all
...@@ -15,6 +16,7 @@ test: ...@@ -15,6 +16,7 @@ test:
${MAKE} -C zlib test ${MAKE} -C zlib test
${MAKE} -C lua test ${MAKE} -C lua test
${MAKE} -C cJSON test ${MAKE} -C cJSON test
${MAKE} -C tree test
${MAKE} -C fizzbuzz-rs test ${MAKE} -C fizzbuzz-rs test
${MAKE} -C numguess-rs test ${MAKE} -C numguess-rs test
......
include ../../common.mk
WATERMARK := tree-watermarking
CFLAGS :=
CFLAGS_debug := -O0
CFLAGS_release := -O2 -DNDEBUG
CFLAGS += ${CFLAGS_${BUILD_TYPE}}
LDFLAGS :=
SRCS := \
tree/tree.c \
tree/unix.c \
tree/html.c \
tree/xml.c \
tree/json.c \
tree/hash.c \
tree/color.c
LLS := ${SRCS:tree/%.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}/tree \
${BIN_DIR}/tree-wm
test: \
${BIN_DIR}/tree \
${BIN_DIR}/tree-wm
${BIN_DIR}/tree: ${OBJS}
@mkdir -p ${@D}
clang ${CFLAGS} -o $@ $^ ${LDFLAGS}
${BIN_DIR}/tree-wm: ${OBJS_WM}
@mkdir -p ${@D}
clang ${CFLAGS} -o $@ $^ ${LDFLAGS}
${OBJ_DIR}/%.o: ${OBJ_DIR}/%.ll
clang ${CFLAGS} -o $@ -c $^
${OBJ_DIR}/%.ll: tree/%.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 d26f1e45f49c6a4f42cba5296704753a57a826e8
...@@ -52,6 +52,8 @@ echo "==== lua block-wm ====" ...@@ -52,6 +52,8 @@ echo "==== lua block-wm ===="
h1 obj/$1/example/lua/*-block-wm.txt h1 obj/$1/example/lua/*-block-wm.txt
echo "==== cJSON block-wm ====" echo "==== cJSON block-wm ===="
h1 obj/$1/example/cJSON/*-block-wm.txt h1 obj/$1/example/cJSON/*-block-wm.txt
echo "==== tree block-wm ===="
h1 obj/$1/example/tree/*-block-wm.txt
echo "==== fizzbuzz-rs block-wm ====" echo "==== fizzbuzz-rs block-wm ===="
h1 obj/$1/example/fizzbuzz-rs/*-block-wm.txt h1 obj/$1/example/fizzbuzz-rs/*-block-wm.txt
echo "==== numguess-rs block-wm ====" echo "==== numguess-rs block-wm ===="
...@@ -65,6 +67,8 @@ echo "==== lua inst-wm ====" ...@@ -65,6 +67,8 @@ echo "==== lua inst-wm ===="
h2 obj/$1/example/lua/*-inst-wm.txt h2 obj/$1/example/lua/*-inst-wm.txt
echo "==== cJSON inst-wm ====" echo "==== cJSON inst-wm ===="
h2 obj/$1/example/cJSON/*-inst-wm.txt h2 obj/$1/example/cJSON/*-inst-wm.txt
echo "==== tree inst-wm ===="
h2 obj/$1/example/tree/*-inst-wm.txt
echo "==== fizzbuzz-rs inst-wm ====" echo "==== fizzbuzz-rs inst-wm ===="
h2 obj/$1/example/fizzbuzz-rs/*-inst-wm.txt h2 obj/$1/example/fizzbuzz-rs/*-inst-wm.txt
echo "==== numguess-rs inst-wm ====" echo "==== numguess-rs inst-wm ===="
......
...@@ -25,3 +25,4 @@ h `ls example/8cc/8cc/*.c | awk -F 'example/8cc/8cc/utiltest.c' '{print $NF}'` ...@@ -25,3 +25,4 @@ h `ls example/8cc/8cc/*.c | awk -F 'example/8cc/8cc/utiltest.c' '{print $NF}'`
h example/zlib/zlib/*.c h example/zlib/zlib/*.c
h example/lua/lua/*.c h example/lua/lua/*.c
h example/cJSON/cJSON/cJSON.c example/cJSON/cJSON/cJSON_Utils.c h example/cJSON/cJSON/cJSON.c example/cJSON/cJSON/cJSON_Utils.c
h example/tree/tree/*.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