Sample makefile (UNIX)

The following makefile, make.unix, was used to create the dynamically linked shared library for the xp_echo program on UNIX platforms. It generates a file named examples.so on Solaris and Digital UNIX and examples.sl on HP. The source is in $SYBASE/$SYBASE_ASE/sample/esp, so you can modify it for your own use.

To build the example library using this makefile, enter:

make /f make.unix
#
# This makefile creates a shared library.  It needs the open
# server header
# files usually installed in $SYBASE/include directory.
# This make file can be used for generating the template ESPs.
# It references the following macros:
#
# PROGRAM is the name of the shared library you may want to create.
PROGRAM        = example.so
BINARY        = $(PROGRAM)
EXAMPLEDLL    = $(PROGRAM)

# Include path where ospublic.h etc reside. You may have them in 
# the standard places like /usr/lib etc.

INCLUDEPATH    = $(SYBASE)/include

# Place where the shared library will be generated.
DLLDIR        = .

RM        = /usr/bin/rm
ECHO        = echo
MODE        = normal

# Directory where the source code is kept.
SRCDIR        = .

# Where the objects will be generated.
OBJECTDIR    = .

OBJS        = xp_echo.o

CFLAGS        = -I$(INCLUDEPATH)
LDFLAGS        =  $(GLDFLAGS) -Bdynamic

DLLLDFLAGS    =  -dy -G

#================================================================
$(EXAMPLEDLL) : $(OBJS) 
    -@$(RM) -f $(DLLDIR)/$(EXAMPLEDLL)
    -@$(ECHO) "Loading $(EXAMPLEDLL)"
    -@$(ECHO) " "
    -@$(ECHO) "    MODE:           $(MODE)"
    -@$(ECHO) "    OBJS:           $(OBJS)"
    -@$(ECHO) "    DEBUGOBJS:      $(DEBUGOBJS)"
    -@$(ECHO) " "    

    cd $(OBJECTDIR); \
    ld -o $(DLLDIR)/$(EXAMPLEDLL) $(DEBUGOBJS) $(DLLLDFLAGS) $(OBJS) 
    -@$(ECHO) "$(EXAMPLEDLL) done"
    exit 0

#================================================================
$(OBJS) : $(SRCDIR)/xp_echo.c 
    cd $(SRCDIR); \
    $(CC) $(CFLAGS) -o $(OBJECTDIR)/$(OBJS) -c xp_echo.c