#------------------------------------------------------------- -*- makefile -*-
#
# Makefile for building the rtext Tcl extension.
#
# Basic build, test and install
#   nmake -f makefile.vc clean
#   nmake -f makefile.vc INSTALLDIR=c:\path\to\tcl
#   nmake -f makefile.vc INSTALLDIR=c:\path\to\tcl test
#   nmake -f makefile.vc INSTALLDIR=c:\path\to\tcl install
#
# For other build options (debug, static etc.),
# See TIP 477 (https://core.tcl-lang.org/tips/doc/main/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.
#
#------------------------------------------------------------------------------

# The name of the package
PROJECT = rtext

PROJECT_REQUIRES_TK = 1

!include "rules-ext.vc"

# Define the object files that make up the extension.
# TMP_DIR is the output directory defined by rules for object files.
PRJ_OBJS = \
	$(TMP_DIR)\tclrtext.obj \
	$(TMP_DIR)\tkBitField.obj \
	$(TMP_DIR)\tkIntSet.obj \
	$(TMP_DIR)\tkRangeList.obj \
	$(TMP_DIR)\tkText.obj \
	$(TMP_DIR)\tkTextBTree.obj \
	$(TMP_DIR)\tkTextDisp.obj \
	$(TMP_DIR)\tkTextImage.obj \
	$(TMP_DIR)\tkTextIndex.obj \
	$(TMP_DIR)\tkTextLineBreak.obj \
	$(TMP_DIR)\tkTextMark.obj \
	$(TMP_DIR)\tkTextTag.obj \
	$(TMP_DIR)\tkTextTagSet.obj \
	$(TMP_DIR)\tkTextUndo.obj \
	$(TMP_DIR)\tkTextWind.obj

# Define any additional compiler flags that might be required for the project
PRJ_DEFINES = -D_CRT_SECURE_NO_DEPRECATE -DBUILD_tk
PRJ_DEFINES = $(PRJ_DEFINES) -I$(TMP_DIR)

# Define the standard targets
!include "$(_RULESDIR)\targets.vc"

# We must define a pkgindex target that will create a pkgIndex.tcl
# file in the $(OUT_DIR) directory. We can just redirect to the
# default-pkgindex target for this extension.
pkgindex: default-pkgindex

$(ROOT)\manifest.uuid:
   copy $(WIN_DIR)\gitmanifest.in $(ROOT)\manifest.uuid
   git rev-parse HEAD >>$(ROOT)\manifest.uuid

$(TMP_DIR)\rtextUuid.h:	$(ROOT)\manifest.uuid
	copy $(WIN_DIR)\rtextUuid.h.in+$(ROOT)\manifest.uuid $(TMP_DIR)\rtextUuid.h

# The default install target only installs binaries and scripts so add
# an additional target for our documentation. Note this *adds* a target
# since no commands are listed after it. The original targets for
# install (from targets.vc) will remain.
install: default-install-docs-n

# Explicit dependency rules
$(GENERICDIR)\tclrtext.c : $(TMP_DIR)\rtextUuid.h
