raylib custom Android APK build pipeline with plain Makefile

Hello all,

Those last weeks I've been quite busy working in one new feature for raylib 1.8, a custom Android APK build pipeline based on plain Makefile (no gradle, no ndk-build, no ant) to build raylib native apps. The truth is that it took me longer than expected, facing several issues and understanding how all APK generation process works for native apps.

I decided to do that for various reasons:

  • 1) Learn and understand how all APK generation process worked (no build black-boxes)
  • 2) Simplify, if possible, the build process with a "simple" plain Makefile
  • 3) Starting from a simple project folder structure (what my students use), just generate the .apk (same way a .exe is generated)

  • Here it is a simple diagram of what I wanted to accomplish:

    1
    2
    3
    4
    myproject --> resources
              --> raylib_game.c  ----> [make] -----> mygame.apk 
              --> somecode.c
              --> Makefile
    


    After a bunch of hours, just got it and I thought it could be useful for someone, specially the Handmade community.

    I created a fully configurable Makefile.Android with some project templates for raylib.

    Basically, the Makefile generates everything from scratch, build folder structure, required resources, required Java files, AndroidManifest.xml... and compiles the provided source files into a library and later packs everything into an APK. All the process is commented in the same file, to serve as a tutorial.

    Some of the benefits of using this custom APK building are generation times (down to a couple of seconds) and APK size; a simple raylib game with no audio could be around ~200KB apk or less and including OpenAL Soft audio library it's about ~600KB apk... An everything with a simple and easy-to-use Makefile.

    Please, let me know yout thoughts! :)


    Edited by Ray on
    You know that ndk-build is plain makefile, right?
    Yes, I knew they were makefiles, actually I use them in verbose mode to check the full processes pipeline... but it was not transparent enough for me about what was happening, neither enough configurable (folders structure, files placement...), so I decided to implement my own.