1###################################################################### 2# 3# XOTclSdbm Makefile for Visual C++ 4# 5###################################################################### 6 7# Be sure to adapt the "configs.vc" file in the toplevel directory 8# to your system settings. 9!include "..\..\..\win\configs.vc" 10 11BINROOT = . 12ROOT = .. 13NAMEPREFIX = lib 14NAME = xotclsdbm 15XOTCL_DIR = ..\..\.. 16GENERICDIR = . 17WINDIR = . 18 19###################################################################### 20 21!if $(DEBUG) 22TMPNAME = Debug 23DBGX = d 24!else 25TMPNAME = Release 26DBGX = 27!endif 28 29TMP_DIR = $(BINROOT)\$(TMPNAME) 30OUT_DIR = $(TMP_DIR) 31 32!if $(STATIC_BUILD) 33OUTNAME = $(NAMEPREFIX)$(NAME)$(XOTCL_VERSION)$(DBGX) 34TARGET = "$(OUT_DIR)\$(OUTNAME).lib" 35!else 36OUTNAME = $(NAMEPREFIX)$(NAME)$(XOTCL_VERSION)$(DBGX) 37IMPLIB = "$(OUT_DIR)\$(OUTNAME).lib" 38TARGET = "$(OUT_DIR)\$(OUTNAME).dll" 39!endif 40 41TCLSTUBLIB = "$(TCLROOT)\win\Release\tclstub$(TCL_VERSION).lib" 42TCLIMPLIB = "$(TCLROOT)\win\$(OUT_DIR)\tcl$(TCL_VERSION)$(DBGX).lib" 43TCLSH = "$(TCLROOT)\win\$(OUT_DIR)\tclsh$(TCL_VERSION)$(DBGX).exe" 44 45XOTCLSTUBLIB = "$(XOTCL_DIR)\win\Release\libxotclstub$(XOTCL_VERSION).lib" 46XOTCLIMPLIB = "$(XOTCL_DIR)\win\$(OUT_DIR)\libxotcl$(XOTCL_VERSION)$(DBGX).lib" 47 48LIB_INSTALL_DIR = $(INSTALLDIR)\lib 49BIN_INSTALL_DIR = $(INSTALLDIR)\bin 50SCRIPT_INSTALL_DIR = $(INSTALLDIR)\lib\xotcl$(XOTCL_VERSION) 51INCLUDE_INSTALL_DIR = $(INSTALLDIR)\include 52 53OBJS = $(TMP_DIR)\hash.obj \ 54 $(TMP_DIR)\pair.obj \ 55 $(TMP_DIR)\sdbm.obj \ 56 $(TMP_DIR)\xotclsdbm.obj \ 57!if $(STATIC_BUILD) == 0 58 $(TMP_DIR)\dllEntryPoint.obj 59!endif 60 61###################################################################### 62# Link flags 63###################################################################### 64 65!if $(DEBUG) 66ldebug = -debug:full -debugtype:cv -pdb:none 67!else 68ldebug = -release -opt:ref 69!endif 70 71# declarations common to all linker options 72lcommon = -nologo -link50compat -machine:$(MACHINE) 73 74LFLAGS = $(lcommon) -subsystem:windows -dll 75 76!if $(USE_TCL_STUBS) == 0 77LLIBS = $(TCLIMPLIB) $(XOTCLIMPLIB) 78!else 79### should be: 80### LLIBS = $(TCLSTUBLIB) $(XOTCLSTUBLIB) when xotcl stub lib is mature 81### LLIBS = $(TCLSTUBLIB) $(XOTCLIMPLIB) 82LLIBS = $(TCLSTUBLIB) $(XOTCLSTUBLIB) 83!endif 84 85###################################################################### 86# Compile flags 87###################################################################### 88 89!IF $(DEBUG) == 0 90!IF "$(MACHINE)" == "ALPHA" 91# MSVC on Alpha doesn't understand -Ot 92cdebug = -O2i 93!ELSE 94cdebug = -Ox 95!ENDIF 96!ELSE 97!if $(MSDEV_VER) < 6 98cdebug = -Zi -Od -WX 99!else 100cdebug = -ZI -Od -WX 101!endif 102!ENDIF 103 104!if $(STATIC_BUILD) 105cdll = 106!else 107cdll = -GD 108!endif 109 110# declarations common to all compiler options 111ccommon = -nologo -c -W3 -YX \ 112 113 114!if $(STATIC_BUILD) && $(NOMSVCRT) 115crt = -MT$(DBGX) 116!else 117crt = -MD$(DBGX) 118!endif 119 120INCLUDES = -I"$(TCLROOT)\generic" -I"$(XOTCL_DIR)\generic" 121 122DEFINES = -DBUILD_$(NAME) -DTCL_THREADS=1 \ 123 -DXOLIBPKG=$(INST_XOLIBPKG) \ 124 -DXOTCLVERSION=$(XOTCLVERSION) \ 125 -DPACKAGE_VERSION=$(XOTCLVERSION) \ 126 -DVERSION=$(XOTCLVERSION) \ 127 -DXOTCLPATCHLEVEL=$(XOTCLPATCHLEVEL) \ 128 -D__WIN32__ -DVISUAL_CC 129 130EXE_CFLAGS = $(ccommon) $(cdebug) $(crt) $(cdll) $(INCLUDES) $(DEFINES) 131 132!if $(USE_TCL_STUBS) 133#CFLAGS = $(EXE_CFLAGS) -DUSE_TCL_STUBS 134CFLAGS = $(EXE_CFLAGS) -DUSE_TCL_STUBS -DUSE_XOTCL_STUBS 135!else 136CFLAGS = $(EXE_CFLAGS) 137!endif 138 139###################################################################### 140# Project specific targets 141###################################################################### 142 143all : libs ./pkgIndex.tcl 144 145libs : setup $(TARGET) 146 copy $(TARGET) .. 147 148setup : 149 @$(vcvars) > nul 150 @if not exist $(TMP_DIR)\nul mkdir $(TMP_DIR) &\ 151 echo Created directory '$(TMP_DIR)' 152 @if not exist $(OUT_DIR)\nul mkdir $(OUT_DIR) &\ 153 echo Created directory '$(OUT_DIR)' 154 155$(TARGET) : $(OBJS) 156!if $(STATIC_BUILD) 157 $(lib32) -nologo -machine:$(MACHINE) -out:$@ @<< 158!else 159 $(link32) $(LFLAGS) -base:@$(XOTCL_DIR)\win\dllBase.txt,$@ -out:$@ $(LLIBS) @<< 160!endif 161 $(OBJS) 162<< 163 164./pkgIndex.tcl : $(TARGET) 165 echo package ifneeded xotcl::store::sdbm $(XOTCL_VERSION) [list load [file join $$dir $(TMPNAME)/$(OUTNAME).dll]] > \ 166 ".\pkgIndex.tcl" 167 168install : all 169 if not exist "$(INSTALLDIR)" mkdir "$(INSTALLDIR)" 170 if not exist "$(BIN_INSTALL_DIR)" mkdir "$(BIN_INSTALL_DIR)" 171 if not exist "$(LIB_INSTALL_DIR)" mkdir "$(LIB_INSTALL_DIR)" 172 if not exist "$(SCRIPT_INSTALL_DIR)" mkdir "$(SCRIPT_INSTALL_DIR)" 173 if not exist "$(INCLUDE_INSTALL_DIR)" mkdir "$(INCLUDE_INSTALL_DIR)" 174 copy $(TARGET) "$(SCRIPT_INSTALL_DIR)" 175 176###################################################################### 177# Inference rules. Use batch-mode when supported. 178###################################################################### 179 180!if $(_NMAKE_VER) < 162 181{$(WINDIR)}.c{$(TMP_DIR)}.obj : 182!else 183{$(WINDIR)}.c{$(TMP_DIR)}.obj :: 184!endif 185 $(cc32) -DDLL_BUILD $(CFLAGS) -Fo$(TMP_DIR)\ @<< 186$< 187<< 188 189!if $(_NMAKE_VER) < 162 190{$(GENERICDIR)}.c{$(TMP_DIR)}.obj : 191!else 192{$(GENERICDIR)}.c{$(TMP_DIR)}.obj :: 193!endif 194 $(cc32) -DDLL_BUILD $(CFLAGS) -Fo$(TMP_DIR)\ @<< 195$< 196<< 197 198#{$(RCDIR)}.rc{$(TMP_DIR)}.res : 199# $(rc32) -fo $@ -DDEBUG=$(DEBUG) $(XOTCL_VERSION_DEFINES) $(XOTCL_INCLUDES) $(TCL_INCLUDES) $(XOTCL_DEFINES) $< 200 201###################################################################### 202# Clean up 203###################################################################### 204 205tidy : 206 -del $(TMP_DIR)\*.pch 207 -del $(TMP_DIR)\*.obj 208 -del $(TMP_DIR)\*.res 209 -del .\*.pch 210 -del .\*.pdb 211 212clean : tidy 213 -del $(OUT_DIR)\*.exp 214 -del $(OUT_DIR)\*.lib 215 -del $(OUT_DIR)\*.dll 216 -del $(OUT_DIR)\*.tcl 217 -del ..\*.exp 218 -del ..\*.lib 219 -del ..\*.dll 220 221distclean : clean 222 -rmdir $(OUT_DIR) 223 -rmdir $(TMP_DIR) 224 225