at [327d65db23]
EuroTcl/OpenACS 11 - 12 JULY 2024, VIENNA

File win/ artifact fd5740d97a part of check-in 327d65db23

# This file should only be included in makefiles for Tcl extensions,
# NOT in the makefile for Tcl itself.

!ifndef _RULES_EXT_VC

# We need to run from the directory the parent makefile is located in.
# nmake does not tell us what makefile was used to invoke it so parent
# makefile has to set the MAKEFILEVC macro or we just make a guess and
# warn if we think that is not the case.
!if "$(MAKEFILEVC)" == ""

!if exist("$(PROJECT).vc")
!elseif exist("")
!endif # "$(MAKEFILEVC)" == ""

!if !exist("$(MAKEFILEVC)")
MSG = ^
You must run nmake from the directory containing the project makefile.^
If you are doing that and getting this message, set the MAKEFILEVC^
macro to the name of the project makefile.
!message WARNING: $(MSG)

!if "$(PROJECT)" == "tcl"
!error The file is not intended for Tcl itself.

# We extract version numbers using the nmakehlp program. For now use
# the local copy of nmakehlp. Once we locate Tcl, we will use that
# one if it is newer.
!if "$(MACHINE)" == "IX86" || "$(MACHINE)" == "$(NATIVE_ARCH)"
!if [$(CC) -nologo -DNDEBUG "nmakehlp.c" -link -subsystem:console > nul]
!if [copy x86_64-w64-mingw32-nmakehlp.exe nmakehlp.exe >NUL]

# First locate the Tcl directory that we are working with.
!if "$(TCLDIR)" != ""



# If an installation path is specified, that is also the Tcl directory.
# Also Tk never builds against an installed Tcl, it needs Tcl sources
!if defined(INSTALLDIR) && "$(PROJECT)" != "tk"
# Locate Tcl sources
!if [echo _RULESDIR = \> nmakehlp.out] \
   || [nmakehlp -L generic\tcl.h >> nmakehlp.out]
_RULESDIR = ..\..\tcl
!include nmakehlp.out

!endif # defined(INSTALLDIR)....

!endif # ifndef TCLDIR

# Now look for the file under the Tcl root. Note we check this
# file and not because the latter also exists on older systems.
!if exist("$(_RULESDIR)\lib\nmake\") # Building against installed Tcl
_RULESDIR = $(_RULESDIR)\lib\nmake
!elseif exist("$(_RULESDIR)\win\")   # Building against Tcl sources
# If we have not located Tcl's targets file, most likely we are compiling
# against an older version of Tcl and so must use our own support files.

!if "$(_RULESDIR)" != "."
# Potentially using Tcl's support files. If this extension has its own
# nmake support files, need to compare the versions and pick newer.

!if exist("") # The extension has its own copy

!if [echo TCL_RULES_MAJOR = \>] \
   && [nmakehlp -V "$(_RULESDIR)\" RULES_VERSION_MAJOR >>]
!if [echo TCL_RULES_MINOR = \>>] \
   && [nmakehlp -V "$(_RULESDIR)\" RULES_VERSION_MINOR >>]

!if [echo OUR_RULES_MAJOR = \>>] \
   && [nmakehlp -V "" RULES_VERSION_MAJOR >>]
!if [echo OUR_RULES_MINOR = \>>] \
   && [nmakehlp -V "" RULES_VERSION_MINOR >>]
# We have a newer version of the support files, use them

!endif # if exist("")

!endif # if $(_RULESDIR) != "."

# Let know what copy of nmakehlp.c to use.
NMAKEHLPC = $(_RULESDIR)\nmakehlp.c

# Get rid of our internal defines before calling

!if exist("$(_RULESDIR)\")
!message *** Using $(_RULESDIR)\
!include "$(_RULESDIR)\"
!error *** Could not locate in $(_RULESDIR)

!endif # _RULES_EXT_VC