I am new to makefiles and I am a bit stuck. I have two c source files called trade.c and report.c . They both depend on a file called acc.h. The acc.h file is composed of two other header files, users.h and resellers.h. I am wondering how you write the dependency of the two header files to the acc.h file. I have so far…
OBJECTS = trade.c report.c
CC = gcc
trading: $(OBJECTS)
$(CC) $(OBJECTS) -o trading
trade.o: trade.c accts.h
$(CC) -c trade.c
report.o: report.c accts.h
$(CC) -c report.c
Any help is greatly appreciated.
You have no other choice than to add all the header files in the dependency list for the object file, as follows.