Makefile (1196B)
1 TRAIL := trail --data-dir traildepot 2 3 # JSON schemas from TrailBase 4 rust/schemas/message_read.json: 5 $(TRAIL) schema message --mode select > $@ 6 7 rust/schemas/message_insert.json: 8 $(TRAIL) schema message --mode insert > $@ 9 10 rust/schemas/chat_read.json: 11 $(TRAIL) schema chat --mode select > $@ 12 13 rust/schemas/chat_insert.json: 14 $(TRAIL) schema chat --mode insert > $@ 15 16 rust/schemas/user_chats_read.json: 17 $(TRAIL) schema user_chats --mode select > $@ 18 19 rust/schemas/chat_participation_insert.json: 20 $(TRAIL) schema chat_participation --mode insert > $@ 21 22 # Rust types from schemas 23 SCHEMAS := $(wildcard rust/schemas/*.json) 24 25 rust/src/generated/mod.rs: $(SCHEMAS) 26 quicktype \ 27 --lang rust \ 28 --density dense \ 29 --visibility public \ 30 --derive-debug \ 31 --derive-clone \ 32 $(addprefix -s schema ,$(SCHEMAS)) \ 33 -o $@ 34 35 # Convenience targets 36 .PHONY: schemas types clean 37 38 schemas: rust/schemas/message_read.json rust/schemas/message_insert.json \ 39 rust/schemas/chat_read.json rust/schemas/chat_insert.json \ 40 rust/schemas/user_chats_read.json rust/schemas/chat_participation_insert.json 41 42 types: rust/src/generated/mod.rs 43 44 clean: 45 rm -f rust/schemas/*.json rust/src/generated/mod.rs