1 # This file should only be included in makefiles for Tcl extensions,
\r
2 # NOT in the makefile for Tcl itself.
\r
4 !ifndef _RULES_EXT_VC
\r
6 # We need to run from the directory the parent makefile is located in.
\r
7 # nmake does not tell us what makefile was used to invoke it so parent
\r
8 # makefile has to set the MAKEFILEVC macro or we just make a guess and
\r
9 # warn if we think that is not the case.
\r
10 !if "$(MAKEFILEVC)" == ""
\r
12 !if exist("$(PROJECT).vc")
\r
13 MAKEFILEVC = $(PROJECT).vc
\r
14 !elseif exist("makefile.vc")
\r
15 MAKEFILEVC = makefile.vc
\r
17 !endif # "$(MAKEFILEVC)" == ""
\r
19 !if !exist("$(MAKEFILEVC)")
\r
21 You must run nmake from the directory containing the project makefile.^
\r
22 If you are doing that and getting this message, set the MAKEFILEVC^
\r
23 macro to the name of the project makefile.
\r
24 !message WARNING: $(MSG)
\r
27 !if "$(PROJECT)" == "tcl"
\r
28 !error The rules-ext.vc file is not intended for Tcl itself.
\r
31 # We extract version numbers using the nmakehlp program. For now use
\r
32 # the local copy of nmakehlp. Once we locate Tcl, we will use that
\r
33 # one if it is newer.
\r
34 !if [$(CC) -nologo "nmakehlp.c" -link -subsystem:console > nul]
\r
37 # First locate the Tcl directory that we are working with.
\r
38 !if "$(TCLDIR)" != ""
\r
40 _RULESDIR = $(TCLDIR:/=\)
\r
44 # If an installation path is specified, that is also the Tcl directory.
\r
45 # Also Tk never builds against an installed Tcl, it needs Tcl sources
\r
46 !if defined(INSTALLDIR) && "$(PROJECT)" != "tk"
\r
47 _RULESDIR=$(INSTALLDIR:/=\)
\r
49 # Locate Tcl sources
\r
50 !if [echo _RULESDIR = \> nmakehlp.out] \
\r
51 || [nmakehlp -L generic\tcl.h >> nmakehlp.out]
\r
52 _RULESDIR = ..\..\tcl
\r
54 !include nmakehlp.out
\r
57 !endif # defined(INSTALLDIR)....
\r
59 !endif # ifndef TCLDIR
\r
61 # Now look for the targets.vc file under the Tcl root. Note we check this
\r
62 # file and not rules.vc because the latter also exists on older systems.
\r
63 !if exist("$(_RULESDIR)\lib\nmake\targets.vc") # Building against installed Tcl
\r
64 _RULESDIR = $(_RULESDIR)\lib\nmake
\r
65 !elseif exist("$(_RULESDIR)\win\targets.vc") # Building against Tcl sources
\r
66 _RULESDIR = $(_RULESDIR)\win
\r
68 # If we have not located Tcl's targets file, most likely we are compiling
\r
69 # against an older version of Tcl and so must use our own support files.
\r
73 !if "$(_RULESDIR)" != "."
\r
74 # Potentially using Tcl's support files. If this extension has its own
\r
75 # nmake support files, need to compare the versions and pick newer.
\r
77 !if exist("rules.vc") # The extension has its own copy
\r
79 !if [echo TCL_RULES_MAJOR = \> versions.vc] \
\r
80 && [nmakehlp -V "$(_RULESDIR)\rules.vc" RULES_VERSION_MAJOR >> versions.vc]
\r
82 !if [echo TCL_RULES_MINOR = \>> versions.vc] \
\r
83 && [nmakehlp -V "$(_RULESDIR)\rules.vc" RULES_VERSION_MINOR >> versions.vc]
\r
86 !if [echo OUR_RULES_MAJOR = \>> versions.vc] \
\r
87 && [nmakehlp -V "rules.vc" RULES_VERSION_MAJOR >> versions.vc]
\r
89 !if [echo OUR_RULES_MINOR = \>> versions.vc] \
\r
90 && [nmakehlp -V "rules.vc" RULES_VERSION_MINOR >> versions.vc]
\r
92 !include versions.vc
\r
93 # We have a newer version of the support files, use them
\r
94 !if ($(TCL_RULES_MAJOR) != $(OUR_RULES_MAJOR)) || ($(TCL_RULES_MINOR) < $(OUR_RULES_MINOR))
\r
98 !endif # if exist("rules.vc")
\r
100 !endif # if $(_RULESDIR) != "."
\r
102 # Let rules.vc know what copy of nmakehlp.c to use.
\r
103 NMAKEHLPC = $(_RULESDIR)\nmakehlp.c
\r
105 # Get rid of our internal defines before calling rules.vc
\r
106 !undef TCL_RULES_MAJOR
\r
107 !undef TCL_RULES_MINOR
\r
108 !undef OUR_RULES_MAJOR
\r
109 !undef OUR_RULES_MINOR
\r
111 !if exist("$(_RULESDIR)\rules.vc")
\r
112 !message *** Using $(_RULESDIR)\rules.vc
\r
113 !include "$(_RULESDIR)\rules.vc"
\r
115 !error *** Could not locate rules.vc in $(_RULESDIR)
\r
118 !endif # _RULES_EXT_VC