Hi,
I wanna automate the processing of compilation, my idea is to point all path-related files (*.c and *.h), I wrote script which is looking for all *.c and *.h files and includes them into makefile
#!/bin/bash
src_file=Sources.mk
header_file=Headers.mk
if [ -f "$src_file" ]
then
echo "$src_file found."
else
echo "# Source files common to all targets" >> $src_file && echo "SRC_FILES += \\" >> $src_file && find . -path ./examples -prune -o -type f -name *.[c] | sed 's/.\// \$(SDK_ROOT)\//' | sed 's/$/ \\/' >> $src_file
fi
if [ -f "$header_file" ]
then
echo "$header_file found."
else
echo "# Include folders common to all targets" >> $header_file && echo "INC_FOLDERS += \\" >> $header_file && find . -path ./examples -prune -o -type f -name *.[h] -exec dirname {} \; | sed 's/.\// \$(SDK_ROOT)\//' | sed 's/*.h//g' | sed 's/$/ \\/' >> $header_file
fi
They were included into main Makefile as
include Source.mk
include Headers.mk
But when I try to compile something I get some errors, i.e.
Compiling file: ant_stack_config.c
Compiling file: ant_bpwr_simulator.c
In file included from /nrf51/12.3.0/components/ant/ant_profiles/ant_bpwr/simulator/ant_bpwr_simulator.h:65:0,
from /nrf51/12.3.0/components/ant/ant_profiles/ant_bpwr/simulator/ant_bpwr_simulator.c:41:
/nrf51/12.3.0/components/ant/ant_profiles/ant_bpwr/ant_bpwr.h:55:10: fatal error: ant_parameters.h: No such file or directory
#include "ant_parameters.h"
^~~~~~~~~~~~~~~~~~
compilation terminated.
make: *** [_build/nrf51422_xxac_ant_bpwr_simulator.c.o] Error 1
Means that script missed some files, is it possible to automate it or to compile SDK as static library?