Commit e6e8069e authored by nagayama15's avatar nagayama15

Luaへの埋め込みを追加

parent 157148f4
......@@ -4,3 +4,6 @@
[submodule "example/zlib/zlib"]
path = example/zlib/zlib
url = git@github.com:madler/zlib.git
[submodule "example/lua/lua"]
path = example/lua/lua
url = git://github.com/lua/lua.git
......@@ -4,6 +4,7 @@ all:
${MAKE} -C fizzbuzz all
${MAKE} -C 8cc all
${MAKE} -C zlib all
${MAKE} -C lua all
${MAKE} -C fizzbuzz-rs all
${MAKE} -C numguess-rs all
......@@ -11,6 +12,7 @@ test:
${MAKE} -C fizzbuzz test
${MAKE} -C 8cc test
${MAKE} -C zlib test
${MAKE} -C lua test
${MAKE} -C fizzbuzz-rs test
${MAKE} -C numguess-rs test
......
include ../../common.mk
WATERMARK := lua-watermarking
CFLAGS := -O2 -DNDEBUG -DLUA_USE_LINUX
LDFLAGS := -lm -ldl
SRCS := \
lua/lapi.c \
lua/lauxlib.c \
lua/lbaselib.c \
lua/lcode.c \
lua/lcorolib.c \
lua/lctype.c \
lua/ldblib.c \
lua/ldebug.c \
lua/ldo.c \
lua/ldump.c \
lua/lfunc.c \
lua/lgc.c \
lua/linit.c \
lua/liolib.c \
lua/llex.c \
lua/lmathlib.c \
lua/lmem.c \
lua/loadlib.c \
lua/lobject.c \
lua/lopcodes.c \
lua/loslib.c \
lua/lparser.c \
lua/lstate.c \
lua/lstring.c \
lua/lstrlib.c \
lua/ltable.c \
lua/ltablib.c \
lua/ltests.c \
lua/ltm.c \
lua/lua.c \
lua/lundump.c \
lua/lutf8lib.c \
lua/lvm.c \
lua/lzio.c
LLS := ${SRCS:lua/%.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}/lua \
${BIN_DIR}/lua-wm
test: \
${BIN_DIR}/lua \
${BIN_DIR}/lua-wm
${BIN_DIR}/lua: ${OBJS}
@mkdir -p ${@D}
clang ${CFLAGS} -o $@ $^ ${LDFLAGS}
${BIN_DIR}/lua-wm: ${OBJS_WM}
@mkdir -p ${@D}
clang ${CFLAGS} -o $@ $^ ${LDFLAGS}
${OBJ_DIR}/%.o: ${OBJ_DIR}/%.ll
clang ${CFLAGS} -o $@ -c $^
${OBJ_DIR}/%.ll: lua/%.c
@mkdir -p ${@D}
clang ${CFLAGS} -S -emit-llvm -o $@ $<
%-wm.ll: %.ll
opt -load=${ROOT}/bin/src/nykk.so -block-wm -watermark=${WATERMARK} -S -o ${@:%-wm.ll=%-block-wm.ll} $< 2> ${@:%-wm.ll=%-block-wm.txt}
opt -load=${ROOT}/bin/src/nykk.so -inst-wm -watermark=${WATERMARK} -S -o $@ ${@:%-wm.ll=%-block-wm.ll} 2> ${@:%-wm.ll=%-inst-wm.txt}
Subproject commit 4ace93ca6502dd1da38d5c06fa099d229e791ba8
......@@ -48,6 +48,8 @@ echo "==== 8cc block-wm ===="
h1 obj/example/8cc/stage1-wm/*-block-wm.txt
echo "==== zlib block-wm ===="
h1 obj/example/zlib/zlib-block-wm/*-block-wm.txt
echo "==== lua block-wm ===="
h1 obj/example/lua/*-block-wm.txt
echo "==== fizzbuzz-rs block-wm ===="
h1 obj/example/fizzbuzz-rs/*-block-wm.txt
echo "==== numguess-rs block-wm ===="
......@@ -57,6 +59,8 @@ echo "==== 8cc inst-wm ===="
h2 obj/example/8cc/stage1-wm/*-inst-wm.txt
echo "==== zlib inst-wm ===="
h2 obj/example/zlib/zlib-inst-wm/*-inst-wm.txt
echo "==== lua inst-wm ===="
h2 obj/example/lua/*-inst-wm.txt
echo "==== fizzbuzz-rs inst-wm ===="
h2 obj/example/fizzbuzz-rs/*-inst-wm.txt
echo "==== numguess-rs inst-wm ===="
......
......@@ -23,3 +23,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
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