Skip to content

Instantly share code, notes, and snippets.

@flamendless
Last active November 8, 2018 13:51
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save flamendless/2a0f1e04ee44b295e9884642852487cc to your computer and use it in GitHub Desktop.
Save flamendless/2a0f1e04ee44b295e9884642852487cc to your computer and use it in GitHub Desktop.
Makefile for easier love development for android using apktool
--usage: make build-android
--usage: make apk-release VERSION=0.1.3
--note: You must still edit the versionCode in AndroidManifest.xml
SHELL := /bin/zsh
ANDROID = PATH:/opt/android-sdk/build-tools/28.0.2
LOVE_NAME = game.love
BUILD_DIR = build
OUTPUT_DIR = ${BUILD_DIR}/output
RELEASE_DIR = ${BUILD_DIR}/release
NAME = purrr
APK_NAME = ${NAME}.apk
PACKAGE_NAME = com.${NAME}.flamendless
TEST_APK_NAME = ${OUTPUT_DIR}/${NAME}-unaligned.apk
KS_FILE = ${BUILD_DIR}/am2018.keystore
VERSION = 0-1-3
PASSWORD :=
test:
echo "Testing"
love .
build-android: build-love apk-compile apk-sign apk-install
apk-release: build-love apk-compile apk-sign
cp ${OUTPUT_DIR}/${APK_NAME} ${RELEASE_DIR}/purrr-${VERSION}.apk
notify-send "FINISHED"
build-love:
echo "making .love file..."
noglob zip -9rv ${OUTPUT_DIR}/${LOVE_NAME} . -x *.git* *.gitmodules* *.gitignore* *.md* *.txt* *.rst* *docs/* *.ase* *.aseprite* *.swp* *spec/* *test/* *rockspec* *.mak* *.yml* *ctags* *Makefile* *build/* *backup/* *res/* *examples/* *LICENSE* *.vscode* *icons/* *.luacheckrc*;
echo "made .love file!"
notify-send "LOVE BUILT!"
apk-compile:
echo "copying .love to build"
cp ${OUTPUT_DIR}/${LOVE_NAME} ${BUILD_DIR}/decoded/assets/
echo "copied!"
echo "compiling apk..."
apktool b -o ${OUTPUT_DIR}/${APK_NAME} ${BUILD_DIR}/decoded;
echo "compiled apk!"
notify-send "APK COMPILED!"
apk-sign:
echo "signing apk..."
apk-signer -f ${OUTPUT_DIR}/${APK_NAME} -a flamendless -k ${KS_FILE} -s ${PASSWORD};
echo "signed apk!"
notify-send "APK SIGNED!"
apk-install:
echo "adb installing..."
adb uninstall ${PACKAGE_NAME}
adb install ${TEST_APK_NAME}
echo "adb installed"
notify-send "APK INSTALLED!"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment