The following example shows a makefile for compiling and linking a Windows 32-bit application:
############################################################################## Microsoft makefile for building Sybase Open Server Samples for Windows NT##############################################################################MAKEFILE=MAKEFILE!ifndef SYBASE
YBASEHOME=c:\sybase
!else
YBASEHOME=$(SYBASE)\$(SYBASE_OCS)
!endifCOMPILE_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
!endifSYSLIBS = kernel32.lib advapi32.lib msvcrt.lib
SYBASELIBS = $(SYBASEHOME)\lib\libcs.lib $(SYBASEHOME)\lib\libct.lib $(SYBASEHOME)\lib\libsrv.lib
BLKLIB = $(SYBASEHOME)\lib\libblk.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.objall: lang fullpass ctos regproc ctwait version intlchar osintro multthrd secsrvlang 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)
link $(LFLAGS) -out:$*.exe $(CTOSOBJ) $(SYSLIBS) $(SYBASELIBS) $(BLKLIB) regproc.exe: regproc.obj utils.obj
link $(LFLAGS) -out:$*.exe $*.obj utils.obj $(SYSLIBS) $(SYBASELIBS)ctwait.exe: ctwait.obj ctutils.obj
link $(LFLAGS) -out:$*.exe $*.obj ctutils.obj $(SYSLIBS) $(SYBASELIBS)version.exe: version.obj ctutils.obj
link $(LFLAGS) -out:$*.exe $*.obj ctutils.obj $(SYSLIBS) $(SYBASELIBS)intlchar.exe: intlchar.obj utils.obj
link $(LFLAGS) -out:$*.exe $*.obj utils.obj
$(SYSLIBS) $(SYBASELIBS)osintro.exe: osintro.obj utils.obj
link $(LFLAGS) -out:$*.exe $*.obj utils.obj $(SYSLIBS) $(SYBASELIBS)multthrd.exe: multthrd.obj utils.obj
link $(LFLAGS) -out:$*.exe $*.obj utils.obj $(SYSLIBS) $(SYBASELIBS)
secsrv.exe: secsrv.obj utils.obj secargs.obj
link $(LFLAGS) -out:$*.exe $*.obj utils.obj secargs.obj $(SYSLIBS) $(SYBASELIBS)
clean: -del *.obj
-del *.map
-del *.exe
-del *.err/*
Note that in this example:
INTEL libraries are represented.
Sybase libraries are made for Win32 applications.
SUBSYSTEM:CONSOLE indicates that this is a console application.
Refer to the appropriate compile-and-link Microsoft documentation for additional information.