Commit 8b51dbaf authored by nagayama15's avatar nagayama15

ビルドタイプごとに出力ディレクトリを分けるように変更

parent e6e8069e
.DEFAULT_GOAL := all
BUILD_TYPE := debug
ROOT := $(realpath ${PWD})
CD := $(realpath ${CURDIR})
BIN_DIR := ${ROOT}/bin${CD:${ROOT}%=%}
OBJ_DIR := ${ROOT}/obj${CD:${ROOT}%=%}
BIN_DIR := ${ROOT}/bin/${BUILD_TYPE}${CD:${ROOT}%=%}
OBJ_DIR := ${ROOT}/obj/${BUILD_TYPE}${CD:${ROOT}%=%}
.PHONY: all test clean
......
......@@ -13,6 +13,10 @@ CXXFLAGS := \
-fPIC \
-fno-rtti
CXXFLAGS_debug := -O0
CXXFLAGS_release := -O2 -DNDEBUG
CXXFLAGS += ${CXXFLAGS_${BUILD_TYPE}}
OBJS := ${SRCS:%.cpp=${OBJ_DIR}/%.o}
DEPS := ${OBJS:.o=.d}
......
......@@ -70,8 +70,8 @@ ${OBJ_DIR}/stage3/%.o: 8cc/%.c ${BIN_DIR}/stage2/8cc.out
${OBJ_DIR}/stage1-wm/%.o: 8cc/%.c
@mkdir -p ${@D}
clang ${CFLAGS} -S -emit-llvm -o ${@:%.o=%.ll} $<
opt -load=${ROOT}/bin/src/nykk.so -block-wm -watermark=${WATERMARK} -S -o ${@:%.o=%-block-wm.ll} ${@:%.o=%.ll} 2> ${@:%.o=%-block-wm.txt}
opt -load=${ROOT}/bin/src/nykk.so -inst-wm -watermark=${WATERMARK} -S -o ${@:%.o=%-inst-wm.ll} ${@:%.o=%-block-wm.ll} 2> ${@:%.o=%-inst-wm.txt}
opt -load=${ROOT}/bin/${BUILD_TYPE}/src/nykk.so -block-wm -watermark=${WATERMARK} -S -o ${@:%.o=%-block-wm.ll} ${@:%.o=%.ll} 2> ${@:%.o=%-block-wm.txt}
opt -load=${ROOT}/bin/${BUILD_TYPE}/src/nykk.so -inst-wm -watermark=${WATERMARK} -S -o ${@:%.o=%-inst-wm.ll} ${@:%.o=%-block-wm.ll} 2> ${@:%.o=%-inst-wm.txt}
clang ${CFLAGS} -o $@ -c ${@:%.o=%-inst-wm.ll}
${OBJ_DIR}/stage2-wm/%.o: 8cc/%.c ${BIN_DIR}/stage1-wm/8cc.out
......
......@@ -20,8 +20,8 @@ ${OBJ_DIR}/fizzbuzz.ll: fizzbuzz.rs
${OBJ_DIR}/fizzbuzz-wm.ll: ${OBJ_DIR}/fizzbuzz.ll
@mkdir -p ${@D}
opt -load=${ROOT}/bin/src/nykk.so -block-wm -watermark=rust-project -S -o ${@:%-wm.ll=%-block.ll} $< 2> ${@:%-wm.ll=%-block-wm.txt}
opt -load=${ROOT}/bin/src/nykk.so -inst-wm -watermark=rust-project -S -o $@ ${@:%-wm.ll=%-block.ll} 2> ${@:%-wm.ll=%-inst-wm.txt}
opt -load=${ROOT}/bin/${BUILD_TYPE}/src/nykk.so -block-wm -watermark=rust-project -S -o ${@:%-wm.ll=%-block.ll} $< 2> ${@:%-wm.ll=%-block-wm.txt}
opt -load=${ROOT}/bin/${BUILD_TYPE}/src/nykk.so -inst-wm -watermark=rust-project -S -o $@ ${@:%-wm.ll=%-block.ll} 2> ${@:%-wm.ll=%-inst-wm.txt}
${OBJ_DIR}/probestack.o: probestack.s
@mkdir -p ${@D}
......
......@@ -29,13 +29,13 @@ ${OBJ_DIR}/%.ll: %.c
clang -emit-llvm -S -DNDEBUG -O2 -o $@ $<
%-0.ll: %.ll
opt -load=${ROOT}/bin/src/nykk.so -block-wm -watermark=0 -S -o $@ $< 2> ${@:.ll=.txt}
opt -load=${ROOT}/bin/${BUILD_TYPE}/src/nykk.so -block-wm -watermark=0 -S -o $@ $< 2> ${@:.ll=.txt}
%-1.ll: %.ll
opt -load=${ROOT}/bin/src/nykk.so -block-wm -watermark=1 -S -o $@ $< 2> ${@:.ll=.txt}
opt -load=${ROOT}/bin/${BUILD_TYPE}/src/nykk.so -block-wm -watermark=1 -S -o $@ $< 2> ${@:.ll=.txt}
%-2.ll: %.ll
opt -load=${ROOT}/bin/src/nykk.so -inst-wm -watermark=2 -S -o $@ $< 2> ${@:.ll=.txt}
opt -load=${ROOT}/bin/${BUILD_TYPE}/src/nykk.so -inst-wm -watermark=2 -S -o $@ $< 2> ${@:.ll=.txt}
%-3.ll: %.ll
opt -load=${ROOT}/bin/src/nykk.so -inst-wm -watermark=3 -S -o $@ $< 2> ${@:.ll=.txt}
opt -load=${ROOT}/bin/${BUILD_TYPE}/src/nykk.so -inst-wm -watermark=3 -S -o $@ $< 2> ${@:.ll=.txt}
${BIN_DIR}/%.out: ${OBJ_DIR}/%.ll
@mkdir -p ${@D}
......
......@@ -72,5 +72,5 @@ ${OBJ_DIR}/%.ll: lua/%.c
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}
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}
......@@ -26,8 +26,8 @@ target/release/deps/*.ll:
${OBJ_DIR}/numguess-wm.ll: ${OBJ_DIR}/numguess.ll
@mkdir -p ${@D}
opt -load=${ROOT}/bin/src/nykk.so -block-wm -watermark=rust-project -S -o ${@:%-wm.ll=%-block.ll} $< 2> ${@:%-wm.ll=%-block-wm.txt}
opt -load=${ROOT}/bin/src/nykk.so -inst-wm -watermark=rust-project -S -o $@ ${@:%-wm.ll=%-block.ll} 2> ${@:%-wm.ll=%-inst-wm.txt}
opt -load=${ROOT}/bin/${BUILD_TYPE}/src/nykk.so -block-wm -watermark=rust-project -S -o ${@:%-wm.ll=%-block.ll} $< 2> ${@:%-wm.ll=%-block-wm.txt}
opt -load=${ROOT}/bin/${BUILD_TYPE}/src/nykk.so -inst-wm -watermark=rust-project -S -o $@ ${@:%-wm.ll=%-block.ll} 2> ${@:%-wm.ll=%-inst-wm.txt}
${OBJ_DIR}/probestack.o: probestack.s
@mkdir -p ${@D}
......
......@@ -80,20 +80,20 @@ ${OBJ_DIR}/zlib/%.o: zlib/%.c
${OBJ_DIR}/zlib-block-wm/%.o: zlib/%.c
@mkdir -p ${@D}
clang ${CFLAGS} -emit-llvm -S -o ${@:.o=.ll} $<
opt -load=${ROOT}/bin/src/nykk.so -block-wm -watermark=${WATERMARK} -S -o ${@:%.o=%-block-wm.ll} ${@:.o=.ll} 2> ${@:%.o=%-block-wm.txt}
opt -load=${ROOT}/bin/${BUILD_TYPE}/src/nykk.so -block-wm -watermark=${WATERMARK} -S -o ${@:%.o=%-block-wm.ll} ${@:.o=.ll} 2> ${@:%.o=%-block-wm.txt}
clang ${CFLAGS} -o $@ -c ${@:%.o=%-block-wm.ll}
${OBJ_DIR}/zlib-inst-wm/%.o: zlib/%.c
@mkdir -p ${@D}
clang ${CFLAGS} -emit-llvm -S -o ${@:.o=.ll} $<
opt -load=${ROOT}/bin/src/nykk.so -inst-wm -watermark=${WATERMARK} -S -o ${@:%.o=%-inst-wm.ll} ${@:.o=.ll} 2> ${@:%.o=%-inst-wm.txt}
opt -load=${ROOT}/bin/${BUILD_TYPE}/src/nykk.so -inst-wm -watermark=${WATERMARK} -S -o ${@:%.o=%-inst-wm.ll} ${@:.o=.ll} 2> ${@:%.o=%-inst-wm.txt}
clang ${CFLAGS} -o $@ -c ${@:%.o=%-inst-wm.ll}
${OBJ_DIR}/zlib-wm/%.o: zlib/%.c
@mkdir -p ${@D}
clang ${CFLAGS} -emit-llvm -S -o ${@:.o=.ll} $<
opt -load=${ROOT}/bin/src/nykk.so -block-wm -watermark=${WATERMARK} -S -o ${@:%.o=%-block-wm.ll} ${@:.o=.ll} 2> /dev/null
opt -load=${ROOT}/bin/src/nykk.so -inst-wm -watermark=${WATERMARK} -S -o ${@:%.o=%-inst-wm.ll} ${@:.o=-block-wm.ll} 2> /dev/null
opt -load=${ROOT}/bin/${BUILD_TYPE}/src/nykk.so -block-wm -watermark=${WATERMARK} -S -o ${@:%.o=%-block-wm.ll} ${@:.o=.ll} 2> /dev/null
opt -load=${ROOT}/bin/${BUILD_TYPE}/src/nykk.so -inst-wm -watermark=${WATERMARK} -S -o ${@:%.o=%-inst-wm.ll} ${@:.o=-block-wm.ll} 2> /dev/null
clang ${CFLAGS} -o $@ -c ${@:%.o=%-inst-wm.ll}
${OBJ_DIR}/benchmark.o: benchmark.cpp
......
......@@ -45,23 +45,23 @@ h2() {
}
echo "==== 8cc block-wm ===="
h1 obj/example/8cc/stage1-wm/*-block-wm.txt
h1 obj/$1/example/8cc/stage1-wm/*-block-wm.txt
echo "==== zlib block-wm ===="
h1 obj/example/zlib/zlib-block-wm/*-block-wm.txt
h1 obj/$1/example/zlib/zlib-block-wm/*-block-wm.txt
echo "==== lua block-wm ===="
h1 obj/example/lua/*-block-wm.txt
h1 obj/$1/example/lua/*-block-wm.txt
echo "==== fizzbuzz-rs block-wm ===="
h1 obj/example/fizzbuzz-rs/*-block-wm.txt
h1 obj/$1/example/fizzbuzz-rs/*-block-wm.txt
echo "==== numguess-rs block-wm ===="
h1 obj/example/numguess-rs/*-block-wm.txt
h1 obj/$1/example/numguess-rs/*-block-wm.txt
echo "==== 8cc inst-wm ===="
h2 obj/example/8cc/stage1-wm/*-inst-wm.txt
h2 obj/$1/example/8cc/stage1-wm/*-inst-wm.txt
echo "==== zlib inst-wm ===="
h2 obj/example/zlib/zlib-inst-wm/*-inst-wm.txt
h2 obj/$1/example/zlib/zlib-inst-wm/*-inst-wm.txt
echo "==== lua inst-wm ===="
h2 obj/example/lua/*-inst-wm.txt
h2 obj/$1/example/lua/*-inst-wm.txt
echo "==== fizzbuzz-rs inst-wm ===="
h2 obj/example/fizzbuzz-rs/*-inst-wm.txt
h2 obj/$1/example/fizzbuzz-rs/*-inst-wm.txt
echo "==== numguess-rs inst-wm ===="
h2 obj/example/numguess-rs/*-inst-wm.txt
h2 obj/$1/example/numguess-rs/*-inst-wm.txt
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