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