<commit_before>CFLAGS := -m32 -W -Wall -W -Werror -MMD -O -g

ELI := out/eli
ELC := out/elc
8CC := out/8cc
BINS := $(8CC) $(ELI) $(ELC) out/dump_ir
LIB_IR := out/ir.o out/table.o

all: test

CSRCS := ir/ir.c ir/table.c ir/dump_ir.c ir/eli.c
COBJS := $(addprefix out/,$(notdir $(CSRCS:.c=.o)))
$(COBJS): out/%.o: ir/%.c
	$(CC) -c $(CFLAGS) $< -o $@

ELC_SRCS := elc.c util.c rb.c py.c js.c x86.c
CSRCS := $(addprefix ir/,$(ELC_SRCS))
COBJS := $(addprefix out/,$(notdir $(CSRCS:.c=.o)))
$(COBJS): out/%.o: target/%.c
	$(CC) -c -I. $(CFLAGS) $< -o $@

out/dump_ir: $(LIB_IR) out/dump_ir.o
	$(CC) $(CFLAGS) -DTEST $^ -o $@

$(ELI): $(LIB_IR) out/eli.o
	$(CC) $(CFLAGS) $^ -o $@

$(ELC): $(LIB_IR) $(ELC_SRCS:%.c=out/%.o)
	$(CC) $(CFLAGS) $^ -o $@

$(8CC): $(wildcard 8cc/*.c 8cc/*.h)
	$(MAKE) -C 8cc && cp 8cc/8cc $@

# Stage tests

$(shell mkdir -p out)
TEST_RESULTS :=

SRCS := $(wildcard test/*.eir)
DSTS := $(SRCS:test/%.eir=out/%.eir)
$(DSTS): out/%.eir: test/%.eir
	cp $< $@.tmp && mv $@.tmp $@
OUT.eir := $(SRCS:test/%.eir=%.eir)

SRCS := $(wildcard test/*.eir.rb)
DSTS := $(SRCS:test/%.eir.rb=out/%.eir)
$(DSTS): out/%.eir: test/%.eir.rb
	ruby $< > $@.tmp && mv $@.tmp $@
OUT.eir += $(SRCS:test/%.eir.rb=%.eir)

SRCS := $(wildcard test/*.c)
DSTS := $(SRCS:test/%.c=out/%.c)
$(DSTS): out/%.c: test/%.c
	cp $< $@.tmp && mv $@.tmp $@
OUT.c := $(SRCS:test/%.c=%.c)

out/8cc.c:
	./merge_8cc.sh > $@.tmp && mv $@.tmp $@
OUT.c += 8cc.c

# Build tests

TEST_INS := $(wildcard test/*.in)

include clear_vars.mk
SRCS := $(OUT.c)
EXT := exe
CMD = $(CC) -Ilibc $2 -o $1
OUT.c.exe := $(SRCS:%=%.$(EXT))
include build.mk

include clear_vars.mk
SRCS := $(filter-out 8cc%,$(OUT.c.exe))
EXT := out
DEPS := $(TEST_INS) runtest.sh
CMD = ./runtest.sh $1 $2
include build.mk

include clear_vars.mk
SRCS := $(filter 8cc%,$(OUT.c.exe))
EXT := out
DEPS := $(TEST_INS) runtest.sh
CMD = $2 -S -o $1 test/8cc.in.c<commit_msg>Run 8cc.c.in normally<commit_after>CFLAGS := -m32 -W -Wall -W -Werror -MMD -O -g

ELI := out/eli
ELC := out/elc
8CC := out/8cc
BINS := $(8CC) $(ELI) $(ELC) out/dump_ir
LIB_IR := out/ir.o out/table.o

all: test

CSRCS := ir/ir.c ir/table.c ir/dump_ir.c ir/eli.c
COBJS := $(addprefix out/,$(notdir $(CSRCS:.c=.o)))
$(COBJS): out/%.o: ir/%.c
	$(CC) -c $(CFLAGS) $< -o $@

ELC_SRCS := elc.c util.c rb.c py.c js.c x86.c
CSRCS := $(addprefix ir/,$(ELC_SRCS))
COBJS := $(addprefix out/,$(notdir $(CSRCS:.c=.o)))
$(COBJS): out/%.o: target/%.c
	$(CC) -c -I. $(CFLAGS) $< -o $@

out/dump_ir: $(LIB_IR) out/dump_ir.o
	$(CC) $(CFLAGS) -DTEST $^ -o $@

$(ELI): $(LIB_IR) out/eli.o
	$(CC) $(CFLAGS) $^ -o $@

$(ELC): $(LIB_IR) $(ELC_SRCS:%.c=out/%.o)
	$(CC) $(CFLAGS) $^ -o $@

$(8CC): $(wildcard 8cc/*.c 8cc/*.h)
	$(MAKE) -C 8cc && cp 8cc/8cc $@

# Stage tests

$(shell mkdir -p out)
TEST_RESULTS :=

SRCS := $(wildcard test/*.eir)
DSTS := $(SRCS:test/%.eir=out/%.eir)
$(DSTS): out/%.eir: test/%.eir
	cp $< $@.tmp && mv $@.tmp $@
OUT.eir := $(SRCS:test/%.eir=%.eir)

SRCS := $(wildcard test/*.eir.rb)
DSTS := $(SRCS:test/%.eir.rb=out/%.eir)
$(DSTS): out/%.eir: test/%.eir.rb
	ruby $< > $@.tmp && mv $@.tmp $@
OUT.eir += $(SRCS:test/%.eir.rb=%.eir)

SRCS := $(wildcard test/*.c)
DSTS := $(SRCS:test/%.c=out/%.c)
$(DSTS): out/%.c: test/%.c
	cp $< $@.tmp && mv $@.tmp $@
OUT.c := $(SRCS:test/%.c=%.c)

out/8cc.c:
	./merge_8cc.sh > $@.tmp && mv $@.tmp $@
OUT.c += 8cc.c

# Build tests

TEST_INS := $(wildcard test/*.in)

include clear_vars.mk
SRCS := $(OUT.c)
EXT := exe
CMD = $(CC) -Ilibc $2 -o $1
OUT.c.exe := $(SRCS:%=%.$(EXT))
include build.mk

include clear_vars.mk
SRCS := $(filter-out 8cc.c.exe,$(OUT.c.exe))
EXT := out
DEPS := $(TEST_INS) runtest.sh
CMD = ./runtest.sh $1 $2
include build.mk

include clear_vars.mk
SRCS := 8cc.c.exe
EXT := out
DEPS := $(TEST_INS) runtest.sh
CMD = $2 -S -o $1 test/8cc.in.c
{'fraction_non_alphanumeric': 0.28507501974203736, 'fraction_numerical': 0.013424585417215057, 'mean_word_length': 3.2035398230088497, 'pattern_counts': {'":': 0, '<': 13, '<?xml version=': 0, '>': 7, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '5535280', 'n_tokens_mistral': 1970, 'n_tokens_neox': 1855, 'n_words': 400}