Makefile 4.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146
  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. app.sql \
  15. build.rs \
  16. Cargo.lock \
  17. Cargo.toml \
  18. Dockerfile \
  19. $(shell find assets -type f) \
  20. $(shell find src -type f)
  21. RELEASE_FEATURES = --features=schema-app,enable-filelog,enable-plugin-darkirc,enable-plugin-drk
  22. DEBUG_FEATURES = --features=schema-app,enable-filelog,enable-plugin-darkirc,enable-plugin-drk
  23. #DEV_FEATURES = --features=enable-filelog,enable-netdebug,emulate-android
  24. #DEV_FEATURES = --features=enable-filelog,enable-netdebug,enable-plugins
  25. DEV_FEATURES = --features=schema-app,enable-filelog,enable-netdebug,enable-plugin-darkirc
  26. default: build-release
  27. ./darkfi-app
  28. android: android-release
  29. # Platform release builds
  30. macos-release: build-release
  31. -mv darkfi-app darkfi-app.macos
  32. macos-debug: build-debug
  33. -mv darkfi-app darkfi-app_debug.macos
  34. linux-release: build-release
  35. -mv darkfi-app darkfi-app.linux
  36. linux-debug: build-debug
  37. -mv darkfi-app darkfi-app_debug.linux
  38. win64-msvc: $(SRC) $(PROOFS_BIN) fonts
  39. PATH="$(shell pwd)/release/win:$$PATH" $(CARGO) xwin build --no-default-features --release --target x86_64-pc-windows-msvc $(RELEASE_FEATURES)
  40. -mv target/x86_64-pc-windows-msvc/release/darkfi-app.exe .
  41. android-release: $(SRC) $(PROOFS_BIN) fonts assets/forest_720x1280.mp4
  42. podman run -v $(shell pwd)/../../:/root/darkfi -w /root/darkfi/bin/app/ -t apk cargo quad-apk build --no-default-features --release $(RELEASE_FEATURES)
  43. -mv $(RELEASE_APK) darkfi-app.apk
  44. android-debug: $(SRC) $(PROOFS_BIN) fonts assets/forest_720x1280.mp4
  45. podman run -v $(shell pwd)/../../:/root/darkfi -w /root/darkfi/bin/app/ -t apk cargo quad-apk build --no-default-features $(DEBUG_FEATURES)
  46. -mv $(DEBUG_APK) darkfi-app_debug.apk
  47. build-release: $(SRC) $(PROOFS_BIN) fonts assets/forest_1920x1080.ivf
  48. $(CARGO) build --no-default-features --release $(RELEASE_FEATURES)
  49. -mv target/release/darkfi-app .
  50. build-debug: $(SRC) $(PROOFS_BIN) fonts assets/forest_1920x1080.ivf
  51. $(CARGO) build --no-default-features $(DEBUG_FEATURES)
  52. -mv target/debug/darkfi-app .
  53. # Download font data
  54. fonts: data/font/ibm-plex-mono-regular.otf data/font/NotoColorEmoji.ttf
  55. data/font/ibm-plex-mono-regular.otf:
  56. mkdir -p data/font/
  57. wget -P data/font/ -c https://dark.fi/assets/ibm-plex-mono-regular.otf
  58. data/font/NotoColorEmoji.ttf:
  59. mkdir -p data/font/
  60. wget -P data/font/ -c https://dark.fi/assets/NotoColorEmoji.ttf
  61. data/font/darkfi-custom-emoji.ttf:
  62. mkdir -p data/font/
  63. wget -P data/font/ -c https://dark.fi/assets/darkfi-custom-emoji.ttf
  64. # App data
  65. data/forest_1920x1080.ivf:
  66. wget -P data/ -c https://dark.fi/assets/forest_1920x1080.ivf
  67. assets/forest_1920x1080.ivf: data/forest_1920x1080.ivf
  68. rm -f assets/forest_720x1280.mp4
  69. cp data/forest_1920x1080.ivf assets/
  70. data/forest_720x1280.mp4:
  71. wget -P data/ -c https://dark.fi/assets/forest_720x1280.mp4
  72. assets/forest_720x1280.mp4: data/forest_720x1280.mp4
  73. rm -f assets/forest_1920x1080.ivf
  74. cp data/forest_720x1280.mp4 assets/
  75. # zkas circuits (needed for darkirc plugin crate)
  76. zkas:
  77. $(MAKE) -C ../../bin/zkas
  78. $(PROOFS_BIN): zkas $(PROOFS_SRC)
  79. $(ZKAS) $(basename $@) -o $@
  80. # Developer targets
  81. compile-dev: $(SRC) $(PROOFS_BIN) fonts assets/forest_1920x1080.ivf
  82. $(CARGO) lbuild --release --no-default-features $(DEV_FEATURES)
  83. -mv target/release/darkfi-app .
  84. dev:
  85. $(MAKE) compile-dev
  86. ./darkfi-app 2>&1 | tee app.log
  87. # Users should use the android-release and android-debug targets instead.
  88. apk:
  89. $(MAKE) compile-apk
  90. $(MAKE) install-apk
  91. $(MAKE) log-apk
  92. compile-apk: $(SRC) $(PROOFS_BIN) fonts assets/forest_720x1280.mp4
  93. cargo quad-apk build --no-default-features --release $(DEV_FEATURES)
  94. -mv $(RELEASE_APK) .
  95. install-apk:
  96. -adb $(ADB_DEVICE_INST) uninstall darkfi.darkfi_app
  97. adb $(ADB_DEVICE_INST) install -r darkfi-app.apk
  98. log-apk:
  99. reset
  100. adb $(ADB_DEVICE_LOG) logcat -c
  101. adb $(ADB_DEVICE_LOG) shell monkey -p darkfi.darkfi_app -c android.intent.category.LAUNCHER 1
  102. 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
  103. # Useful for dev
  104. podman-cli:
  105. podman run -v $(shell pwd)/../../:/root/darkfi -w /root/darkfi/bin/app/ -it apk bash
  106. fmt:
  107. $(CARGO) +nightly fmt
  108. clean:
  109. podman run -v $(shell pwd):/root/dw -w /root/dw -t apk rm -fr target/
  110. rm -f darkfi-app.apk
  111. .PHONY: all android cli clean zkas