@@ -42,7 +42,7 @@ NMAKEHLP_NATIVE=nmakehlp
4242# For modifications that are not backward-compatible, you *must* change
4343# the major version.
4444RULES_VERSION_MAJOR = 1
45- RULES_VERSION_MINOR = 18
45+ RULES_VERSION_MINOR = 19
4646
4747# The PROJECT macro must be defined by parent makefile.
4848!if "$(PROJECT)" == ""
@@ -1064,6 +1064,7 @@ WARNINGS = $(WARNINGS) -Wp64
10641064# SUFX - the suffix to use for binaries based on above naming convention
10651065# BUILDDIRTOP - the toplevel default output directory
10661066# is of the form {Release,Debug}[_AMD64][_COMPILERVERSION]
1067+ # unless overridden by defining OUT_DIR on the command line.
10671068# TMP_DIR - directory where object files are created
10681069# OUT_DIR - directory where output executables are created
10691070# Both TMP_DIR and OUT_DIR are defaulted only if not defined by the
@@ -1079,19 +1080,43 @@ WARNINGS = $(WARNINGS) -Wp64
10791080
10801081SUFX = tsgx
10811082
1083+ # If OUT_DIR is defined (via command line or environment) make that
1084+ # define BUILDDIRTOP as its tail. Otherwise, default it as below and
1085+ # define OUT_DIR based on BUILDDIRTOP.
1086+ !ifdef OUT_DIR
1087+ # Relative paths -> absolute
1088+ !if [echo OUT_DIR = \> nmakehlp.out] \
1089+ || [$(NMAKEHLP_NATIVE) -Q "$(OUT_DIR)" >> nmakehlp.out]
1090+ !error *** Could not fully qualify path OUT_DIR=$(OUT_DIR)
1091+ !endif
1092+ # The undef is needed when OUT_DIR is passed on the command line
1093+ # otherwise the definition in the include will not take effect
1094+ !undef OUT_DIR
1095+ !include nmakehlp.out
1096+ !if [echo BUILDDIRTOP = \> nmakehlp.out] \
1097+ || [for %A in ("$(OUT_DIR)") do echo %~nxA \>> nmakehlp.out]
1098+ !error *** Could not get tail of path OUT_DIR=$(OUT_DIR)
1099+ !endif
1100+ !include nmakehlp.out
1101+
1102+ !else
1103+
10821104!if $(DEBUG)
10831105BUILDDIRTOP = Debug
10841106!else
10851107BUILDDIRTOP = Release
10861108!endif
10871109
1110+
10881111!if "$(MACHINE)" != "IX86"
10891112BUILDDIRTOP =$(BUILDDIRTOP ) _$(MACHINE )
10901113!endif
10911114!if $(VCVER) > 6
10921115BUILDDIRTOP =$(BUILDDIRTOP ) _VC$(VCVER )
10931116!endif
10941117
1118+ !endif
1119+
10951120!if !$(DEBUG) || $(TCL_VERSION) > 86 || $(DEBUG) && $(UNCHECKED)
10961121SUFX = $(SUFX:g= )
10971122!endif
0 commit comments