Makefile for Google brotli and zopfli

I would like to include Google brotli and zopfli (incl. libzopfli and zopflipng) into my custom OpenWRT build. Has anybody already done this and can share the Makefile? I could not find anything on github.

Here is the source for both programs:

Build instructions for brotli and zopfli are:
The basic commands to build and install brotli are:

$ mkdir out && cd out
$ cmake -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX=./installed ..
$ cmake --build . --config Release --target install

The source code of Zopfli is under src/zopfli. Build instructions:
To build zopfli, compile all .c source files under src/zopfli to a single binary
with C, and link to the standard C math library, e.g.:
gcc src/zopfli/*.c -O2 -W -Wall -Wextra -Wno-unused-function -ansi -pedantic -lm -o zopfli

I am completely new to writing Makefiles (have so far only done minor modifications to an existing Makefile) and need some help in creating them.

Many thanks!

https://openwrt.org/docs/guide-developer/helloworld/start

Thank you, but unfortunately that does not solve my problem with brotli and zopfli. There are more complex than "hello world!". As I have written, my question was specifically about these two.