###################################################################### # Visual C++ 5.0+ makefile for [Incr Tcl] # # See the file "license.terms" for information on usage and redistribution # of this file, and for a DISCLAIMER OF ALL WARRANTIES. # # Copyright (c) 1993-1998 Lucent Technologies, Inc. # RCS: $Id$ ###################################################################### # All needed information is derived from running vcvars32.bat # # NOTE: Be sure to modify the "config.vc" file in the toplevel directory # before running this makefile. ###################################################################### # Do not modify this file! modify config.vc to effect the build. ###################################################################### !include "..\..\rules.vc" !include "..\..\config.vc" !include "..\..\pkg.vc" BINROOT = . ROOT = .. ITCLDIR = ..\..\itcl ITKNAMEPREFIX = itk STUBPREFIX = $(ITKNAMEPREFIX)stub !if $(DEBUG) TMPNAME = Debug DBGX = d !else TMPNAME = Release DBGX = !endif TMP_DIR = $(BINROOT)\$(TMPNAME) !ifndef OUT_DIR OUT_DIR = $(TMP_DIR) !endif !if $(STATIC_BUILD) ITKOUTNAME = $(ITKNAMEPREFIX)$(ITK_VERSION)s$(DBGX) ITKTARGET = "$(OUT_DIR)\$(ITKOUTNAME).lib" !else ITKOUTNAME = $(ITKNAMEPREFIX)$(ITK_VERSION)$(DBGX) ITKIMPLIB = "$(OUT_DIR)\$(ITKOUTNAME).lib" ITKTARGET = "$(OUT_DIR)\$(ITKOUTNAME).dll" !endif !if $(ISTCLINSTALL) TCLSTUBLIB = "$(TCLROOT)\lib\tclstub$(TCL_VERSION).lib" TKSTUBLIB = "$(TCLROOT)\lib\tkstub$(TCL_VERSION).lib" TCLIMPLIB = "$(TCLROOT)\lib\tcl$(TCL_VERSION)$(DBGX).lib" TKIMPLIB = "$(TCLROOT)\lib\tk$(TCL_VERSION)$(DBGX).lib" TCLSH = "$(TCLROOT)\bin\tclsh$(TCL_VERSION)$(DBGX).exe" WISH = "$(TCLROOT)\bin\wish$(TCL_VERSION)$(DBGX).exe" !else TCLSTUBLIB = "$(TCLROOT)\win\Release\tclstub$(TCL_VERSION).lib" TKSTUBLIB = "$(TKROOT)\win\Release\tkstub$(TCL_VERSION).lib" TCLIMPLIB = "$(TCLROOT)\win\$(OUT_DIR)\tcl$(TCL_VERSION)$(DBGX).lib" TKIMPLIB = "$(TKROOT)\win\$(OUT_DIR)\tk$(TCL_VERSION)$(DBGX).lib" TCLSH = "$(TCLROOT)\win\$(OUT_DIR)\tclsh$(TCL_VERSION)$(DBGX).exe" WISH = "$(TCLROOT)\win\$(OUT_DIR)\wish$(TCL_VERSION)$(DBGX).exe" !endif ITCLSTUBLIBNAME = itclstub$(ITCL_VERSION).lib ITCLSTUBLIB = "$(ITCLDIR)\win\Release\$(ITCLSTUBLIBNAME)" ITKSTUBLIBNAME = $(STUBPREFIX)$(ITK_VERSION).lib ITKSTUBLIB = "$(OUT_DIR)\$(ITKSTUBLIBNAME)" LIB_INSTALL_DIR = $(INSTALLDIR)\lib BIN_INSTALL_DIR = $(INSTALLDIR)\bin SCRIPT_INSTALL_DIR = $(INSTALLDIR)\lib\itk$(ITK_DOTVERSION) INCLUDE_INSTALL_DIR = $(INSTALLDIR)\include ITKOBJS = \ $(TMP_DIR)\itk_archetype.obj \ $(TMP_DIR)\itk_cmds.obj \ $(TMP_DIR)\itk_option.obj \ $(TMP_DIR)\itk_util.obj \ !if $(STATIC_BUILD) == 0 $(TMP_DIR)\dllEntryPoint.obj \ $(TMP_DIR)\dllResource.obj \ !endif $(TMP_DIR)\itkStubInit.obj ITKSTUBOBJS = \ $(TMP_DIR)\itkStubLib.obj WINDIR = $(ROOT)\win GENERICDIR = $(ROOT)\generic RCDIR = $(ROOT)\win\rc ###################################################################### # Link flags ###################################################################### !if $(DEBUG) ldebug = -debug:full -debugtype:cv -pdb:none !else ldebug = -release -opt:ref !endif # declarations common to all linker options lcommon = -nologo -link50compat -machine:$(MACHINE) ITK_LFLAGS = $(lcommon) -subsystem:windows -dll !if $(USE_TCL_STUBS) ITK_LLIBS = $(TCLSTUBLIB) $(TKSTUBLIB) $(ITCLSTUBLIB) !else ITK_LLIBS = $(TCLIMPLIB) $(TKIMPLIB) $(ITCLIMPLIB) !endif ###################################################################### # Compile flags ###################################################################### !if $(DEBUG) == 0 !if "$(MACHINE)" == "ALPHA" # MSVC on Alpha doesn't understand -Ot cdebug = -O2i !else cdebug = -Ox !endif !else !if $(MSDEV_VER) < 6 cdebug = -Zi -Od -WX !else cdebug = -ZI -Od -WX !endif !endif !if $(STATIC_BUILD) cdll = !else cdll = -GD !endif # declarations common to all compiler options ccommon = -nologo -c -W3 -YX -Fp$(TMP_DIR)\ !if $(STATIC_BUILD) && $(NOMSVCRT) crt = -MT$(DBGX) !else crt = -MD$(DBGX) !endif !if $(ISTCLINSTALL) TCL_INCLUDES = -I"$(TCLROOT)\include" TK_INCLUDES = !else TCL_INCLUDES = -I"$(TCLROOT)\generic" TK_INCLUDES = -I"$(TKROOT)\generic" -I"$(TKROOT)\xlib" !endif ITK_INCLUDES = -I$(WINDIR) -I$(GENERICDIR) ITCL_INCLUDES = -I"$(ITCLDIR)\generic" ITK_DEFINES = -DBUILD_itk -DTCL_THREADS=1 ITK_EXE_CFLAGS = $(ccommon) $(cdebug) $(crt) $(cdll) $(ITCL_INCLUDES) $(ITK_INCLUDES) \ $(TCL_INCLUDES) $(TK_INCLUDES) $(ITK_DEFINES) !if $(USE_TCL_STUBS) ITK_CFLAGS = $(ITK_EXE_CFLAGS) -DUSE_TCL_STUBS -DUSE_TK_STUBS -DUSE_ITCL_STUBS !else ITK_CFLAGS = $(ITK_EXE_CFLAGS) !endif ###################################################################### # Project specific targets ###################################################################### all : setup $(ITKTARGET) $(ITKSTUBLIB) release : setup $(ITKTARGET) $(ITKSTUBLIB) test: setup $(ITKDLL) $(ITKSTUBLIB) $(ITKWISH) -@copy $(TCLDLL) $(TMPDIR) -@copy $(TKDLL) $(TMPDIR) -@copy $(ITCLDLL) $(TMPDIR) # $(ITKWISH) setup : @$(vcvars) > nul @if not exist $(TMP_DIR)\nul mkdir $(TMP_DIR) &\ echo Created directory '$(TMP_DIR)' @if not exist $(OUT_DIR)\nul mkdir $(OUT_DIR) &\ echo Created directory '$(OUT_DIR)' $(ITKTARGET): $(ITKOBJS) !if $(STATIC_BUILD) $(lib32) -nologo -machine:$(MACHINE) -out:$@ @<< !else $(link32) $(ITK_LFLAGS) -out:$@ $(ITK_LLIBS) @<< !endif $(ITKOBJS) << !if $(DEBUG) == 0 $(ITKSTUBLIB) : $(ITKSTUBOBJS) $(lib32) -nologo -out:$@ $(ITKSTUBOBJS) !else $(ITKSTUBLIB) : !endif install: all if not exist "$(INSTALLDIR)" mkdir "$(INSTALLDIR)" if not exist "$(BIN_INSTALL_DIR)" mkdir "$(BIN_INSTALL_DIR)" if not exist "$(LIB_INSTALL_DIR)" mkdir "$(LIB_INSTALL_DIR)" if not exist "$(SCRIPT_INSTALL_DIR)" mkdir "$(SCRIPT_INSTALL_DIR)" if not exist "$(INCLUDE_INSTALL_DIR)" mkdir "$(INCLUDE_INSTALL_DIR)" copy $(ITKTARGET) "$(SCRIPT_INSTALL_DIR)" copy $(ITKSTUBLIB) "$(LIB_INSTALL_DIR)" copy $(ROOT)\generic\itk.h "$(INCLUDE_INSTALL_DIR)" copy $(ROOT)\generic\itkDecls.h "$(INCLUDE_INSTALL_DIR)" copy $(ROOT)\library\*.* "$(SCRIPT_INSTALL_DIR)" echo package ifneeded Itk $(ITK_DOTVERSION) [list load [file join $$dir $(ITKOUTNAME).dll] Itk] > \ "$(SCRIPT_INSTALL_DIR)\pkgIndex.tcl" ###################################################################### # Regenerate the stubs files. ###################################################################### !if $(ISTCLINSTALL) == 0 # Only from the sources of Tcl does genStubs.tcl exist. genstubs: $(TCLSH) $(TCLROOT)\tools\genStubs.tcl $(GENERICDIR) \ $(GENERICDIR)\itk.decls !else genstubs: @echo ERROR: Can't rebuild stubs tables without the Tcl source distribution !endif ###################################################################### # Special case object file targets ###################################################################### # The following object is part of the stub library and should not # be built as DLL objects but none of the symbols should be exported $(TMP_DIR)\itkStubLib.obj : $(GENERICDIR)\itkStubLib.c $(cc32) -DSTATIC_BUILD $(ITK_EXE_CFLAGS) -Zl -Fo$@ $? $(TMP_DIR)\dllResource.obj : $(TMP_DIR)\itk.res $(cvtres32) -nologo -machine:$(MACHINE) -out:$@ $? ###################################################################### # Inference rules. Use batch-mode when supported. ###################################################################### !if $(_NMAKE_VER) < 162 {$(WINDIR)}.c{$(TMP_DIR)}.obj : !else {$(WINDIR)}.c{$(TMP_DIR)}.obj :: !endif $(cc32) -DDLL_BUILD $(ITK_CFLAGS) -Fo$(TMP_DIR)\ @<< $< << !if $(_NMAKE_VER) < 162 {$(GENERICDIR)}.c{$(TMP_DIR)}.obj : !else {$(GENERICDIR)}.c{$(TMP_DIR)}.obj :: !endif $(cc32) -DDLL_BUILD $(ITK_CFLAGS) -Fo$(TMP_DIR)\ @<< $< << {$(RCDIR)}.rc{$(TMP_DIR)}.res : $(rc32) -fo $@ -DDEBUG=$(DEBUG) $(ITK_INCLUDES) $(TCL_INCLUDES) $(ITCL_INCLUDES) $(ITK_DEFINES) $< ###################################################################### # Clean up ###################################################################### tidy : -del $(TMP_DIR)\*.pch -del $(TMP_DIR)\*.obj -del $(TMP_DIR)\*.res clean : tidy -del $(OUT_DIR)\*.exp -del $(OUT_DIR)\*.lib -del $(OUT_DIR)\*.dll hose : clean -rmdir $(OUT_DIR) -rmdir $(TMP_DIR)