# Microsoft Visual C++ # (C) Copyright David Abrahams 2001. Permission to copy, use, # modify, sell and distribute this software is granted provided this # copyright notice appears in all copies. This software is provided # "as is" without express or implied warranty, and with no claim as # to its suitability for any purpose. # compute MSVC tool path # You can either put the msvc bin directory in your PATH, or you can set # MSVCDir to point at the msvc installation directory MSVC_TOOL_PATH = $(MSVCDir)$(SLASH)bin$(SLASH) ; MSVC_TOOL_PATH ?= "" ; # Don't clobber adjoining text if MSVCDir isn't set flags msvc CFLAGS on : /Zi ; flags msvc LINKFLAGS on : /DEBUG ; flags msvc CFLAGS off : /Od ; flags msvc CFLAGS speed : /O2 ; flags msvc CFLAGS space : /O1 ; flags msvc CFLAGS off : /Ob0 ; flags msvc CFLAGS on : /Ob1 ; flags msvc CFLAGS full : /Ob2 ; flags msvc CFLAGS on : /GX ; flags msvc CFLAGS on : /GR ; # Note that these two options actually imply multithreading support on MSVC # because there is no single-threaded dynamic runtime library. Specifying # multi would be a bad idea, though, because no option would be # matched when the build uses the default settings of dynamic # and single. flags msvc CFLAGS release/dynamic : /MD ; flags msvc CFLAGS debug/dynamic : /MDd ; flags msvc CFLAGS release/static/single : /ML ; flags msvc CFLAGS debug/static/single : /MLd ; flags msvc CFLAGS release/static/multi : /MT ; flags msvc CFLAGS debug/static/multi : /MTd ; flags msvc DEFINES ; flags msvc UNDEFS ; flags msvc HDRS ; flags msvc STDHDRS : $(MSVCDir)$(SLASH)include ; flags msvc STDLIBPATH : $(MSVCDir)$(SLASH)lib ; flags msvc LIBPATH ; flags msvc NEEDLIBS ; flags msvc NEEDLIBS ; flags msvc LINKFLAGS DLL : /DLL ; #### Link #### rule Link-action { msvc-Link-action $(<) : $(>) ; } actions msvc-Link-action bind NEEDLIBS { $(MSVC_TOOL_PATH)link /nologo $(LINKFLAGS) /PDB:"$(<[1]:S=.pdb)" /out:"$(<[1])" $(UNDEFS) /LIBPATH:$(LIBPATH) /LIBPATH:$(STDLIBPATH) $(NEEDLIBS) "$(>)" } #### Cc ##### rule Cc-action { msvc-Cc-action $(<) : $(>) ; } actions msvc-Cc-action { $(MSVC_TOOL_PATH)cl /Zm400 -nologo -c -U$(UNDEFS) -D$(DEFINES) $(CFLAGS) -I"$(HDRS)" -I"$(STDHDRS)" -Fo"$(<)" "$(>)" } #### C++ #### rule C++-action { msvc-C++-action $(<) : $(>) ; } actions msvc-C++-action { $(MSVC_TOOL_PATH)cl /Zm400 -nologo -GX -c -U$(UNDEFS) -D$(DEFINES) $(CFLAGS) $(C++FLAGS) -I"$(HDRS)" -I"$(STDHDRS)" -Fo"$(<)" -Tp"$(>)" } #### Archive #### rule Archive-action { msvc-Archive-action $(<) : $(>) ; } actions updated together piecemeal msvc-Archive-action { if exist "$(<)" set _$(<:B)_="$(<)" $(MSVC_TOOL_PATH)link /lib /out:"$(<)" %_$(<:B)_% "$(>)" }