%% "EXT-Pennington, Dale K" <[EMAIL PROTECTED]> writes: edk> Currently each subproj builds in its source directory and have make edk> files with object lists of
edk> OBJS = obj1.o obj2.o ,,, objn.o edk> That server as dependencies for the final exe, and targets for pattern edk> based build rules. edk> Not we can modify the OBJS to be edk> OBJDIR = ../../obj/subproj1 edk> OBJS = $(OBJDIR)/obj1.o $(OBJDIR)/obj2.o .... $(OBJDIR)/objn.o Why not just keep the original setting for users: > OBJS = obj1.o obj2.o ,,, objn.o Then add this (in a more global place): > OBJDIR = ../../obj/subproj1 > OBJS := $(addprefix $(OBJDIR)/,$(OBJS)) That's the way it's traditionally done. edk> But it would be better if we could just tell make that all .o are in edk> $(OBJDIR) even if they do not currently exist There's no way to do that. edk> I tried the vpath directory, but that only works if the .o already edk> exists. If it does not, they make the .o in the src directory, which is edk> not desired. VPATH is for finding SOURCE files, not TARGET files. It won't work (as you've discovered) for the latter. I have some info on this on my web site below. edk> One other alternative I could see is to monkey the implicit rule to edk> always build the .o in the OBJDIR directory something like edk> %.o : %.c edk> cc -o $(OBJDIR)/$(@F) -c $^ No, this is very bad. Lying to make will never turn out well in the end. -- ------------------------------------------------------------------------------- Paul D. Smith <[EMAIL PROTECTED]> Find some GNU make tips at: http://www.gnu.org http://make.paulandlesley.org "Please remain calm...I may be mad, but I am a professional." --Mad Scientist _______________________________________________ Help-make mailing list [email protected] http://lists.gnu.org/mailman/listinfo/help-make
