move header & library for morphism data structures to 'runtime' diretcory
- adapt Makefile for code size benchmark - write build files to 'target' directory
This commit is contained in:
parent
5a64334b1d
commit
630948139b
3 changed files with 26 additions and 19 deletions
|
@ -3,37 +3,44 @@ TARGETS=posint-dec-to-hex-generated.c posint-dec-to-hex-generated-gcc posint-dec
|
||||||
|
|
||||||
all: $(TARGETS)
|
all: $(TARGETS)
|
||||||
|
|
||||||
lib/libmorph_%.so: src/%.c
|
target:
|
||||||
$(CC) -O3 -shared -o $@ -fPIC -Iinclude $<
|
mkdir -p target
|
||||||
|
|
||||||
posint-dec-to-hex-generated.c:
|
lib/libmorph_%.so: src/%.c
|
||||||
cargo run -- \
|
$(CC) -O3 -shared -o target/$@ -fPIC -I../morphisms/runtime/include target/$<
|
||||||
|
|
||||||
|
ldmc:
|
||||||
|
cargo install --path ..
|
||||||
|
|
||||||
|
posint-dec-to-hex-generated.c: ldmc target
|
||||||
|
ldmc \
|
||||||
"ℕ~<PosInt 10 BigEndian>~<Seq~<ValueTerminated '\\0'> <Digit 10>~Char~Ascii~x86.UInt8>" \
|
"ℕ~<PosInt 10 BigEndian>~<Seq~<ValueTerminated '\\0'> <Digit 10>~Char~Ascii~x86.UInt8>" \
|
||||||
"ℕ~<PosInt 16 BigEndian>~<Seq~<ValueTerminated '\\0'> <Digit 16>~Char~Ascii~x86.UInt8>" \
|
"ℕ~<PosInt 16 BigEndian>~<Seq~<ValueTerminated '\\0'> <Digit 16>~Char~Ascii~x86.UInt8>" \
|
||||||
../morphisms/*.morphism-base >| $@
|
../morphisms/*.morphism-base >| target/$@
|
||||||
|
|
||||||
posint-dec-to-hex-generated-gcc: posint-dec-to-hex-generated.c
|
posint-dec-to-hex-generated-gcc: posint-dec-to-hex-generated.c target
|
||||||
gcc -g -Os -flto -o $@ -I../morphisms/include $< ../morphisms/src/length-prefix.c
|
gcc -g -Os -flto -o target/$@ -I../morphisms/runtime/include target/$< ../morphisms/runtime/src/*.c
|
||||||
|
|
||||||
posint-dec-to-hex-generated-clang: posint-dec-to-hex-generated.c
|
posint-dec-to-hex-generated-clang: posint-dec-to-hex-generated.c target
|
||||||
clang -g -Os -flto -o $@ -I../morphisms/include $< ../morphisms/src/length-prefix.c
|
clang -g -Os -flto -o target/$@ -I../morphisms/runtime/include target/$< ../morphisms/runtime/src/*.c
|
||||||
|
|
||||||
posint-dec-to-hex-optimal-gcc: posint-dec-to-hex-optimal.c
|
posint-dec-to-hex-optimal-gcc: posint-dec-to-hex-optimal.c target
|
||||||
gcc -g -Os -flto -o $@ $<
|
gcc -g -Os -flto -o target/$@ $<
|
||||||
|
|
||||||
posint-dec-to-hex-optimal-clang: posint-dec-to-hex-optimal.c
|
posint-dec-to-hex-optimal-clang: posint-dec-to-hex-optimal.c target
|
||||||
clang -g -Os -flto -o $@ $<
|
clang -g -Os -flto -o target/$@ $<
|
||||||
|
|
||||||
code-size-benchmark: posint-dec-to-hex-generated-gcc \
|
code-size-benchmark: posint-dec-to-hex-generated-gcc \
|
||||||
posint-dec-to-hex-generated-clang \
|
posint-dec-to-hex-generated-clang \
|
||||||
posint-dec-to-hex-optimal-gcc \
|
posint-dec-to-hex-optimal-gcc \
|
||||||
posint-dec-to-hex-optimal-clang
|
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_GCC=$(shell gdb --batch -ex "file target/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_GEN_CLANG=$(shell gdb --batch -ex "file target/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_GCC=$(shell gdb --batch -ex "file target/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)
|
INST_COUNT_OPT_CLANG=$(shell gdb --batch -ex "file target/posint-dec-to-hex-optimal-clang" -ex "disassemble main" | wc -l)
|
||||||
|
|
||||||
clean:
|
clean:
|
||||||
rm $(TARGETS)
|
rm target/*
|
||||||
|
rmdir target
|
||||||
|
|
||||||
.PHONY: all clean
|
.PHONY: all target clean
|
||||||
|
|
Loading…
Add table
Reference in a new issue