android-app-docker/Makefile
2024-11-01 06:12:24 +01:00

124 lines
2.9 KiB
Makefile

# this includes explicit rules
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" \
) > "$@"
apps:
mkdir "$@"
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)
#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