I am trying to write my first program using "proper" multiple source files. I have (so far) a main program file, and a function file. I have checked several sources for help with this, and I can't make sense of any of them. I know the make file needs to list "targets" to create and "dependencies" that those targets depend on, but I don't know what that means.

For example, I have these files:
main.c - (contains only the main() function)funcs.c - (contains lots of functions, some called from main, some called from other functions within funcs.c)

I should also make header files, but I am confused as to what they should contain, other than something like this:


(function prototypes)

Should I include the funcs.h file in both the main.c and funcs.c files? If so, should the makefile look like this?

main: main.o funcs.o
gcc main.o funcs.o -o main

main.o: main.c funcs.h
gcc -c main.c

funcs.o: funcs.c funcs.h
gcc -c funcs.c