#------------------------------------------------------------- -*- makefile -*-
#
# Makefile for tcludp
#
# Basic build, test and install
#   nmake /f makefile.vc INSTALLDIR=c:\tcl
#   nmake /f makefile.vc INSTALLDIR=c:\tcl test
#   nmake /f makefile.vc INSTALLDIR=c:\tcl install
#
# For other build options (debug, static etc.),
# See TIP 477 (https://core.tcl.tk/tips/doc/trunk/tip/477.md) for
# detailed documentation.
# 
# See the file "license.terms" for information on usage and redistribution
# of this file, and for a DISCLAIMER OF ALL WARRANTIES.
#
PROJECT = tclcsv

GENERICDIR = ..\src
LIBDIR     = ..\src

!include "rules-ext.vc"

PRJ_OBJS = \
	$(TMP_DIR)\tclcsv.obj  \
	$(TMP_DIR)\csv.obj  

PRJ_DEFINES = -D_CRT_SECURE_NO_WARNINGS

# We do not use the standard predefined install targets because we want
# to load binaries from platform-specific subdirectories of the package
# directory.
DISABLE_TARGET_install = 1
!include "$(_RULESDIR)\targets.vc"

# Override binary installation directory
!if "$(ARCH)" == "AMD64"
BIN_INSTALL_DIR = $(SCRIPT_INSTALL_DIR)\win32-x86_64
!else
BIN_INSTALL_DIR = $(SCRIPT_INSTALL_DIR)\win32-ix86
!endif
install: pkgindex
	@echo Installing to '$(SCRIPT_INSTALL_DIR)'
	@if not exist "$(SCRIPT_INSTALL_DIR)" mkdir "$(SCRIPT_INSTALL_DIR)"
	@if not exist "$(BIN_INSTALL_DIR)" mkdir "$(BIN_INSTALL_DIR)"
	@$(CPY) $(PRJLIB) "$(BIN_INSTALL_DIR)" >NUL
	@$(CPY) $(LIBDIR)\*.tcl "$(SCRIPT_INSTALL_DIR)"
	@$(CPY) $(OUT_DIR)\pkgIndex.tcl "$(SCRIPT_INSTALL_DIR)"
	@$(CPY) $(DOCDIR)\README.md "$(SCRIPT_INSTALL_DIR)"
	@$(CPY) $(_ROOTDIR)\license.terms "$(SCRIPT_INSTALL_DIR)"

pkgindex: $(OUT_DIR)\pkgIndex.tcl
$(OUT_DIR)\pkgIndex.tcl: pkgIndex.tcl.template
	nmakehlp -s << pkgIndex.tcl.template > $(OUT_DIR)\pkgIndex.tcl
@PACKAGE_VERSION@    $(DOTVERSION)
@PACKAGE_NAME@       $(PRJ_PACKAGE_TCLNAME)
@PACKAGE_TCLNAME@    $(PRJ_PACKAGE_TCLNAME)
@PKG_LIB_FILE@       $(PRJLIBNAME)
<<


