anydice/Makefile

47 lines
695 B
Makefile
Raw Permalink Normal View History

2024-08-16 10:16:51 -04:00
CC := gcc
LIBRARIES := -lfl -lm -lreadline
calc: main.o grammar.tab.o lex.yy.o target/release/libanydice.a
$(CC) -o calc $^ $(LIBRARIES)
main.o: main.c grammar.tab.h
$(CC) -c $^
lex.yy.o: lex.yy.c
$(CC) -c $^
lex.yy.c: tokens.lex
flex -o lex.yy.c $^
grammar.tab.o: grammar.tab.c
$(CC) -c $^
grammar.tab.c: grammar.y rust.h
bison -d $<
grammar.tab.h: grammar.y rust.h
bison -d $<
.PHONY: rust
rust:
cargo build -r
cbindgen -o rust.h -l c
rust.h: rust
target/release/libanydice.a: rust
.PHONY: clean
clean:
rm -f lex.yy.*
rm -f grammar.tab.*
rm -f main.o calc
rm -f rust.h
.PHONY: sr
sr: grammar.y
bison -d -Wcounterexamples $<
.PHONY: lint
lint:
cargo clippy --no-deps