1 Star 0 Fork 0

Leven / chibicc

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
克隆/下载
Makefile 1.12 KB
一键复制 编辑 原始数据 按行查看 历史
Rui Ueyama 提交于 2020-09-07 10:02 . Add thread-local variable
CFLAGS=-std=c11 -g -fno-common -Wall -Wno-switch
SRCS=$(wildcard *.c)
OBJS=$(SRCS:.c=.o)
TEST_SRCS=$(wildcard test/*.c)
TESTS=$(TEST_SRCS:.c=.exe)
# Stage 1
chibicc: $(OBJS)
$(CC) $(CFLAGS) -o $@ $^ $(LDFLAGS)
$(OBJS): chibicc.h
test/%.exe: chibicc test/%.c
./chibicc -Iinclude -Itest -c -o test/$*.o test/$*.c
$(CC) -pthread -o $@ test/$*.o -xc test/common
test: $(TESTS)
for i in $^; do echo $$i; ./$$i || exit 1; echo; done
test/driver.sh ./chibicc
test-all: test test-stage2
# Stage 2
stage2/chibicc: $(OBJS:%=stage2/%)
$(CC) $(CFLAGS) -o $@ $^ $(LDFLAGS)
stage2/%.o: chibicc %.c
mkdir -p stage2/test
./chibicc -c -o $(@D)/$*.o $*.c
stage2/test/%.exe: stage2/chibicc test/%.c
mkdir -p stage2/test
./stage2/chibicc -Iinclude -Itest -c -o stage2/test/$*.o test/$*.c
$(CC) -pthread -o $@ stage2/test/$*.o -xc test/common
test-stage2: $(TESTS:test/%=stage2/test/%)
for i in $^; do echo $$i; ./$$i || exit 1; echo; done
test/driver.sh ./stage2/chibicc
# Misc.
clean:
rm -rf chibicc tmp* $(TESTS) test/*.s test/*.exe stage2
find * -type f '(' -name '*~' -o -name '*.o' ')' -exec rm {} ';'
.PHONY: test clean test-stage2
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
1
https://gitee.com/leven9/chibicc.git
git@gitee.com:leven9/chibicc.git
leven9
chibicc
chibicc
main

搜索帮助

344bd9b3 5694891 D2dac590 5694891