ldmc/code-size-benchmark/Makefile

40 lines
1.7 KiB
Makefile
Raw Normal View History

LIB_DIR=$(shell pwd)/lib
TARGETS=posint-dec-to-hex-generated.c posint-dec-to-hex-generated-gcc posint-dec-to-hex-generated-clang posint-dec-to-hex-optimal-gcc posint-dec-to-hex-optimal-clang
2025-01-28 22:33:08 +01:00
all: $(TARGETS)
lib/libmorph_%.so: src/%.c
$(CC) -O3 -shared -o $@ -fPIC -Iinclude $<
posint-dec-to-hex-generated.c:
cargo run -- \
"~<PosInt 10 BigEndian>~<Seq~<ValueTerminated '\\0'> <Digit 10>~Char~Ascii~x86.UInt8>" \
"~<PosInt 16 BigEndian>~<Seq~<ValueTerminated '\\0'> <Digit 16>~Char~Ascii~x86.UInt8>" \
../morphisms/*.morphism-base >| $@
2025-02-03 17:05:19 +01:00
posint-dec-to-hex-generated-gcc: posint-dec-to-hex-generated.c
gcc -g -Os -flto -o $@ -I../morphisms/include $< ../morphisms/src/length-prefix.c
2025-02-03 17:05:19 +01:00
posint-dec-to-hex-generated-clang: posint-dec-to-hex-generated.c
clang -g -Os -flto -o $@ -I../morphisms/include $< ../morphisms/src/length-prefix.c
2025-02-03 17:05:19 +01:00
posint-dec-to-hex-optimal-gcc: posint-dec-to-hex-optimal.c
gcc -g -Os -flto -o $@ $<
posint-dec-to-hex-optimal-clang: posint-dec-to-hex-optimal.c
clang -g -Os -flto -o $@ $<
code-size-benchmark: posint-dec-to-hex-generated-gcc \
posint-dec-to-hex-generated-clang \
posint-dec-to-hex-optimal-gcc \
posint-dec-to-hex-optimal-clang
INST_COUNT_GEN_GCC=$(shell gdb --batch -ex "file posint-dec-to-hex-generated-gcc" -ex "disassemble main" | wc -l)
INST_COUNT_GEN_CLANG=$(shell gdb --batch -ex "file posint-dec-to-hex-generated-clang" -ex "disassemble main" | wc -l)
INST_COUNT_OPT_GCC=$(shell gdb --batch -ex "file posint-dec-to-hex-optimal-gcc" -ex "disassemble main" | wc -l)
INST_COUNT_OPT_CLANG=$(shell gdb --batch -ex "file posint-dec-to-hex-optimal-clang" -ex "disassemble main" | wc -l)
2025-01-28 22:33:08 +01:00
clean:
rm $(TARGETS)
.PHONY: all clean