Hello subscribers, this is my Makefile:
CC=cc INC=-I. CFLAGS=-g -DDEBUG -std=gnu99 -DSFHASH -DDOMAIN LDFLAGS=-ldl OBJS=*.o OBJDIR=.obj BINDIR=.obj LIBDIR=.obj %.o: %.c $(CC) $(INC) $(CFLAGS) -DSFHASH -o $(OBJDIR)/$@ -c $< VPATH = .obj #vpath %.o $(OBJDIR) hashtest: hashfuncs.o hast.o scanners.o parseargs.o $(CC) -rdynamic -o $(BINDIR)/$@ $^ $(LDFLAGS) clean: @rm -f $(OBJDIR)/$(OBJS) $(BINDIR)/hashtest using it for the first time: make does not rewrite gcc's input file paths: @delphi# make clean @delphi# make cc -I. -g -DDEBUG -std=gnu99 -DSFHASH -DDOMAIN -DSFHASH -o .obj/hashfuncs.o -c hashfuncs.c cc -I. -g -DDEBUG -std=gnu99 -DSFHASH -DDOMAIN -DSFHASH -o .obj/hast.o -c hast.c cc -I. -g -DDEBUG -std=gnu99 -DSFHASH -DDOMAIN -DSFHASH -o .obj/scanners.o -c scanners.c cc -I. -g -DDEBUG -std=gnu99 -DSFHASH -DDOMAIN -DSFHASH -o .obj/parseargs.o -c parseargs.c cc -rdynamic -o .obj/hashtest hashfuncs.o hast.o scanners.o parseargs.o -ldl cc: error: hashfuncs.o: No such file or directory cc: error: hast.o: No such file or directory cc: error: scanners.o: No such file or directory cc: error: parseargs.o: No such file or directory make: *** [hashtest] Error 1 using it second time in a row, it does: @delphi# make cc -rdynamic -o .obj/hashtest .obj/hashfuncs.o .obj/hast.o .obj/scanners.o .obj/parseargs.o -ldl @delphi# GNU Make manual says: The value of the make variable VPATH specifies a list of directories that make should search. Most often, the directories are expected to contain prerequisite files that are not in the current directory; however, **make uses VPATH as a search list for both prerequisites and** **targets of rules**. I was expecting either to work for the first time or not work for the second time. The target's dependencies generated at runtime are found aok, why isn't $^ properly expanded? Thank you, Adrian _______________________________________________ Help-make mailing list Help-make@gnu.org https://lists.gnu.org/mailman/listinfo/help-make