Makefile 3.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127
  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=schema-app
  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 assets/forest_720x1280.mp4
  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 assets/forest_720x1280.mp4
  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. # Windows cross-compilation using Docker/Podman
  45. win-docker-release: $(SRC)
  46. podman run -v $(shell pwd):/root/build -w /root/build/ -t windows \
  47. cargo build --release --target x86_64-pc-windows-gnu $(RELEASE_FEATURES)
  48. ./release/win/package.sh release
  49. win-docker-debug: $(SRC)
  50. podman run -v $(shell pwd):/root/build -w /root/build/ -t windows \
  51. cargo build --target x86_64-pc-windows-gnu $(DEBUG_FEATURES)
  52. ./release/win/package.sh debug
  53. build-release: $(SRC) fonts assets/forest_1920x1080.ivf
  54. $(CARGO) build --release $(RELEASE_FEATURES)
  55. -mv target/release/darkfi-app .
  56. build-debug: $(SRC) fonts assets/forest_1920x1080.ivf
  57. $(CARGO) build $(DEBUG_FEATURES)
  58. -mv target/debug/darkfi-app .
  59. # Download font data
  60. fonts: ibm-plex-mono-regular.otf NotoColorEmoji.ttf
  61. ibm-plex-mono-regular.otf:
  62. wget -c https://dark.fi/assets/ibm-plex-mono-regular.otf
  63. NotoColorEmoji.ttf:
  64. wget -c https://dark.fi/assets/NotoColorEmoji.ttf
  65. # App data
  66. assets/forest_1920x1080.ivf:
  67. rm -f assets/forest_720x1280.mp4
  68. wget -P assets/ -c https://dark.fi/assets/forest_1920x1080.ivf
  69. assets/forest_720x1280.mp4:
  70. rm -f assets/forest_1920x1080.ivf
  71. wget -P assets/ -c https://dark.fi/assets/forest_720x1280.mp4
  72. # Developer targets
  73. dev: $(SRC) fonts assets/forest_1920x1080.ivf
  74. $(CARGO) lbuild --no-default-features $(DEV_FEATURES)
  75. -mv target/debug/darkfi-app .
  76. ./darkfi-app
  77. # Users should use the android-release and android-debug targets instead.
  78. apk: $(SRC) fonts assets/forest_720x1280.mp4
  79. cargo quad-apk build --no-default-features $(DEV_FEATURES)
  80. $(MAKE) install-apk
  81. install-apk:
  82. -mv $(DEBUG_APK) .
  83. -adb $(ADB_DEVICE) uninstall darkfi.darkfi_app
  84. adb $(ADB_DEVICE) install -r darkfi-app.apk
  85. $(MAKE) log-apk
  86. log-apk:
  87. reset
  88. adb $(ADB_DEVICE) logcat -c
  89. adb $(ADB_DEVICE) shell monkey -p darkfi.darkfi_app -c android.intent.category.LAUNCHER 1
  90. 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
  91. # Useful for dev
  92. podman-cli:
  93. podman run -v $(shell pwd)/../../:/root/darkfi -w /root/darkfi/bin/app/ -it apk bash
  94. fmt:
  95. $(CARGO) +nightly fmt
  96. clean:
  97. podman run -v $(shell pwd):/root/dw -w /root/dw -t apk rm -fr target/
  98. rm -f darkfi-app.apk
  99. .PHONY: all android cli clean