Hello, I'm starting to learn make and I have some questions...
The following are my files and their dependencies:
main.c ---> depends on Menu.c Student.c List.c
Menu.c----> depends on Student.c List.c
Student.c--->depends on Menu.c
List.c ---> depends on nothing
my question is how do I create my makefile given the scenario?
This is what I came up with
Code:
SAS: main.o Menu.o List.o Student.o
gcc main.o Menu.o List.o Student.o -o SAS
main.o: Menu.h Menu.c Student.h Student.c List.h List.c
gcc ??????????????
Menu.o: Menu.h Menu.c Student.h Student.c List.h List.c
gcc ????????????????
Student.o: Student.h Student.c Menu.h Menu.c
gcc ?????????????????
List.o: List.c List.h
gcc List.c -o List.o
I'm a bit confused on the command I have to issue to compile the objects...
should it be like:
gcc Menu.c Student.c List.c -o main.o
gcc Menu.c Student.c List.c -o Menu.o
gcc Student.c Menu.c -o Student.o
???
I think it would work but I feel I'm missing something... reason is I don't think it utilizes the purpose of make in the first place..... or is this a problem with my dependencies itself?
thanks hope you can give me some advice