Makefile 5.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158
  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_INST =
  12. ADB_DEVICE_LOG =
  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=schema-app,enable-filelog,enable-plugin-darkirc,enable-plugin-drk
  21. DEBUG_FEATURES = --features=schema-app,enable-filelog,enable-plugin-darkirc,enable-plugin-drk
  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-filelog,enable-netdebug
  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) $(PROOFS_BIN) fonts
  38. $(CARGO) build --no-default-features --release $(RELEASE_FEATURES)
  39. -mv target/release/darkfi-app.exe .
  40. win-debug: $(SRC) $(PROOFS_BIN) fonts
  41. $(CARGO) build --no-default-features $(DEBUG_FEATURES)
  42. -mv target/debug/darkfi-app.exe .
  43. android-release: $(SRC) $(PROOFS_BIN) fonts assets/forest_720x1280.mp4
  44. podman run -v $(shell pwd)/../../:/root/darkfi -w /root/darkfi/bin/app/ -t apk cargo quad-apk build --no-default-features --release $(RELEASE_FEATURES)
  45. -mv $(RELEASE_APK) darkfi-app.apk
  46. android-debug: $(SRC) $(PROOFS_BIN) fonts assets/forest_720x1280.mp4
  47. podman run -v $(shell pwd)/../../:/root/darkfi -w /root/darkfi/bin/app/ -t apk cargo quad-apk build --no-default-features $(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 --no-default-features --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 --no-default-features --target x86_64-pc-windows-gnu $(DEBUG_FEATURES)
  57. ./release/win/package.sh debug
  58. build-release: $(SRC) $(PROOFS_BIN) fonts assets/forest_1920x1080.ivf
  59. $(CARGO) build --no-default-features --release $(RELEASE_FEATURES)
  60. -mv target/release/darkfi-app .
  61. build-debug: $(SRC) $(PROOFS_BIN) fonts assets/forest_1920x1080.ivf
  62. $(CARGO) build --no-default-features $(DEBUG_FEATURES)
  63. -mv target/debug/darkfi-app .
  64. # Download font data
  65. fonts: data/font/ibm-plex-mono-regular.otf data/font/NotoColorEmoji.ttf
  66. data/font/ibm-plex-mono-regular.otf:
  67. mkdir -p data/font/
  68. wget -P data/font/ -c https://dark.fi/assets/ibm-plex-mono-regular.otf
  69. data/font/NotoColorEmoji.ttf:
  70. mkdir -p data/font/
  71. wget -P data/font/ -c https://dark.fi/assets/NotoColorEmoji.ttf
  72. data/font/darkfi-custom-emoji.ttf:
  73. mkdir -p data/font/
  74. wget -P data/font/ -c https://dark.fi/assets/darkfi-custom-emoji.ttf
  75. # App data
  76. data/forest_1920x1080.ivf:
  77. wget -P data/ -c https://dark.fi/assets/forest_1920x1080.ivf
  78. assets/forest_1920x1080.ivf: data/forest_1920x1080.ivf
  79. rm -f assets/forest_720x1280.mp4
  80. cp data/forest_1920x1080.ivf assets/
  81. data/forest_720x1280.mp4:
  82. wget -P data/ -c https://dark.fi/assets/forest_720x1280.mp4
  83. assets/forest_720x1280.mp4: data/forest_720x1280.mp4
  84. rm -f assets/forest_1920x1080.ivf
  85. cp data/forest_720x1280.mp4 assets/
  86. # zkas circuits (needed for darkirc plugin crate)
  87. zkas:
  88. $(MAKE) -C ../../bin/zkas
  89. $(PROOFS_BIN): zkas $(PROOFS_SRC)
  90. $(ZKAS) $(basename $@) -o $@
  91. # Developer targets
  92. compile-dev: $(SRC) $(PROOFS_BIN) fonts assets/forest_1920x1080.ivf
  93. $(CARGO) lbuild --no-default-features $(DEV_FEATURES)
  94. -mv target/debug/darkfi-app .
  95. dev:
  96. $(MAKE) compile-dev
  97. ./darkfi-app 2>&1 | tee app.log
  98. # Users should use the android-release and android-debug targets instead.
  99. apk:
  100. $(MAKE) compile-apk
  101. $(MAKE) install-apk
  102. $(MAKE) log-apk
  103. compile-apk: $(SRC) $(PROOFS_BIN) fonts assets/forest_720x1280.mp4
  104. cargo quad-apk build --no-default-features --release $(DEV_FEATURES)
  105. -mv $(RELEASE_APK) .
  106. install-apk:
  107. -adb $(ADB_DEVICE_INST) uninstall darkfi.darkfi_app
  108. adb $(ADB_DEVICE_INST) install -r darkfi-app.apk
  109. log-apk:
  110. reset
  111. adb $(ADB_DEVICE_LOG) logcat -c
  112. adb $(ADB_DEVICE_LOG) shell monkey -p darkfi.darkfi_app -c android.intent.category.LAUNCHER 1
  113. adb $(ADB_DEVICE_LOG) 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
  114. # Useful for dev
  115. podman-cli:
  116. podman run -v $(shell pwd)/../../:/root/darkfi -w /root/darkfi/bin/app/ -it apk bash
  117. fmt:
  118. $(CARGO) +nightly fmt
  119. clean:
  120. podman run -v $(shell pwd):/root/dw -w /root/dw -t apk rm -fr target/
  121. rm -f darkfi-app.apk
  122. .PHONY: all android cli clean zkas