Commit 7e3b91b0 authored by nagayama15's avatar nagayama15

コンパイラフラグの整理

parent cad8c82e
...@@ -5,6 +5,10 @@ WATERMARK := 77 ...@@ -5,6 +5,10 @@ WATERMARK := 77
CC := clang CC := clang
CFLAGS := \ CFLAGS := \
-DBUILD_DIR="\"$$PWD/8cc\"" \
-O2
8CCFLAGS := \
-DBUILD_DIR="\"$$PWD/8cc\"" -DBUILD_DIR="\"$$PWD/8cc\""
LDFLAGS := \ LDFLAGS := \
...@@ -51,15 +55,15 @@ ${BIN_DIR}/stage3-wm/8cc.out: ${SRCS:8cc/%.c=${OBJ_DIR}/stage3-wm/%.o} ...@@ -51,15 +55,15 @@ ${BIN_DIR}/stage3-wm/8cc.out: ${SRCS:8cc/%.c=${OBJ_DIR}/stage3-wm/%.o}
# Normal 8cc. # Normal 8cc.
${OBJ_DIR}/stage1/%.o: 8cc/%.c ${OBJ_DIR}/stage1/%.o: 8cc/%.c
@mkdir -p ${@D} @mkdir -p ${@D}
${CC} ${CFLAGS} -O2 -o $@ -c $< ${CC} ${CFLAGS} -o $@ -c $<
${OBJ_DIR}/stage2/%.o: 8cc/%.c ${BIN_DIR}/stage1/8cc.out ${OBJ_DIR}/stage2/%.o: 8cc/%.c ${BIN_DIR}/stage1/8cc.out
@mkdir -p ${@D} @mkdir -p ${@D}
${BIN_DIR}/stage1/8cc.out -w ${CFLAGS} -o $@ -c $< ${BIN_DIR}/stage1/8cc.out -w ${8CCFLAGS} -o $@ -c $<
${OBJ_DIR}/stage3/%.o: 8cc/%.c ${BIN_DIR}/stage2/8cc.out ${OBJ_DIR}/stage3/%.o: 8cc/%.c ${BIN_DIR}/stage2/8cc.out
@mkdir -p ${@D} @mkdir -p ${@D}
${BIN_DIR}/stage2/8cc.out -w ${CFLAGS} -o $@ -c $< ${BIN_DIR}/stage2/8cc.out -w ${8CCFLAGS} -o $@ -c $<
# Watermarked 8cc # Watermarked 8cc
${OBJ_DIR}/stage1-wm/%.o: ${OBJ_DIR}/stage1-wm/%-wm.ll ${OBJ_DIR}/stage1-wm/%.o: ${OBJ_DIR}/stage1-wm/%-wm.ll
...@@ -68,16 +72,16 @@ ${OBJ_DIR}/stage1-wm/%.o: ${OBJ_DIR}/stage1-wm/%-wm.ll ...@@ -68,16 +72,16 @@ ${OBJ_DIR}/stage1-wm/%.o: ${OBJ_DIR}/stage1-wm/%-wm.ll
${OBJ_DIR}/stage1-wm/%-wm.ll: 8cc/%.c ${OBJ_DIR}/stage1-wm/%-wm.ll: 8cc/%.c
@mkdir -p ${@D} @mkdir -p ${@D}
clang ${CFLAGS} -O2 -S -emit-llvm -o ${@:%-wm.ll=%.ll} $< clang ${CFLAGS} -S -emit-llvm -o ${@:%-wm.ll=%.ll} $<
opt -load=${ROOT}/bin/src/nykk.so -block-wm -watermark=${WATERMARK} -S -o $@ ${@:%-wm.ll=%.ll} 2> ${@:%-wm.ll=%-log.txt} opt -load=${ROOT}/bin/src/nykk.so -block-wm -watermark=${WATERMARK} -S -o $@ ${@:%-wm.ll=%.ll} 2> ${@:%-wm.ll=%-log.txt}
${OBJ_DIR}/stage2-wm/%.o: 8cc/%.c ${BIN_DIR}/stage1-wm/8cc.out ${OBJ_DIR}/stage2-wm/%.o: 8cc/%.c ${BIN_DIR}/stage1-wm/8cc.out
@mkdir -p ${@D} @mkdir -p ${@D}
${BIN_DIR}/stage1-wm/8cc.out -w ${CFLAGS} -o $@ -c $< ${BIN_DIR}/stage1-wm/8cc.out -w ${8CCFLAGS} -o $@ -c $<
${OBJ_DIR}/stage3-wm/%.o: 8cc/%.c ${BIN_DIR}/stage2-wm/8cc.out ${OBJ_DIR}/stage3-wm/%.o: 8cc/%.c ${BIN_DIR}/stage2-wm/8cc.out
@mkdir -p ${@D} @mkdir -p ${@D}
${BIN_DIR}/stage2-wm/8cc.out -w ${CFLAGS} -o $@ -c $< ${BIN_DIR}/stage2-wm/8cc.out -w ${8CCFLAGS} -o $@ -c $<
%.out: %.out:
@mkdir -p ${@D} @mkdir -p ${@D}
......
...@@ -6,7 +6,8 @@ CC := clang ...@@ -6,7 +6,8 @@ CC := clang
CFLAGS := \ CFLAGS := \
-D_LARGEFILE64_SOURCE=1 \ -D_LARGEFILE64_SOURCE=1 \
-DHAVE_HIDDEN -DHAVE_HIDDEN \
-O2
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