That said, I still have the impression that preparing the prefix and pulling required dependencies (NOT building them) are steps that could be handled by the main Wine build system, since they are required for producing a usable Android package. For the purpose of the makefile test rules, missing dependencies could simply result in warnings rather than hard failures. Resolving library paths from detected CFLAGS/LDFLAGS can also be reliably reproduced using the linker trace option (-Wl,-t), so it would likely be more appropriate to handle this in the Wine build system rather than in external scripts.
Any complexity that's related to packaging should be handled in external scripts, like we do for Debian/RPM/macOS.
Another issue is that tools like wineboot and winedbg used to be scripts, but are now symlinks. Since aapt does not preserve or handle symlinks, they cannot be packaged directly into the APK, which requires replacing them with wrapper scripts during staging.
There shouldn't be any reason to ship these symlinks on Android, nobody is going to run them from the command line.
Given that, it still makes sense to keep APK generation separate from the default all target, since a proper build requires additional setup and a suitable Gradle environment.
I'm happy to remove things from the makefile, but that means the gradle script etc. should be moved to the packaging repo as well. We don't want to include dead code. -- https://gitlab.winehq.org/wine/wine/-/merge_requests/10354#note_132607