view Makefile @ 31:0bc0b4798d9e

fix saystring(12) command for proper unicode and document it
author Carl Byington <carl@five-ten-sg.com>
date Sun, 28 Apr 2019 14:45:56 -0700
parents e6784ab8964c
children
line wrap: on
line source

#mc40 is "On Device Storage"
#tc55 is "Internal Storage"

na=$(shell find . -iname '*.c' -o -iname '*.h' -o -iname '*.cpp')
style:=release
dest:=/run/user/1000/gvfs/mtp*/*torage/Download
ver:=$(shell grep versionName app/src/main/AndroidManifest.xml | cut -d'"' -f2)
apk:='app/build/outputs/apk/510ConnectbotMonitor-$(ver).$(style).apk'
id:=$(shell hg id --id || echo 1)
da:=$(shell date '+%Y-%m-%dT%H:%M:%S')
version:=\
<?xml version=\"1.0\" encoding=\"utf-8\"?>\n\
<resources>\n\
	<string name=\"msg_version\" translatable=\"false\">510ConnectbotMonitor $(ver) ($(id) $(da))</string>\n\
</resources>\n

ifeq ($(style),release)
    task:=assembleArmRelease
	debug:=0
else
	task:=assembleArmDebug
	debug:=1
endif

all:
	hg pull; hg update
	make builder

builder:
	rm -rf app/build/*
	echo -e "$(version)" >app/src/main/res/values/version.xml
	cat app/src/main/res/values/version.xml
	ANDROID_HOME=/home/carl/Android/Sdk ANDROID_NDK_HOME=/home/carl/Android/Sdk/ndk-bundle ./gradlew $(task)
	mv app/build/outputs/apk/arm/$(style)/app-arm-$(style).apk $(apk)
	ls -al app/build/outputs/apk

docs:
	(cd xml; make)

install:
	cp $(apk) $(dest)
	ls -al $(apk) $(dest)

buildicon:
	cp -a   base.510.icon.png                 res/drawable-xxxhdpi/icon.png
	convert base.510.icon.png -resize 144x144 res/drawable-xxhdpi/icon.png
	convert base.510.icon.png -resize 96x96   res/drawable-xhdpi/icon.png
	convert base.510.icon.png -resize 72x72   res/drawable-hdpi/icon.png
	convert base.510.icon.png -resize 48x48   res/drawable-mdpi/icon.png
	convert base.510.icon.png -resize 36x36   res/drawable-ldpi/icon.png

	convert res/drawable-xxxhdpi/icon.png -resize 50% -colorspace Gray res/drawable-xxxhdpi/notification_icon.png
	convert res/drawable-xxhdpi/icon.png  -resize 50% -colorspace Gray res/drawable-xxhdpi/notification_icon.png
	convert res/drawable-xhdpi/icon.png   -resize 50% -colorspace Gray res/drawable-xhdpi/notification_icon.png
	convert res/drawable-hdpi/icon.png    -resize 50% -colorspace Gray res/drawable-hdpi/notification_icon.png
	convert res/drawable-mdpi/icon.png    -resize 50% -colorspace Gray res/drawable-mdpi/notification_icon.png
	convert res/drawable-ldpi/icon.png    -resize 50% -colorspace Gray res/drawable-ldpi/notification_icon.png

indentc:
	dos2unix $(na)
	for i in $(na); do sed -i -e 's/\r//g' $$i; done
	indent --line-length100 \
		   --brace-indent4 \
		   --braces-on-if-line \
		   --braces-on-func-def-line \
		   --case-brace-indentation4 \
		   --case-indentation4 \
		   --comment-indentation60 \
		   --cuddle-else \
		   --cuddle-do-while \
		   --declaration-comment-column60 \
		   --no-tabs \
		   -nbbo \
		   -npcs \
		   -nprs \
		   -npsl \
		   -bad -bap -bbb -sob \
		   -saf -sai -saw \
		   -i4 \
		   $(na)

indentjava:
	astyle --style=java \
		--attach-namespaces \
		--attach-classes \
		--indent-classes \
		--indent-switches \
		--indent-cases \
		--indent-namespaces \
		--break-blocks \
		--pad-oper \
		--pad-first-paren-out \
		--pad-header \
		--unpad-paren \
		--delete-empty-lines \
		--align-pointer=type \
		--break-closing-brackets \
		--keep-one-line-blocks \
		--keep-one-line-statements \
		--convert-tabs \
		--break-after-logical \
		--mode=java \
		   $(shell find . -iname '*.java' | grep -v /gen/)