improve Makefile

This commit is contained in:
Alexander Mahr 2024-10-31 13:13:53 +01:00
parent c08394e44c
commit 20a426e229
16 changed files with 118 additions and 42 deletions

3
.gitignore vendored
View file

@ -1,3 +1,5 @@
*.apk
*.apk.install-log
apk/ToyKey.keystore
apk/obj
apk/obj/*
@ -8,3 +10,4 @@ apk/result/*
apk/bin/!.gitkeep
/example.app.apk
docker-compose-build.log
/Makefile.apps

150
Makefile
View file

@ -1,50 +1,122 @@
.PHONY: all
all: install-all
.PHONY: run-webview
run-webview: install-webview
adb shell am start -n app.example/.ExampleApp
.PHONY: build-all
build-all: build-webview build-native
# this includes explicit rules
.PHONY: build-webview
build-webview: docker-compose-build.log
docker-compose run --rm compile webview
ln -sf apk/webview/result/example.app.apk ./; test -e ./example.app.apk || rm ./example.app.apk
include Makefile.apps
Makefile.apps: Makefile apps
@(\
cd apps;\
for APP in */;\
do \
test -d "$$APP" || continue;\
APP="$${APP%/}";\
MFA="\
apps/$$APP/app.apk: docker-compose-build.log\n\
docker compose run --rm compile $$APP\n\
build-$$APP: apps/$$APP/app.apk\n\
true\n\
apps/$$APP/app.apk.install-log: apps/$$APP/app.apk\n\
adb install -r $$< > \$$@ || rm \$$@ \n\
install-$$APP: apps/$$APP/app.apk.install-log\n\
true\n\
run-$$APP: apps/$$APP/app.apk.install-log\n\
adb shell am start -n app.example/.ExampleApp\n\
";\
done;\
printf "$$MFA" \
) > "$@"
.PHONY: build-native
build-native: docker-compose-build.log
docker-compose run --rm compile native
#ln -sf apk/native/result/example.app.apk ./; test -e ./example.app.apk || rm ./example.app.apk
apps:
mkdir "$@"
.PHONY: install-all
install-all: install-webview install-native
install: $(shell for APP in apps/*/; do test -d "$$APP" || continue; echo "$$APP""app.apk.install-log"; done)
force-install reinstall:
for APP in apps/*/; do rm -f "$$APP""app.apk.install-log" 2>/dev/null; done; $(MAKE) install
run: $(shell cd apps/; for APP in */; do test -d "$$APP" || continue; echo "run-$${APP%/}"; done)
.PHONY: install-webview
install-webview: build-webview
adb install -r ./example.app.apk
.PHONY: install-native
install-native: build-native
true
#adb install -r ./example.app.apk
.PHONY: clean-all
clean-all: clean-docker clean-apk
.PHONY: clean-docker
clean-docker:
rm docker-compose-build.log || true
docker-compose down --remove-orphans --rmi all
.PHONY: clean-apk
clean-apk:
cd apk && $(MAKE) clean
#newer :=$(shell test Makefile.apps -nt Makefile -a Makefile.apps -nt apps && printf Y)
#ifndef newer
#Makefile.apps: FORCE
# printf 'inmf: ; echo $$@\n' > $@
#FORCE:
#endif
#include Makefile.apps
#include depend
#depend: Makefile
# printf 'independ: ; echo super\n' >> $@
#newer :=$(shell echo a)
#ifdef($(newer))
#include depend
#endif
#APPDIRS = $(wildcard apps/*/)
##APPDIRS := $(APPDIRS) apps/newapp/
#TESTFILES = $(patsubst %, %test ,$(APPDIRS))
#test:
# echo $(wildcard apps/*/)
# echo $(APPDIRS)
##a b c:
## echo $@
#echo-testfiles:
# echo $(TESTFILES)
#
#$(TESTFILES) :
# echo "$@"
#
#$(APPDIRS) :
# echo "$@"
#
###.PHONY: all
###all: install-all
###
###.PHONY: run-webview
###run-webview: install-webview
### adb shell am start -n app.example/.ExampleApp
###
###.PHONY: build-all
###build-all: build-webview build-native
###
###
###.PHONY: build-webview
###build-webview: docker-compose-build.log
### docker-compose run --rm compile webview
### ln -sf apk/webview/result/example.app.apk ./; test -e ./example.app.apk || rm ./example.app.apk
###
###.PHONY: build-native
###build-native: docker-compose-build.log
### docker-compose run --rm compile native
### #ln -sf apk/native/result/example.app.apk ./; test -e ./example.app.apk || rm ./example.app.apk
###
###.PHONY: install-all
###install-all: install-webview install-native
###
###.PHONY: install-webview
###install-webview: build-webview
### adb install -r ./example.app.apk
###
###.PHONY: install-native
###install-native: build-native
### true
### #adb install -r ./example.app.apk
###
###.PHONY: clean-all
###clean-all: clean-docker clean-apk
###
###.PHONY: clean-docker
###clean-docker:
### rm docker-compose-build.log || true
### docker-compose down --remove-orphans --rmi all
###
###.PHONY: clean-apk
###clean-apk:
### cd apk && $(MAKE) clean
###
###
docker-compose-build.log: Dockerfile compose.yml
docker-compose down --remove-orphans --rmi all
BUILDKIT_PROGRESS=plain docker-compose build | tee docker-compose-build.log

View file

@ -15,6 +15,7 @@ all: build
.PHONY : clean
build : ./result/example.app.apk
mv ./result/example.app.apk app.apk
true
env:

View file

Before

Width:  |  Height:  |  Size: 9.2 KiB

After

Width:  |  Height:  |  Size: 9.2 KiB

View file

Before

Width:  |  Height:  |  Size: 2.7 KiB

After

Width:  |  Height:  |  Size: 2.7 KiB

View file

Before

Width:  |  Height:  |  Size: 5.1 KiB

After

Width:  |  Height:  |  Size: 5.1 KiB

View file

Before

Width:  |  Height:  |  Size: 14 KiB

After

Width:  |  Height:  |  Size: 14 KiB

View file

@ -3,7 +3,7 @@ services:
build:
context: .
args:
YESACCEPT: ${YESACCEPT}
YESACCEPT: ${YESACCEPT:-}
stop_grace_period: 1s
volumes:
- ./apk:/apk
- ./apps:/apps

View file

@ -3,7 +3,7 @@
set -x
APKDIR="/apk/$1"
APKDIR="/apps/$1"
shift
#test -d "$1" ==
#APKDIR=