Commit b83b9697 authored by nagayama15's avatar nagayama15

ビルドタイプごとに最適化の有無を切り替えるように変更

parent 8b51dbaf
.DEFAULT_GOAL := all .DEFAULT_GOAL := all
BUILD_TYPE := debug BUILD_TYPE := release
ROOT := $(realpath ${PWD}) ROOT := $(realpath ${PWD})
CD := $(realpath ${CURDIR}) CD := $(realpath ${CURDIR})
......
...@@ -5,13 +5,18 @@ WATERMARK := 77 ...@@ -5,13 +5,18 @@ WATERMARK := 77
CC := clang CC := clang
CFLAGS := \ CFLAGS := \
-O2 \ -DBUILD_DIR="\"$$PWD/8cc\""
-DBUILD_DIR="\"$$PWD/8cc\"" \
-DNDEBUG CFLAGS_debug := -O0
CFLAGS_release := -O2 -DNDEBUG
CFLAGS += ${CFLAGS_${BUILD_TYPE}}
8CCFLAGS := \ 8CCFLAGS := \
-DBUILD_DIR="\"$$PWD/8cc\"" \ -DBUILD_DIR="\"$$PWD/8cc\""
-DNDEBUG
8CCFLAGS_debug :=
8CCFLAGS_release := -DNDEBUG
8CCFLAGS += ${8CCFLAGS_${BUILD_TYPE}}
LDFLAGS := \ LDFLAGS := \
-no-pie -no-pie
......
include ../../common.mk include ../../common.mk
RUSTFLAGS :=
RUSTFLAGS_debug :=
RUSTFLAGS_release := -O
RUSTFLAGS += ${RUSTFLAGS_${BUILD_TYPE}}
LDFLAGS := \ LDFLAGS := \
-pthread \ -pthread \
-lbacktrace \ -lbacktrace \
...@@ -16,7 +21,7 @@ ${BIN_DIR}/%.out: ${OBJ_DIR}/%.ll ${OBJ_DIR}/probestack.o ...@@ -16,7 +21,7 @@ ${BIN_DIR}/%.out: ${OBJ_DIR}/%.ll ${OBJ_DIR}/probestack.o
${OBJ_DIR}/fizzbuzz.ll: fizzbuzz.rs ${OBJ_DIR}/fizzbuzz.ll: fizzbuzz.rs
@mkdir -p ${@D} @mkdir -p ${@D}
rustc -O -Clto --emit=llvm-ir -o $@ $< rustc ${RUSTFLAGS} -Clto --emit=llvm-ir -o $@ $<
${OBJ_DIR}/fizzbuzz-wm.ll: ${OBJ_DIR}/fizzbuzz.ll ${OBJ_DIR}/fizzbuzz-wm.ll: ${OBJ_DIR}/fizzbuzz.ll
@mkdir -p ${@D} @mkdir -p ${@D}
......
include ../../common.mk include ../../common.mk
CFLAGS :=
CFLAGS_debug := -O0
CFLAGS_release := -O2 -DNDEBUG
CFLAGS += ${CFLAGS_${BUILD_TYPE}}
SRCS := \ SRCS := \
fizzbuzz.c fizzbuzz.c
...@@ -26,7 +31,7 @@ ${BINS}: ${LLS} ${LLS_0} ${LLS_1} ${LLS_2} ${LLS_3} ...@@ -26,7 +31,7 @@ ${BINS}: ${LLS} ${LLS_0} ${LLS_1} ${LLS_2} ${LLS_3}
${OBJ_DIR}/%.ll: %.c ${OBJ_DIR}/%.ll: %.c
@mkdir -p ${@D} @mkdir -p ${@D}
clang -emit-llvm -S -DNDEBUG -O2 -o $@ $< clang -emit-llvm -S ${CFLAGS} -o $@ $<
%-0.ll: %.ll %-0.ll: %.ll
opt -load=${ROOT}/bin/${BUILD_TYPE}/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}
......
...@@ -2,7 +2,10 @@ include ../../common.mk ...@@ -2,7 +2,10 @@ include ../../common.mk
WATERMARK := lua-watermarking WATERMARK := lua-watermarking
CFLAGS := -O2 -DNDEBUG -DLUA_USE_LINUX CFLAGS := -DLUA_USE_LINUX
CFLAGS_debug := -O0
CFLAGS_release := -O2 -DNDEBUG
CFLAGS += ${CFLAGS_${BUILD_TYPE}}
LDFLAGS := -lm -ldl LDFLAGS := -lm -ldl
SRCS := \ SRCS := \
......
...@@ -6,10 +6,12 @@ CC := clang ...@@ -6,10 +6,12 @@ CC := clang
CXX := clang++ CXX := clang++
CFLAGS := \ CFLAGS := \
-DNDEBUG \
-D_LARGEFILE64_SOURCE=1 \ -D_LARGEFILE64_SOURCE=1 \
-DHAVE_HIDDEN \ -DHAVE_HIDDEN
-O2
CFLAGS_debug := -O0
CFLAGS_release := -O2 -DNDEBUG
CFLAGS += ${CFLAGS_${BUILD_TYPE}}
CXXFLAGS := \ CXXFLAGS := \
-std=c++17 \ -std=c++17 \
...@@ -17,8 +19,11 @@ CXXFLAGS := \ ...@@ -17,8 +19,11 @@ CXXFLAGS := \
-Wextra \ -Wextra \
-pedantic \ -pedantic \
-Werror \ -Werror \
-Izlib \ -Izlib
-O2
CXXFLAGS_debug := -O0
CXXFLAGS_release := -O2 -DNDEBUG
CXXFLAGS += ${CXXFLAGS_${BUILD_TYPE}}
SRCS := \ SRCS := \
zlib/adler32.c \ zlib/adler32.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