Makefile 1.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657
  1. .POSIX:
  2. # Install prefix
  3. PREFIX = $(HOME)/.cargo
  4. # Cargo binary
  5. CARGO = cargo +nightly
  6. # Compile target
  7. RUST_TARGET = $(shell rustc -Vv | grep '^host: ' | cut -d' ' -f2)
  8. SRC = \
  9. Cargo.toml \
  10. ../../Cargo.toml \
  11. $(shell find src -type f -name '*.rs') \
  12. $(shell find ../../src -type f -name '*.rs') \
  13. BIN = ../../darkirc
  14. ZKAS = ../../zkas
  15. ZKSRC = $(shell find proof -type f -name '*.zk')
  16. ZKBIN = $(ZKSRC:=.bin)
  17. all: $(BIN)
  18. $(ZKBIN): $(ZKAS) $(ZKSRC)
  19. $(ZKAS) $(basename $@) -o $@
  20. $(BIN): $(ZKBIN) $(SRC)
  21. RUSTFLAGS="$(RUSTFLAGS)" $(CARGO) build --target=$(RUST_TARGET) --release --package darkirc
  22. cp -f ../../target/$(RUST_TARGET)/release/darkirc $@
  23. android:
  24. docker build -t test:latest . --file android.Dockerfile
  25. # Use this command to get an interactive terminal inside docker:
  26. #docker run -v $(shell pwd)/../../:/root/src -it test:latest /bin/bash
  27. docker run --rm -v $(shell pwd)/../../:/root/src -t test:latest make _aarch64-android
  28. cp -f ../../target/aarch64-linux-android/release/darkirc darkirc.aarch64-android
  29. # Invoked inside docker by the command above
  30. # We need to mount this directory as a volume using -v so docker can access it
  31. _aarch64-android:
  32. cargo build --release --target aarch64-linux-android --package darkirc
  33. clean:
  34. rm -f $(BIN)
  35. install: all
  36. mkdir -p $(DESTDIR)$(PREFIX)/bin
  37. cp -f $(BIN) $(DESTDIR)$(PREFIX)/bin
  38. chmod 755 $(DESTDIR)$(PREFIX)/bin/darkirc
  39. uninstall:
  40. rm -f $(DESTDIR)$(PREFIX)/bin/darkirc
  41. .PHONY: all clean install uninstall