Makefile 1.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748
  1. .POSIX:
  2. # Install prefix
  3. PREFIX = $(HOME)/.cargo
  4. # Cargo binary
  5. CARGO = cargo
  6. # Compile target
  7. RUST_TARGET = $(shell rustc -Vv | grep '^host: ' | cut -d' ' -f2)
  8. # Uncomment when doing musl static builds
  9. #RUSTFLAGS = -C target-feature=+crt-static -C link-self-contained=yes
  10. # zkas compiler binary
  11. ZKAS = ../../../../zkas
  12. # zkas circuits
  13. PROOFS_SRC = $(shell find proof -type f -name '*.zk')
  14. PROOFS_BIN = $(PROOFS_SRC:=.bin)
  15. SRC = \
  16. Cargo.toml \
  17. $(shell find src -type f -name '*.rs') \
  18. BIN = $(shell grep '^name = ' Cargo.toml | cut -d' ' -f3 | tr -d '"')
  19. all: $(BIN)
  20. $(PROOFS_BIN): $(ZKAS) $(PROOFS_SRC)
  21. $(ZKAS) $(basename $@) -o $@
  22. $(BIN): $(PROOFS_BIN) $(SRC)
  23. RUSTFLAGS="$(RUSTFLAGS)" $(CARGO) build --target=$(RUST_TARGET) --release --package $@
  24. cp -f target/$(RUST_TARGET)/release/$@ $@
  25. fmt:
  26. $(CARGO) +nightly fmt --all
  27. clippy:
  28. RUSTFLAGS="$(RUSTFLAGS)" $(CARGO) clippy --target=$(RUST_TARGET) \
  29. --release --all-features --workspace --tests
  30. clean:
  31. RUSTFLAGS="$(RUSTFLAGS)" $(CARGO) clean --target=$(RUST_TARGET) --release --package $(BIN)
  32. rm -f $(BIN)
  33. rm -f proof/*.bin
  34. .PHONY: all fmt clippy clean