PRODUCT : Borland C++ NUMBER : 1542 VERSION : All OS : All DATE : October 25, 1993 PAGE : 1/2 TITLE : Makefiles with paths for implicit rules # Makefiles with Paths for Implicit Rules # # (This document is in correction to the documentation in the # book on paths in makefiles, which happens to be incorrect. # See the example below for the mistake) # # Suppose we want a makefile which will pull in source files # from different directories, and put the output into specific # output directories. We could make explicit rules for each and # every source file/object file pair, but there's an easier way # to do it. # # In this example, we want to have our source files in two # directories, \source and \source2 (perhaps because the .CPP # files in \source are going to be used in other projects as # well.). All the output is going to be going to a different # directory, \output. # SOURCE=\source SOURCE2=\source2 OUTPUT=\output LIBDIR=D:\BC31\LIB OBJS=$(OUTPUT)\test.obj $(OUTPUT)\test2.obj # This rule says, to make an OBJ in \output directory, look for a # .cpp file in \source {$(SOURCE)\}.cpp{$(OUTPUT)\}.obj: # In the docs, ^ this is shown as having an extra '.' here. # See BC++ "Tools and Utilities Guide" p. 26. bcc -c -ml -n$(OUTPUT) {$< } # This rule says, to make an OBJ in \output directory, look for a # .cpp file in \source2 {$(SOURCE2)\}.cpp{$(OUTPUT)\}.obj: bcc -c -ml -n$(OUTPUT) {$< } # This rule, being the first explicit rule, specifies the final # target, an EXE in \output made from OBJ's in \output PRODUCT : Borland C++ NUMBER : 1542 VERSION : All OS : All DATE : October 25, 1993 PAGE : 2/2 TITLE : Makefiles with paths for implicit rules $(OUTPUT)\test.exe: $(OBJS) tlink -L$(LIBDIR) c0l.obj $(OBJS), $*, $*, emu mathl cl # If you're experiencing troubles with MAKE after this, you can # always use the -m and the -p options with MAKE to see how MAKE # is interpreting your makefile. # # Note that if you have a single directory for your .CPP files # and a single (but different) directory for your .OBJ files, # you can use the .path.cpp and .path.obj directives instead. # DISCLAIMER: You have the right to use this technical information subject to the terms of the No-Nonsense License Statement that you received with the Borland product to which this information pertains.