2018-02-04 19:17:34 +08:00
|
|
|
.PHONY: default release clean build build-app build-server run dist dist-zip sums test
|
2017-12-12 22:12:07 +08:00
|
|
|
|
2018-02-06 00:47:32 +08:00
|
|
|
GRADLE ?= ./gradlew
|
2018-01-30 00:06:44 +08:00
|
|
|
|
|
|
|
APP_BUILD_DIR := app-build
|
2018-02-07 18:47:10 +08:00
|
|
|
APP_BUILD_DEBUG_DIR := app-build-debug
|
2017-12-12 22:12:07 +08:00
|
|
|
DIST := dist
|
|
|
|
TARGET_DIR := scrcpy
|
|
|
|
|
|
|
|
VERSION := $(shell git describe --tags --always)
|
|
|
|
TARGET := $(TARGET_DIR)-$(VERSION).zip
|
|
|
|
|
|
|
|
default:
|
|
|
|
@echo 'You must specify a target. Try: make release'
|
|
|
|
|
|
|
|
release: clean dist-zip sums
|
|
|
|
|
|
|
|
clean:
|
2018-01-30 00:06:44 +08:00
|
|
|
$(GRADLE) clean
|
2018-02-07 18:47:10 +08:00
|
|
|
rm -rf "$(APP_BUILD_DIR)" "$(APP_BUILD_DEBUG_DIR)" "$(DIST)"
|
|
|
|
|
|
|
|
build-app-debug:
|
2018-02-09 19:12:07 +08:00
|
|
|
[ -d "$(APP_BUILD_DEBUG_DIR)" ] || ( mkdir "$(APP_BUILD_DEBUG_DIR)" && \
|
|
|
|
CFLAGS=-fsanitize=address,undefined meson app "$(APP_BUILD_DEBUG_DIR)" --buildtype debug )
|
2018-02-07 18:47:10 +08:00
|
|
|
ninja -C "$(APP_BUILD_DEBUG_DIR)"
|
|
|
|
|
|
|
|
build-server-debug:
|
|
|
|
$(GRADLE) assembleDebug
|
|
|
|
|
|
|
|
build-debug: build-app-debug build-server-debug
|
|
|
|
|
|
|
|
run-debug:
|
|
|
|
SCRCPY_SERVER_JAR=server/build/outputs/apk/debug/server-debug.apk $(APP_BUILD_DEBUG_DIR)/scrcpy $(ARGS)
|
2017-12-12 22:12:07 +08:00
|
|
|
|
|
|
|
build-app:
|
2018-02-12 18:02:14 +08:00
|
|
|
[ -d "$(APP_BUILD_DIR)" ] || ( mkdir "$(APP_BUILD_DIR)" && \
|
|
|
|
meson app "$(APP_BUILD_DIR)" --buildtype release -Db_lto )
|
2018-01-30 00:06:44 +08:00
|
|
|
ninja -C "$(APP_BUILD_DIR)"
|
2017-12-12 22:12:07 +08:00
|
|
|
|
|
|
|
build-server:
|
2018-01-30 00:06:44 +08:00
|
|
|
$(GRADLE) assembleRelease
|
2017-12-12 22:12:07 +08:00
|
|
|
|
2018-02-04 19:17:34 +08:00
|
|
|
build: build-app build-server
|
|
|
|
|
|
|
|
run:
|
|
|
|
SCRCPY_SERVER_JAR=server/build/outputs/apk/release/server-release-unsigned.apk $(APP_BUILD_DIR)/scrcpy $(ARGS)
|
|
|
|
|
|
|
|
dist: build
|
2017-12-12 22:12:07 +08:00
|
|
|
mkdir -p "$(DIST)/$(TARGET_DIR)"
|
2018-02-02 16:31:44 +08:00
|
|
|
# no need to sign the APK, we dont "install" it, this is in fact a simple jar
|
|
|
|
cp server/build/outputs/apk/release/server-release-unsigned.apk "$(DIST)/$(TARGET_DIR)/scrcpy-server.jar"
|
2018-01-30 00:06:44 +08:00
|
|
|
cp $(APP_BUILD_DIR)/scrcpy "$(DIST)/$(TARGET_DIR)/"
|
2017-12-12 22:12:07 +08:00
|
|
|
|
|
|
|
dist-zip: dist
|
|
|
|
cd "$(DIST)"; \
|
|
|
|
zip -r "$(TARGET)" "$(TARGET_DIR)"
|
|
|
|
|
|
|
|
sums:
|
|
|
|
cd "$(DIST)"; \
|
|
|
|
sha256sum *.zip > SHA256SUM.txt
|
2017-12-14 18:38:44 +08:00
|
|
|
|
|
|
|
test:
|
2018-01-30 00:06:44 +08:00
|
|
|
$(GRADLE) test
|
|
|
|
ninja -C "$(APP_BUILD_DIR)" test
|