2 Environment
ksherlock edited this page 2013-08-03 12:28:41 -07:00

The $MPW/Environment.text file contains environment variables used by some MPW programs. Particularly, header file locations are defined here. Additionally, variable expansion occurs during pathname conversion, so mpw Link ... {Libraries}ToolLibs.o works as expected.

The file format is:

# comment
name = value
name += value
name ?= value

Name may contains alphanumerics and underscores.

  • = assigns the value, overwriting any previous value.
  • += appends the value to any previous value.
  • ?= assigns the value if and only if the variable was not already assigned.

Variable Expansion

Variables are expanded within the value. Recognized forms are:

  • $name
  • ${name}
  • {name}

Example

MPWVersion ?= 3.2

ShellDirectory=$MPW
SysTempFolder=/tmp/
TempFolder=/tmp/

AIIGSIncludes={MPW}Interfaces:AIIGSIncludes:
RIIGSIncludes={MPW}Interfaces:RIIGSIncludes:
CIIGSIncludes={MPW}Interfaces:CIIGSIncludes:
CIIGSLibraries={MPW}Libraries:CIIGSLibraries:
PIIGSIncludes={MPW}Interfaces:PIIGSIncludes:
PIIGSLibraries={MPW}Libraries:PIIGSLibraries:

Command line

Variables can also be defined as part of the mpw command. eg:

mpw -DMPWVersion=3.5 SC ...

These variables are processed after internal variables are set ($MPW and $Command) but before the Environment.text file is loaded. This allows for fast switching between different versions of MPW headers and libraries:

Libraries={MPW}Libraries:Libraries-{MPWVersion}:
PLibraries={MPW}Libraries:PLibraries-{MPWVersion}:
CLibraries={MPW}Libraries:CLibraries-{MPWVersion}: