#############################################################################
#
#                   Copyright (C) 1999 SciTech Software
#                           All rights reserved.
#
# Descripton:   Generic makefile for libpng library.
#
#############################################################################

#----------------------------------------------------------------------------
# Define the list of object files
#----------------------------------------------------------------------------

# Objects for building Binary Portable DLL
DLL_OBJS        = dllstart$O pnginit$O

# PNG library sources
PNG_OBJS        = png$O pngset$O pngget$O pngrutil$O pngtrans$O pngwutil$O \
                  pngmem$O pngpread$O pngread$O pngerror$O pngwrite$O \
                  pngrtran$O pngwtran$O pngrio$O pngwio$O

# ZLIB library sources
ZLIB_OBJS       = adler32$O compress$O crc32$O uncompr$O deflate$O \
                  trees$O zutil$O inflate$O infblock$O inftrees$O \
                  infcodes$O infutil$O inffast$O

# These objectfiles are included in png.lib
OBJECTS         = $(PNG_OBJS) $(ZLIB_OBJS)

CFLAGS          += -I..\zlib
.IF $(BUILD_DLL)
CFLAGS          += -I$(PRIVATE)\include\drvlib -I$(SCITECH)\include\drvlib -D__DRIVER__
ASFLAGS         += -d__DRIVER__
EXELIBS         = drvlib$L
.ELSE

# When compiling as a static link library we need to compile in the default
# error handler that most applications expect. If we don't do this, the
# jmpbuf structure (which is compiler runtime library dependant in size)
# will be *different* and will cause the library to work incorrectly. This
# is bad design IMHO for the PNG library since the interface is not
# binary portable.

CFLAGS          += -DPNG_USE_DEFAULT_ERROR_HANDLER
LIBFILE         = $(LP)png$L
LIBCLEAN        = *.dll *.lib *.a
.ENDIF

#----------------------------------------------------------------------------
# Target to build the Binary Portable DLL target
#----------------------------------------------------------------------------

png.dll: $(DLL_OBJS) $(OBJECTS)

#----------------------------------------------------------------------------
# Target to build all Intel binary drivers
#----------------------------------------------------------------------------

.PHONY mkdrv:
    @build wc11-w32 png.dll -u BUILD_DLL=1 NO_RUNTIME=1 OPT=1
    @$(CP) png.dll $(SCITECH)\drivers\png.bpd
    @dmake cleanexe

.PHONY db:
    @build wc11-w32 png.dll BUILD_DLL=1 NO_RUNTIME=1 OPT=1
    @$(CP) png.dll $(SCITECH)\drivers\png.bpd

#----------------------------------------------------------------------------
# Define the list of object files to create dependency information for
#----------------------------------------------------------------------------

DEPEND_OBJ      = $(OBJECTS)
DEPEND_SRC      := ../zlib;$(PRIVATE)/src/common
.SOURCE:           ../zlib $(PRIVATE)/src/common

.INCLUDE: "$(SCITECH)/makedefs/common.mk"
