Makefile 3.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117
  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. #ADB_DEVICE = -s DEVICE_ID
  7. ADB_DEVICE =
  8. SRC = \
  9. build.rs \
  10. Cargo.lock \
  11. Cargo.toml \
  12. Dockerfile \
  13. $(shell find assets -type f) \
  14. $(shell find src -type f)
  15. RELEASE_FEATURES = --features=enable-plugins
  16. DEBUG_FEATURES = --features=enable-filelog,enable-plugins
  17. #DEV_FEATURES = --features=enable-filelog,enable-netdebug,emulate-android
  18. #DEV_FEATURES = --features=enable-filelog,enable-netdebug,enable-plugins
  19. DEV_FEATURES = --features=enable-plugins
  20. default: build-release
  21. ./darkfi-app
  22. android: android-release
  23. # Platform release builds
  24. macos-release: build-release
  25. -mv darkfi-app darkfi-app.macos
  26. macos-debug: build-debug
  27. -mv darkfi-app darkfi-app_debug.macos
  28. linux-release: build-release
  29. -mv darkfi-app darkfi-app.linux
  30. linux-debug: build-debug
  31. -mv darkfi-app darkfi-app_debug.linux
  32. win-release: $(SRC) fonts
  33. $(CARGO) build --release $(RELEASE_FEATURES)
  34. -mv target/release/darkfi-app.exe .
  35. win-debug: $(SRC) fonts
  36. $(CARGO) build $(DEBUG_FEATURES)
  37. -mv target/debug/darkfi-app.exe .
  38. android-release: $(SRC) fonts forest_720x1280
  39. podman run -v $(shell pwd)/../../:/root/darkfi -w /root/darkfi/bin/app/ -t apk cargo quad-apk build --release $(RELEASE_FEATURES)
  40. -mv $(RELEASE_APK) darkfi-app.apk
  41. android-debug: $(SRC) fonts forest_720x1280
  42. podman run -v $(shell pwd)/../../:/root/darkfi -w /root/darkfi/bin/app/ -t apk cargo quad-apk build $(DEBUG_FEATURES)
  43. -mv $(DEBUG_APK) darkfi-app_debug.apk
  44. build-release: $(SRC) fonts forest_1920x1080
  45. $(CARGO) build --release $(RELEASE_FEATURES)
  46. -mv target/release/darkfi-app .
  47. build-debug: $(SRC) fonts forest_1920x1080
  48. $(CARGO) build $(DEBUG_FEATURES)
  49. -mv target/debug/darkfi-app .
  50. # Download font data
  51. fonts: ibm-plex-mono-regular.otf NotoColorEmoji.ttf
  52. ibm-plex-mono-regular.otf:
  53. wget -c https://codeberg.org/darkrenaissance/darkfi/raw/branch/data/ibm-plex-mono-regular.otf
  54. NotoColorEmoji.ttf:
  55. wget -c https://codeberg.org/darkrenaissance/darkfi/raw/branch/data/NotoColorEmoji.ttf
  56. forest_1920x1080.zip:
  57. wget -c https://codeberg.org/darkrenaissance/darkfi/raw/branch/data/forest_1920x1080.zip
  58. assets/forest_1920x1080/000.qoi:
  59. cd assets && unzip ../forest_1920x1080.zip
  60. forest_1920x1080: forest_1920x1080.zip assets/forest_1920x1080/000.qoi
  61. rm -fr assets/forest_729x1280/
  62. forest_720x1280.zip:
  63. wget -c https://codeberg.org/darkrenaissance/darkfi/raw/branch/data/forest_720x1280.zip
  64. assets/forest_720x1280/000.qoi:
  65. cd assets && unzip ../forest_720x1280.zip
  66. forest_720x1280: forest_720x1280.zip assets/forest_720x1280/000.qoi
  67. rm -fr assets/forest_1920x1080/
  68. # Developer targets
  69. dev: $(SRC) fonts forest_1920x1080
  70. $(CARGO) lbuild $(DEV_FEATURES)
  71. -mv target/debug/darkfi-app .
  72. ./darkfi-app
  73. apk: $(SRC) fonts forest_720x1280
  74. podman run -v $(shell pwd)/../../:/root/darkfi -w /root/darkfi/bin/app/ -t apk cargo quad-apk build $(DEV_FEATURES)
  75. $(MAKE) install-apk
  76. install-apk:
  77. -mv $(DEBUG_APK) .
  78. -adb $(ADB_DEVICE) uninstall darkfi.darkfi_app
  79. adb $(ADB_DEVICE) install -r darkfi-app.apk
  80. reset
  81. adb $(ADB_DEVICE) logcat -c
  82. adb $(ADB_DEVICE) shell monkey -p darkfi.darkfi_app -c android.intent.category.LAUNCHER 1
  83. 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
  84. # Useful for dev
  85. cli:
  86. podman run -v $(shell pwd)/../../:/root/darkfi -w /root/darkfi/bin/app/ -it apk bash
  87. fmt:
  88. $(CARGO) +nightly fmt
  89. clean:
  90. podman run -v $(shell pwd):/root/dw -w /root/dw -t apk rm -fr target/
  91. rm -f darkfi-app.apk
  92. .PHONY: all android cli clean