Makefile 5.1 KB

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