Your SRC_FILES
contains src/file1.o
and src/file2.o
and so on. This is most likely not what you want. By doing this and the $*.c
in the generic .c to .o rule you're breaking make's
file-rule-dependency automatism.
I'd rewrite your Makefile like this:
[..]
all: lib${PROGRAM}.so # create dependency from all to your .so
lib${PROGRAM}.so: ${OBJECT_FILES} # create a dep for your .so to all object files
${CC} ${SHARED_FLAGS} -o lib${PROGRAM}.so ${OBJECT_FILES}
%.o: %.c # generic rule to build .o from .c
$(CC) -c -o $@ $< $(MY_CFLAGS)
${OBJECT_FILES} has to contain src/file1.o if file1.c is located in src/
The generic rule needs the .o in the same directory as the .c-file.