Makefile 4.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134
  1. .POSIX:
  2. # Cargo binary
  3. CARGO = cargo
  4. RELEASE_APK = target/android-artifacts/release/apk/darkfi-app.apk
  5. DEBUG_APK = target/android-artifacts/debug/apk/darkfi-app.apk
  6. # zkas compiler binary
  7. ZKAS = ../../zkas
  8. # zkas circuits
  9. PROOFS_SRC = $(shell find ../../src/event_graph -type f -name '*.zk')
  10. PROOFS_BIN = $(PROOFS_SRC:=.bin)
  11. #ADB_DEVICE = -s DEVICE_ID
  12. ADB_DEVICE =
  13. SRC = \
  14. build.rs \
  15. Cargo.lock \
  16. Cargo.toml \
  17. Dockerfile \
  18. $(shell find assets -type f) \
  19. $(shell find src -type f)
  20. RELEASE_FEATURES = --features=enable-plugins
  21. DEBUG_FEATURES = --features=enable-filelog,enable-plugins
  22. #DEV_FEATURES = --features=enable-filelog,enable-netdebug,emulate-android
  23. #DEV_FEATURES = --features=enable-filelog,enable-netdebug,enable-plugins
  24. DEV_FEATURES = --features=schema-app,enable-netdebug,enable-plugins
  25. default: build-release
  26. ./darkfi-app
  27. android: android-release
  28. # Platform release builds
  29. macos-release: build-release
  30. -mv darkfi-app darkfi-app.macos
  31. macos-debug: build-debug
  32. -mv darkfi-app darkfi-app_debug.macos
  33. linux-release: build-release
  34. -mv darkfi-app darkfi-app.linux
  35. linux-debug: build-debug
  36. -mv darkfi-app darkfi-app_debug.linux
  37. win-release: $(SRC) fonts
  38. $(CARGO) build --release $(RELEASE_FEATURES)
  39. -mv target/release/darkfi-app.exe .
  40. win-debug: $(SRC) fonts
  41. $(CARGO) build $(DEBUG_FEATURES)
  42. -mv target/debug/darkfi-app.exe .
  43. android-release: $(SRC) fonts assets/forest_720x1280.mp4
  44. podman run -v $(shell pwd)/../../:/root/darkfi -w /root/darkfi/bin/app/ -t apk cargo quad-apk build --release $(RELEASE_FEATURES)
  45. -mv $(RELEASE_APK) darkfi-app.apk
  46. android-debug: $(SRC) fonts assets/forest_720x1280.mp4
  47. podman run -v $(shell pwd)/../../:/root/darkfi -w /root/darkfi/bin/app/ -t apk cargo quad-apk build $(DEBUG_FEATURES)
  48. -mv $(DEBUG_APK) darkfi-app_debug.apk
  49. # Windows cross-compilation using Docker/Podman
  50. win-docker-release: $(SRC)
  51. podman run -v $(shell pwd):/root/build -w /root/build/ -t windows \
  52. cargo build --release --target x86_64-pc-windows-gnu $(RELEASE_FEATURES)
  53. ./release/win/package.sh release
  54. win-docker-debug: $(SRC)
  55. podman run -v $(shell pwd):/root/build -w /root/build/ -t windows \
  56. cargo build --target x86_64-pc-windows-gnu $(DEBUG_FEATURES)
  57. ./release/win/package.sh debug
  58. build-release: $(SRC) fonts assets/forest_1920x1080.ivf
  59. $(CARGO) build --release $(RELEASE_FEATURES)
  60. -mv target/release/darkfi-app .
  61. build-debug: $(SRC) fonts assets/forest_1920x1080.ivf
  62. $(CARGO) build $(DEBUG_FEATURES)
  63. -mv target/debug/darkfi-app .
  64. # Download font data
  65. fonts: ibm-plex-mono-regular.otf NotoColorEmoji.ttf
  66. ibm-plex-mono-regular.otf:
  67. wget -c https://dark.fi/assets/ibm-plex-mono-regular.otf
  68. NotoColorEmoji.ttf:
  69. wget -c https://dark.fi/assets/NotoColorEmoji.ttf
  70. # App data
  71. assets/forest_1920x1080.ivf:
  72. rm -f assets/forest_720x1280.mp4
  73. wget -P assets/ -c https://dark.fi/assets/forest_1920x1080.ivf
  74. assets/forest_720x1280.mp4:
  75. rm -f assets/forest_1920x1080.ivf
  76. wget -P assets/ -c https://dark.fi/assets/forest_720x1280.mp4
  77. # Developer targets
  78. dev: $(SRC) fonts assets/forest_1920x1080.ivf
  79. $(CARGO) lbuild --no-default-features $(DEV_FEATURES)
  80. -mv target/debug/darkfi-app .
  81. ./darkfi-app
  82. # Users should use the android-release and android-debug targets instead.
  83. apk: $(SRC) fonts assets/forest_720x1280.mp4
  84. cargo quad-apk build --no-default-features $(DEV_FEATURES)
  85. $(MAKE) install-apk
  86. install-apk:
  87. -mv $(DEBUG_APK) .
  88. -adb $(ADB_DEVICE) uninstall darkfi.darkfi_app
  89. adb $(ADB_DEVICE) install -r darkfi-app.apk
  90. $(MAKE) log-apk
  91. log-apk:
  92. reset
  93. adb $(ADB_DEVICE) logcat -c
  94. adb $(ADB_DEVICE) shell monkey -p darkfi.darkfi_app -c android.intent.category.LAUNCHER 1
  95. adb $(ADB_DEVICE) logcat -v color -s darkfi -s SAPP -s libc -s DEBUG -s ActivityManager -s ActivityTaskManager -s WindowManager -s AndroidRuntime -s rkfi.darkfi_app | tee output.log
  96. # Useful for dev
  97. podman-cli:
  98. podman run -v $(shell pwd)/../../:/root/darkfi -w /root/darkfi/bin/app/ -it apk bash
  99. fmt:
  100. $(CARGO) +nightly fmt
  101. clean:
  102. podman run -v $(shell pwd):/root/dw -w /root/dw -t apk rm -fr target/
  103. rm -f darkfi-app.apk
  104. .PHONY: all android cli clean