distr/Makefile

46 lines
695 B
Makefile
Raw Permalink Normal View History

2024-08-16 10:22:44 -04:00
CC := gcc
LIBRARIES := -lfl -lm -lreadline
calc: main.o grammar.tab.o lex.yy.o target/release/libdistr.a
$(CC) -o distr $^ $(LIBRARIES)
main.o: main.c grammar.tab.h
$(CC) -c $^
lex.yy.o: lex.yy.c
$(CC) -c $^
lex.yy.c: tokens.lex grammar.tab.h
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 $<
rust.h: rust
.PHONY: rust
rust:
cargo build -r
# cbindgen -o rust.h -l c
target/release/libdistr.a: rust
.PHONY: clean
clean:
rm -f lex.yy.*
rm -f grammar.tab.*
rm -f main.o distr
.PHONY: sr
sr: grammar.y
bison -d -Wcounterexamples $<
.PHONY: lint
lint:
cargo clippy --no-deps