Commit cad8c82e authored by nagayama15's avatar nagayama15

zlibのサンプルを追加

parent 36e07e78
[submodule "example/8cc/8cc"] [submodule "example/8cc/8cc"]
path = example/8cc/8cc path = example/8cc/8cc
url = git://github.com/rui314/8cc.git url = git://github.com/rui314/8cc.git
[submodule "example/zlib/zlib"]
path = example/zlib/zlib
url = git@github.com:madler/zlib.git
...@@ -64,7 +64,7 @@ ${OBJ_DIR}/stage3/%.o: 8cc/%.c ${BIN_DIR}/stage2/8cc.out ...@@ -64,7 +64,7 @@ ${OBJ_DIR}/stage3/%.o: 8cc/%.c ${BIN_DIR}/stage2/8cc.out
# 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
@mkdir -p ${@D} @mkdir -p ${@D}
${CC} ${CFLAGS} -o $@ -c $< clang ${CFLAGS} -o $@ -c $<
${OBJ_DIR}/stage1-wm/%-wm.ll: 8cc/%.c ${OBJ_DIR}/stage1-wm/%-wm.ll: 8cc/%.c
@mkdir -p ${@D} @mkdir -p ${@D}
......
...@@ -3,7 +3,9 @@ ...@@ -3,7 +3,9 @@
all: all:
${MAKE} -C fizzbuzz all ${MAKE} -C fizzbuzz all
${MAKE} -C 8cc all ${MAKE} -C 8cc all
${MAKE} -C zlib all
test: test:
${MAKE} -C fizzbuzz test ${MAKE} -C fizzbuzz test
${MAKE} -C 8cc test ${MAKE} -C 8cc test
${MAKE} -C zlib test
include ../../common.mk
WATERMARK := 77
CC := clang
CFLAGS := \
-D_LARGEFILE64_SOURCE=1 \
-DHAVE_HIDDEN
SRCS := \
zlib/adler32.c \
zlib/compress.c \
zlib/crc32.c \
zlib/deflate.c \
zlib/gzclose.c \
zlib/gzlib.c \
zlib/gzread.c \
zlib/gzwrite.c \
zlib/inflate.c \
zlib/infback.c \
zlib/inftrees.c \
zlib/inffast.c \
zlib/trees.c \
zlib/uncompr.c \
zlib/zutil.c
OBJS := ${SRCS:zlib/%.c=${OBJ_DIR}/zlib/%.o}
OBJS_WM := ${SRCS:zlib/%.c=${OBJ_DIR}/zlib-${WATERMARK}/%.o}
.PHONY: all test
all: ${BIN_DIR}/libz.a ${BIN_DIR}/libz-${WATERMARK}.a
test: ${BIN_DIR}/libz.a ${BIN_DIR}/libz-${WATERMARK}.a
${BIN_DIR}/libz.a: ${OBJS}
${BIN_DIR}/libz-${WATERMARK}.a: ${OBJS_WM}
${OBJ_DIR}/zlib/%.o: zlib/%.c
@mkdir -p ${@D}
${CC} ${CFLAGS} -o $@ -c $<
${OBJ_DIR}/zlib-${WATERMARK}/%.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=%-${WATERMARK}.ll} ${@:.o=.ll} 2> ${@:%.o=%-log.txt}
clang ${CFLAGS} -o $@ -c ${@:%.o=%-${WATERMARK}.ll}
%.a:
@mkdir -p ${@D}
${AR} rcs $@ $^
Subproject commit cacf7f1d4e3d44d871b605da3b647f07d718623f
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