# Common include file for the supporting libraries like libjpeg.

# We do not want to use the built-in default install target as we
# need a custom one as described below.
DISABLE_TARGET_install = 1
!include "$(_RULESDIR)\targets.vc"

# Special install targets to install all DLL's into the main img directory
# When a component is build by itself, e.g. png, it will install into the
# directory named after the component. When installed through the "master"
# Img makefile, it installs in the Img directory. The Following takes
# care of the details.
!ifdef TKIMG_INSTALL_SUBDIR
IMG_INSTALL_DIR = $(_INSTALLDIR)\$(TKIMG_INSTALL_SUBDIR)
!else
IMG_INSTALL_DIR = $(SCRIPT_INSTALL_DIR)
!endif
install: $(OUT_DIR)\pkgIndex.tcl
	@echo Installing binaries to '$(IMG_INSTALL_DIR)'
	@if not exist "$(IMG_INSTALL_DIR)" mkdir "$(IMG_INSTALL_DIR)"
	@$(CPY) $(PRJLIB) "$(IMG_INSTALL_DIR)" >NUL
	@echo Installing stubs library to '$(IMG_INSTALL_DIR)'
	@if not exist "$(IMG_INSTALL_DIR)" mkdir "$(IMG_INSTALL_DIR)"
	@$(CPY) $(PRJSTUBLIB) "$(IMG_INSTALL_DIR)" >NUL
	@echo Installing libraries to '$(IMG_INSTALL_DIR)'
	@if exist $(LIBDIR) $(CPY) $(LIBDIR)\*.tcl "$(IMG_INSTALL_DIR)"
!ifdef TKIMG_INSTALL_SUBDIR
	@echo Adding package index to '$(IMG_INSTALL_DIR)\pkgIndex.tcl'
	@type $(OUT_DIR)\pkgIndex.tcl >> "$(IMG_INSTALL_DIR)\pkgIndex.tcl"
!else
	@echo Installing package index in '$(IMG_INSTALL_DIR)'
	@$(CPY) $(OUT_DIR)\pkgIndex.tcl $(IMG_INSTALL_DIR)
!endif

pkgindex: default-pkgindex