#------------------------------------------------------------- -*- makefile -*-
#
# Makefile
#
# Basic build, test and install
#   nmake /f makefile.vc INSTALLDIR=c:\tcl TCLDIR=c:\path\to\tcl\sources TKDIR=c:\path\to\tk\sources
#   nmake /f makefile.vc INSTALLDIR=c:\tcl test TCLDIR=c:\path\to\tcl\sources TKDIR=c:\path\to\tk\sources
#   nmake /f makefile.vc INSTALLDIR=c:\tcl install TCLDIR=c:\path\to\tcl\sources TKDIR=c:\path\to\tk\sources
# Note this extension needs both Tcl and Tk *source* to build.
#
# For other build options (debug, static etc.),
# See TIP 477 (https://core.tcl.tk/tips/doc/trunk/tip/477.md) for
# detailed documentation.
#
#------------------------------------------------------------------------------


PROJECT = pngtcl

NEED_TK_SOURCE = 1
NEED_TCL_SOURCE = 1
COMPATDIR = ..\..\compat\libpng
!include "..\..\win\rules-ext.vc"

PRJ_OBJS	=  \
		$(TMP_DIR)\pngtcl.obj \
		$(TMP_DIR)\pngtclStubInit.obj \
		$(TMP_DIR)\png.obj \
		$(TMP_DIR)\pngerror.obj \
		$(TMP_DIR)\pngmem.obj \
		$(TMP_DIR)\pngpread.obj \
		$(TMP_DIR)\pngread.obj \
		$(TMP_DIR)\pngrio.obj \
		$(TMP_DIR)\pngrtran.obj \
		$(TMP_DIR)\pngrutil.obj \
		$(TMP_DIR)\pngset.obj \
		$(TMP_DIR)\pngtrans.obj \
		$(TMP_DIR)\pngwio.obj \
		$(TMP_DIR)\pngwrite.obj \
		$(TMP_DIR)\pngwtran.obj \
		$(TMP_DIR)\pngwutil.obj \
		$(TMP_DIR)\pngget.obj \
		$(TMP_DIR)\pngtclStubLib.obj

PRJ_STUBOBJS = $(TMP_DIR)\pngtclStubLib.obj
PRJ_INCLUDES = $(PRJ_INCLUDES) -I"$(TMP_DIR)" -I..\..\zlib
PRJ_DEFINES  = $(PRJ_DEFINES) -D_CRT_SECURE_NO_DEPRECATE -DPNG_IMPEXP=MODULE_SCOPE -DPNG_EXTERN=MODULE_SCOPE

!if [echo ZLIB_VERSION = \> versions.vc] \
   || [nmakehlp -V ..\..\zlib\configure.ac ^[zlibtcl^] >> versions.vc]
!error Could not determine zlib base version.
!endif
!include versions.vc

PRJ_LIBS = $(PRJ_LIBS) "..\..\zlib\win\$(BUILDDIRTOP)\zlibtclstub$(ZLIB_VERSION:.=).lib"

!include "..\..\win\install-lib.vc"

$(PRJ_OBJS): $(TMP_DIR)\pnglibconf.h
$(TMP_DIR)\pnglibconf.h: $(COMPATDIR)\scripts\pnglibconf.h.prebuilt
	$(COPY) $** "$@"
