view Makefile @ 522:645d22a0e8cb

add more debug code
author Carl Byington <carl@five-ten-sg.com>
date Fri, 31 May 2024 18:30:19 -0600
parents 5d55f83b4e87
children 775a81a78a2b
line wrap: on
line source

na=$(shell find . -iname '*.c' -o -iname '*.h' -o -iname '*.cpp')
style:=release
dest:=../ASM.v6/installers
ver:=$(shell grep versionName app/src/main/AndroidManifest.xml | cut -d'"' -f2)
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\">510Connectbot $(ver) ($(id) $(da))</string>\n\
</resources>\n
apk:=$(dest)/510Connectbot-$(ver).$(style).apk
debugapk:=$(dest)/510Connectbot-$(ver).debug.apk
signapk:=$(shell cat ~/.signapk)

# path to google binaries on AndroidBuild
adb=/home/carl/Android/Sdk/platform-tools/adb
aapt=/home/carl/Android/Sdk/build-tools/33.0.0/aapt

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

fn:=app/src/main/java/com/five_ten_sg/connectbot/monitor/MonitorService.java

all:
	make build.asm.packages

builder: clean prep
	echo ./gradlew $(task)
	@echo -e "$(signapk)\n$(signapk)" | ./gradlew $(task)
	mv app/build/outputs/apk/arm/$(style)/app-arm-$(style).apk $(apk)

clean:
	rm -rf app/build/*
	rm -rf app/.externalNativeBuild || true

prep:
	echo -e "$(version)" >app/src/main/res/values/version.xml
	make docs

genkey:
	keytool -genkeypair -keystore 510Connectbot.keystore -alias 510Connectbot -dname "cn=510Connectbot , ou=510Connectbot, o=five-ten-sg, o=com, c=US" -keyalg RSA -keysize 2048 -validity 10000

exportkey:
	keytool -export -alias 510Connectbot -file 510Connectbot.crt -keystore 510Connectbot.keystore
	openssl x509 -inform der -in 510Connectbot.crt -out 510Connectbot.pem

docs:
	(cd xml; make)
	(cd help; make)

buildicon:
	convert base.510.icon.png -background white -resize 500x500 -extent 1024x500 google.play.store/feature.510.icon.png
	cp -a   base.510.icon.png                 app/src/main/res/drawable-xxxhdpi/icon.png
	convert base.510.icon.png -resize 144x144 app/src/main/res/drawable-xxhdpi/icon.png
	convert base.510.icon.png -resize 96x96   app/src/main/res/drawable-xhdpi/icon.png
	convert base.510.icon.png -resize 72x72   app/src/main/res/drawable-hdpi/icon.png
	convert base.510.icon.png -resize 48x48   app/src/main/res/drawable-mdpi/icon.png
	convert base.510.icon.png -resize 36x36   app/src/main/res/drawable-ldpi/icon.png

	convert app/src/main/res/drawable-xxxhdpi/icon.png -resize 50% -colorspace Gray app/src/main/res/drawable-xxxhdpi/notification_icon.png
	convert app/src/main/res/drawable-xxhdpi/icon.png  -resize 50% -colorspace Gray app/src/main/res/drawable-xxhdpi/notification_icon.png
	convert app/src/main/res/drawable-xhdpi/icon.png   -resize 50% -colorspace Gray app/src/main/res/drawable-xhdpi/notification_icon.png
	convert app/src/main/res/drawable-hdpi/icon.png    -resize 50% -colorspace Gray app/src/main/res/drawable-hdpi/notification_icon.png
	convert app/src/main/res/drawable-mdpi/icon.png    -resize 50% -colorspace Gray app/src/main/res/drawable-mdpi/notification_icon.png
	convert app/src/main/res/drawable-ldpi/icon.png    -resize 50% -colorspace Gray app/src/main/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/)

internaldocs:
	doxygen


build.asm.packages:
	make prep
	make builder style=release
	make builder style=debug

update.copyrights:
	sed -i -re 's/(Copyright .C. ....-).... /\1$(year) /g' app/src/main/java/ch/ethz/ssh2/crypto/SecureRandomFix.java
	sed -i -re 's/(Copyright . ....-).... /\1$(year) /g'   app/src/main/res/values/notrans.xml
	sed -i -re 's/(Copyright .C. ....-).... /\1$(year) /g' xml/510connectbot.in

install.android:
	$(adb) devices
	echo installing $(debugapk)
	$(adb) install -r -d $(debugapk)

logcat.device:
	$(adb) logcat

push:
	# from from android build machine
	hg push ssh://ns.five-ten-sg.com/usr/hg/510Connectbot || /bin/true
	hg push ssh://root@ns.five-ten-sg.com//usr/hg-repository/510Connectbot || /bin/true
	hg push ssh://root@ns1.five-ten-sg.com//usr/hg-repository/510Connectbot || /bin/true
	ssh ns.five-ten-sg.com "cd usr/hg/510Connectbot; hg update"
	ssh root@ns.five-ten-sg.com "cd /usr/hg-repository/510Connectbot; hg update"
	ssh root@ns1.five-ten-sg.com "cd /usr/hg-repository/510Connectbot; hg update"
	scp -p html/* root@ns.five-ten-sg.com://home/httpd/html/510sg/510Connectbot
	scp -p html/* root@ns1.five-ten-sg.com://home/httpd/html/510sg/510Connectbot

#
# make update.copyrights year=2024
# hg commit -m 'update copyrights'

# release procedure
# make any changes
# hg commit -m 'commit message'
# make build.asm.packages
# make push
# make install.android