Looks to me that your include files may have references to other include files. So, you will need to provide a flag to indicate the location of those include files. I'll suggest providing the location (directory containing all include files) as
INCL_DIR=/include/dir/location
and including it in the compilation phase using the -I
flag. For example, your rule for api.o
will become
api.o: api.c api.h
gcc -c $(CFLAGS) -I$(INCL_DIR) $(INCLUDES_FOR_BUNCH_OF_LIBS) $< -o $@