Example of compile-and-link operations

A makefile for building Server-Library sample programs is provided in %SYBASE%\%SYBASE_OCS%\sample\srvlib directory. An example fragment of makefile for compiling and linking a Windows 32-bit application is as follows:

############################################################################
#
# Microsoft makefile for building Sybase Open Server Samples for Windows
#
#############################################################################
MAKEFILE=MAKEFILE
!ifndef SYBASE
SYBASEHOME=c:\sybase
!else
SYBASEHOME=$(SYBASE)\$(SYBASE_OCS)
!endif

COMPILE_DEBUG = 1
# Compiler AND linker flags
!ifdef COMPILE_DEBUG
CFLAGS = /W3 /MD /nologo /Z7 /DWIN32
LFLAGS= /MAP /SUBSYSTEM:CONSOLE /DEBUG /DEBUGTYPE:cv
!else
CFLAGS = /W3 /MD /nologo /Od /DWIN32
LFLAGS= /MAP /SUBSYSTEM:CONSOLE
!endif
SYSLIBS = kernel32.lib advapi32.lib msvcrt.lib
SYBASELIBS = $(SYBASEHOME)\lib\libsybcs.lib $(SYBASEHOME)\lib\libsybct.lib
$(SYBASEHOME)\lib\libsybsrv.lib
BLKLIB = $(SYBASEHOME)\lib\libsybblk.lib
DBLIB = $(SYBASEHOME)\lib\libsybdb.lib
CTOSOBJ = args.obj attn.obj bulk.obj \
          connect.obj ctos.obj cursor.obj \
          dynamic.obj error.obj events.obj \
          language.obj mempool.obj options.obj \
          params.obj \
          rgproc.obj results.obj rpc.obj \
          send.obj shutdown.obj
all: lang fullpass ctos regproc ctwait version intlchar osintro multthrd secsrv
lang fullpass ctos regproc ctwait version intlchar osintro multthrd secsrv:
$*.exe
     @echo Sample '$*' was built
# The generalized how to make an .obj rule
.c.obj:
     cl /I. /I$(SYBASEHOME)\include $(CFLAGS) -Fo$@ -c $<
lang.exe: lang.obj utils.obj
     link $(LFLAGS) -out:$*.exe $*.obj utils.obj $(SYSLIBS) $(SYBASELIBS)
fullpass.exe: fullpass.obj utils.obj
     link $(LFLAGS) -out:$*.exe $*.obj utils.obj $(SYSLIBS) $(SYBASELIBS)
ctos.exe: $(CTOSOBJ)
... compile and link lines for each Client-Library sample program goes here ...
clean:

      -del *.obj 
      -del *.map 
      -del *.exe 
      -del *.err
/*

Note that in this example:

Refer to the appropriate compile-and-link Microsoft documentation for additional information.