add support for building ctlib on Windows

<[email protected]>
Newsgroups gmane.comp.db.tds.freetds
Message-ID <66607689AF9BB243B6C00BC05B4AFE6E0E27C363C4@LDNPCMMGMB05.INTRANET.BARCAPINT.COM>
NMakefile for Windows currently doesn't allow building ctlib. Here is a patch for that. This is useful for users of DBD-Sybase (the CPAN module) which has a dependency on ctlib.

This doesn't affect any of the existing targets (except for "clean"), so is backwards-compatible.
Thanks,
Sam

--- c:\temp\p4v\PRGDWM355382_qaperforce_1666\depot\QA\Toolbox\main.br\third_party_src\FreeTDS\src\Nmakefile#1                2013-12-10 16:42:31.000000000 +-0100
+++ c:\p4_ws\0toolbox\main.br\third_party_src\FreeTDS\src\Nmakefile            2013-12-10 18:22:24.000000000 +-0100
@@ -21,17 +21,19 @@
!ENDIF
 MKDIR = MD
MV = move /Y
 DBLIB_DIR        = src\dblib
+CTLIB_DIR        = src\ctlib
REPLACEMENTS_DIR = src\replacements
TDS_DIR          = src\tds
APPS_DIR         = src\apps
 DBLIB_OUT        = $(DBLIB_DIR)\$(PLATFORM)\$(CONFIGURATION)
+CTLIB_OUT        = $(CTLIB_DIR)\$(PLATFORM)\$(CONFIGURATION)
REPLACEMENTS_OUT = $(REPLACEMENTS_DIR)\$(PLATFORM)\$(CONFIGURATION)
TDS_OUT          = $(TDS_DIR)\$(PLATFORM)\$(CONFIGURATION)
APPS_OUT         = $(APPS_DIR)\$(PLATFORM)\$(CONFIGURATION)
 DBLIB_SRC =     $(DBLIB_DIR)\bcp.c \
                               $(DBLIB_DIR)\dblib.c \
@@ -32,18 +34,28 @@
REPLACEMENTS_OUT = $(REPLACEMENTS_DIR)\$(PLATFORM)\$(CONFIGURATION)
TDS_OUT          = $(TDS_DIR)\$(PLATFORM)\$(CONFIGURATION)
APPS_OUT         = $(APPS_DIR)\$(PLATFORM)\$(CONFIGURATION)
 DBLIB_SRC =     $(DBLIB_DIR)\bcp.c \
                               $(DBLIB_DIR)\dblib.c \
DBLIB_OBJ =     $(DBLIB_OUT)\bcp.obj \
                               $(DBLIB_OUT)\dblib.obj \
                               $(DBLIB_OUT)\dbopen.obj \
                               $(DBLIB_OUT)\dbutil.obj \
                               $(DBLIB_OUT)\rpc.obj \
                               $(DBLIB_OUT)\xact.obj
+
+CTLIB_SRC =    $(CTLIB_DIR)\blk.c \
+                             $(CTLIB_DIR)\cs.c \
+                             $(CTLIB_DIR)\ct.c \
+                             $(CTLIB_DIR)\ctutil.c
+
+CTLIB_OBJ =    $(CTLIB_OUT)\blk.obj \
+                             $(CTLIB_OUT)\cs.obj \
+                             $(CTLIB_OUT)\ct.obj \
+                             $(CTLIB_OUT)\ctutil.obj
 REPLACEMENTS_SRC = $(REPLACEMENTS_DIR)\asprintf.c \
                                               $(REPLACEMENTS_DIR)\basename.c \
                                               $(REPLACEMENTS_DIR)\fakepoll.c \
                                               $(REPLACEMENTS_DIR)\gettimeofday.c \
                                               $(REPLACEMENTS_DIR)\getopt.c \
@@ -49,18 +61,19 @@
 REPLACEMENTS_SRC = $(REPLACEMENTS_DIR)\asprintf.c \
                                               $(REPLACEMENTS_DIR)\basename.c \
                                               $(REPLACEMENTS_DIR)\fakepoll.c \
                                               $(REPLACEMENTS_DIR)\gettimeofday.c \
                                               $(REPLACEMENTS_DIR)\getopt.c \
                               $(APPS_OUT)\datacopy.exe \
                               $(APPS_OUT)\defncopy.exe \
                               $(APPS_OUT)\freebcp.exe \
                               $(APPS_OUT)\tsql.exe

 db-lib: $(DBLIB_OUT)\db-lib.lib
+libct: $(CTLIB_OUT)\libct.lib
 apps: $(DBLIB_OUT)\db-lib.lib $(APPS_EXE)
tsql: $(APPS_OUT)\tsql.exe
 bsqldb: $(APPS_OUT)\bsqldb.exe
help:
               @echo targets: db-lib, apps, tsql, bsqldb
@@ -155,29 +168,30 @@
 apps: $(DBLIB_OUT)\db-lib.lib $(APPS_EXE)
tsql: $(APPS_OUT)\tsql.exe
 bsqldb: $(APPS_OUT)\bsqldb.exe
help:
               @echo targets: db-lib, apps, tsql, bsqldb
               $(MAKE) -fNmakefile -nologo apps PLATFORM=win64 CONFIGURATION=release
 clean:
               @if "" equ "$(PLATFORM)"          PLATFORM not defined, see comments in Nmakefile >&2 && exit 1
               @if "" equ "$(CONFIGURATION)"             CONFIGURATION not defined, see comments in Nmakefile >&2 && exit 1
               if exist $(DBLIB_OUT)                     del /q $(DBLIB_OUT)\*.obj  $(DBLIB_OUT)\*.lib
+             if exist $(CTLIB_OUT)                     del /q $(CTLIB_OUT)\*.obj  $(CTLIB_OUT)\*.lib
                if exist $(REPLACEMENTS_OUT)                del /q $(REPLACEMENTS_OUT)\*.obj $(REPLACEMENTS_OUT)\*.lib
               if exist $(TDS_OUT)                         del /q $(TDS_OUT)\*.obj $(TDS_OUT)\*.lib
               if exist $(APPS_OUT)                      del /q $(APPS_OUT)\*.obj $(APPS_OUT)\*.exe
 clean-app:
               @if "" equ "$(PLATFORM)"          PLATFORM not defined, see comments in Nmakefile >&2 && exit 1
               @if "" equ "$(CONFIGURATION)"             CONFIGURATION not defined, see comments in Nmakefile >&2 && exit 1
               if exist $(APPS_OUT)                      del /q $(APPS_OUT)\*.obj $(APPS_OUT)\*.exe
 # Create output directories
-$(DBLIB_OUT) $(REPLACEMENTS_OUT) $(TDS_OUT) $(APPS_OUT):
+$(DBLIB_OUT) $(CTLIB_OUT) $(REPLACEMENTS_OUT) $(TDS_OUT) $(APPS_OUT):
               @echo creating output directory for configuration: "$(PLATFORM)|$(CONFIGURATION)"
               @if "" equ "$(PLATFORM)"          PLATFORM not defined, see comments in Nmakefile >&2 && exit 1
               @if "" equ "$(CONFIGURATION)"             CONFIGURATION not defined, see comments in Nmakefile >&2 && exit 1
               $(MKDIR) $@
 #
@@ -218,18 +232,23 @@
               @echo creating output directory for configuration: "$(PLATFORM)|$(CONFIGURATION)"
               @if "" equ "$(PLATFORM)"          PLATFORM not defined, see comments in Nmakefile >&2 && exit 1
               @if "" equ "$(CONFIGURATION)"             CONFIGURATION not defined, see comments in Nmakefile >&2 && exit 1
               $(MKDIR) $@
 #
               $(MV) [email protected] $@
!ENDIF
 GENERATED_FILES = include\tdsver.h src\tds\tds_types.h \
               src\tds\tds_willconvert.h src\tds\encodings.h src\tds\num_limits.h
+$(CTLIB_OUT)\libct.lib: $(GENERATED_FILES) $(CTLIB_OUT) $(CTLIB_OBJ) $(REPLACEMENTS_OUT)\replacements.lib $(TDS_OUT)\tds.lib
+             @echo building $@ >&2
+             lib -nologo -out:"$@"     $(CTLIB_OBJ) \
+                                                             $(REPLACEMENTS_OUT)\replacements.lib \
+                                                             $(TDS_OUT)\tds.lib
$(DBLIB_OUT)\db-lib.lib: $(GENERATED_FILES) $(DBLIB_OUT) $(DBLIB_OBJ) $(REPLACEMENTS_OUT)\replacements.lib $(TDS_OUT)\tds.lib
               @echo building $@ >&2
               lib -nologo -out:"$@"     $(DBLIB_OBJ) \
                                                               $(REPLACEMENTS_OUT)\replacements.lib \
                                                               $(TDS_OUT)\tds.lib
$(REPLACEMENTS_OUT)\replacements.lib: $(REPLACEMENTS_OUT) $(REPLACEMENTS_OBJ)
@@ -265,18 +284,39 @@
$(DBLIB_OUT)\db-lib.lib: $(GENERATED_FILES) $(DBLIB_OUT) $(DBLIB_OBJ) $(REPLACEMENTS_OUT)\replacements.lib $(TDS_OUT)\tds.lib
               @echo building $@ >&2
               lib -nologo -out:"$@"     $(DBLIB_OBJ) \
                                                               $(REPLACEMENTS_OUT)\replacements.lib \
                                                               $(TDS_OUT)\tds.lib
$(REPLACEMENTS_OUT)\replacements.lib: $(REPLACEMENTS_OUT) $(REPLACEMENTS_OBJ)
                                                               -Fd"$(DBLIB_OUT)\vc80.pdb" \
               $<
 {$(DBLIB_DIR)}.c{$(DBLIB_DIR)\x64\release}.obj::
               $(CC64) -c $(REL)              -Fo"$(DBLIB_OUT)\\" \
                                                               -Fd"$(DBLIB_OUT)\vc80.pdb" \
+             $<
+
+# ctlib
+{$(CTLIB_DIR)\}.c{$(CTLIB_DIR)\win32\debug}.obj::
+             $(CC32) -c $(DBG)            -Fo"$(CTLIB_OUT)\\" \
+                                                             -Fd"$(CTLIB_OUT)\vc80.pdb" \
+             $<
+
+{$(CTLIB_DIR)\}.c{$(CTLIB_DIR)\win32\release}.obj::
+             $(CC32) -c $(REL)              -Fo"$(CTLIB_OUT)\\" \
+                                                             -Fd"$(CTLIB_OUT)\vc80.pdb" \
+             $<
+
+{$(CTLIB_DIR)\}.c{$(CTLIB_DIR)\x64\debug}.obj::
+             $(CC64) -c $(DBG)            -Fo"$(CTLIB_OUT)\\" \
+                                                             -Fd"$(CTLIB_OUT)\vc80.pdb" \
+             $<
+
+{$(CTLIB_DIR)\}.c{$(CTLIB_DIR)\x64\release}.obj::
+             $(CC64) -c $(REL)              -Fo"$(CTLIB_OUT)\\" \
+                                                             -Fd"$(CTLIB_OUT)\vc80.pdb" \
               $<
 #
# replacements
#
{$(REPLACEMENTS_DIR)}.c{$(REPLACEMENTS_DIR)\win32\debug}.obj::

_______________________________________________

This message is for information purposes only, it is not a recommendation, advice, offer or solicitation to buy or sell a product or service nor an official confirmation of any transaction. It is directed at persons who are professionals and is not intended for retail customer use. Intended for recipient only. This message is subject to the terms at: www.barclays.com/emaildisclaimer.

For important disclosures, please see: www.barclays.com/salesandtradingdisclaimer regarding market commentary from Barclays Sales and/or Trading, who are active market participants; and in respect of Barclays Research, including disclosures relating to specific issuers, please see http://publicresearch.barclays.com.

_______________________________________________
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.