Place the rebuild_file_tables.php script in a files subfolder of the main component.
It requires PHP 7 to run.
This is what the setup should look like
main/files/embed/index.html
main/files/rebuild_file_tables.php
main/CMakeLists.txt
main/main.c
Add this to your CMakeLists.txt before register_component:
#begin staticfiles
#end staticfiles
The script will update CMakeLists.txt and generate files_enum.c and files_enum.h when run.
main/files/files_enum.h
main/files/files_enum.c
Ensure files/files_enum.c is included in the build.
www_get_static_file() is implemented as weak to let you provide custom access authentication logic.