If you set the DJGPP environment variable to point to a file, that file will be used to load the environment. There is a djgpp.env file distributed with djgpp that provides most of the values you need. The format of the file is like this:
VAR=value VAR=value [program] VAR=value [prog2] VAR=value
Note that all whitespace is preserved, so be careful about trailing spaces and spaces around the ‘=’. Variables in the first section (before any [program] lines) apply to all programs. Variables in program-specific sections are loaded only when running that program. For example, a [gcc] section would have variables that gcc.exe needs. Values may refer to other variables using the DOS convention, like %DJGPP%. In addition, the first characters after the ‘%’ can be used to process the value before using it. These syntaxes are allowed:
%variable% Take the value as is %:variable% Take the directory portion only %;variable% Append with a semicolon if variable is defined %/variable% Replace all `\' with `/' %\variable% Replace all `/' with `\' %<variable% Convert to upper case %>variable% Convert to lower case
You may list multiple characters after the %, but they must be before the variable name, like %:/>DJGPP%. Variable names are case sensitive. The DOS environment variable names are usually upper case. Variables set through this file override any set in the DOS environment, unless the first character of the variable name is ‘+’, in which case the DOS environment overrides the file (the ‘+’ is removed from the name), as in ‘+USER=dosuser’.
If you need a literal ‘%’, write two percent signs in a row, like so:
This will produce a value of ‘*k<%X>’ for the variable