Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 16 additions & 8 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,26 +1,34 @@
CC=clang
BUILD=build
INCLUDES=stddef.h posix_types.h getorder.h
CC = clang
BUILD = build
INCLUDES = stddef.h posix_types.h getorder.h
CNDIR := $(OPAM_SWITCH_PREFIX)/lib/cn/runtime

FULMOPT = --without-lemma-checks
CCOPT = -O2


.PHONY: clean run

run: $(BUILD)/driver.exe
$<
zsh -c 'export TIMEFMT="$$TIMEFMT %MMB rss" && time $<'

bench: $(BUILD)/driver.exe
hyperfine $<

$(BUILD)/driver.pp.c: driver.c page_alloc.c $(INCLUDES)
mkdir -p $(BUILD)
$(CC) -E -P -CC $< > $@

$(BUILD)/driver.pp.exec.c: $(BUILD)/driver.pp.c
cn instrument $< --output=driver.pp.exec.c --output-dir=$(BUILD)
cn instrument $(FULMOPT) $< --output=driver.pp.exec.c --output-dir=$(BUILD)
mv $@ $@~
sed -e"/ cerb::hidden .*bswap64/d" < $@~ > $@
sed -e "/ cerb::hidden .*bswap64/d" < $@~ > $@

$(BUILD)/driver.pp.exec.o: $(BUILD)/driver.pp.exec.c
$(CC) -g -c -O0 -std=gnu11 -I$(OPAM_SWITCH_PREFIX)/lib/cn/runtime/include $< -o $@
$(CC) -g -c -std=gnu11 -I$(CNDIR)/include $(CCOPT) $< -o $@

$(BUILD)/driver.exe: $(BUILD)/driver.pp.exec.o
$(CC) $< -o $@ $(OPAM_SWITCH_PREFIX)/lib/cn/runtime/libcn_exec.a -L$(OPAM_SWITCH_PREFIX)/lib/cn/runtime -lcn_exec
$(CC) $< -o $@ $(CNDIR)/libcn_exec.a -L$(CNDIR) -lcn_exec

clean:
rm -rf $(BUILD)