Perhaps the fact that these changes con't naturally follow from the evolution of the code as it grows, which would show better why do we need all these extra tools at all. The simple code that he presented doesn't need them at all, and uses them in a wrong way (e.g. not having the header file included in both source files - the module that implements it, and the module that uses it; while not included in others who don't use it to show that they won't have to be recompiled).
Hi Barry - I've created a makefile based on yours. I think I have it right but what I'm finding is that if I make the executable, run it successfully, then touch the source file to update its time stamp, when I run make again it recreates the object file but does not update the executable. Here is a screen dump showing the results: [jcl@localhost inputDouble]$ ls -lt total 8 -rw-r--r-- 1 jcl jcl 217 Jan 19 14:51 inputDouble.c -rw-r--r-- 1 jcl jcl 530 Jan 19 14:51 makefile [jcl@localhost inputDouble]$ make gcc -g -c -MMD -MP -o inputDouble.o inputDouble.c gcc -o inputDouble inputDouble.o [jcl@localhost inputDouble]$ ls -lt total 44 -rwxr-xr-x 1 jcl jcl 20872 Jan 19 14:56 inputDouble* -rw-r--r-- 1 jcl jcl 29 Jan 19 14:56 inputDouble.d -rw-r--r-- 1 jcl jcl 4104 Jan 19 14:56 inputDouble.o -rw-r--r-- 1 jcl jcl 217 Jan 19 14:51 inputDouble.c -rw-r--r-- 1 jcl jcl 530 Jan 19 14:51 makefile [jcl@localhost inputDouble]$ touch inputDouble.c [jcl@localhost inputDouble]$ ls -lt total 44 -rw-r--r-- 1 jcl jcl 217 Jan 19 14:56 inputDouble.c -rwxr-xr-x 1 jcl jcl 20872 Jan 19 14:56 inputDouble* -rw-r--r-- 1 jcl jcl 29 Jan 19 14:56 inputDouble.d -rw-r--r-- 1 jcl jcl 4104 Jan 19 14:56 inputDouble.o -rw-r--r-- 1 jcl jcl 530 Jan 19 14:51 makefile [jcl@localhost inputDouble]$ make gcc -g -c -MMD -MP -o inputDouble.o inputDouble.c [jcl@localhost inputDouble]$ ls -lt total 44 -rw-r--r-- 1 jcl jcl 29 Jan 19 14:56 inputDouble.d -rw-r--r-- 1 jcl jcl 4104 Jan 19 14:56 inputDouble.o -rw-r--r-- 1 jcl jcl 217 Jan 19 14:56 inputDouble.c -rwxr-xr-x 1 jcl jcl 20872 Jan 19 14:56 inputDouble* -rw-r--r-- 1 jcl jcl 530 Jan 19 14:51 makefile [jcl@localhost inputDouble]$ Here is the makefile: APPNAME = inputDouble CC=gcc CFLAGS= -g OUTPUT_OPTION= -MMD -MP -o $@ SRCS=$(wildcard *.c) OBJS=$(SRCS:.c=.o) DEPS=$(SRCS:.c=.d) -include ${DEPS} $(APPNAME): $(OBJS) $(CC) -o $(APPNAME) $(OBJS) clean: rm -f *.o *.d $(APPNAME) Any suggestions will be much appreciated. - Thanks - Jim
Auto tools is the worst piece of software invented. Unintelligible, extremely hard to debug, and litters your directory was junk. Just use CMake, Meson, hand-written makefiles, or even zig