It's all I need?
No.
I was not sure whether to establish dependencies between the .o and .h files
As a rule, you should, especially if you use custom data types (and even if not: changing the signature of the function can violate the entire program if the ABI / call conventions on your platform consist of black magic).
The template I use is usually:
CC = gcc LD = $(CC) CFLAGS = -c -Wall LDFLAGS = -lwhatever -lfoo -lbar TARGET = myprog OBJECTS = $(patsubst %.c, %.o, $(wildcard *.c)) all: $(TARGET) $(TARGET): $(OBJECTS) $(LD) $(LDFLAGS) -o $@ $^ %.c: %.h %.o: %.c $(CC) $(CFLAGS) -o $@ $^
user529758
source share