Libraries
Make data Source Code
 previous   up   next 

Types
ruleType
Describes a make rule with target, dependencies and commands.
makeDataType
Describes rules and macros from a makefile and flags from the command line.

ruleType

const type: ruleType

Describes a make rule with target, dependencies and commands.


makeDataType

const type: makeDataType

Describes rules and macros from a makefile and flags from the command line.


Function Summary
string
applyMacros (in stringHash: macros, in string: stri, in boolean: leaveUndefMacros)
Apply macros from the macros hash table to the given stri.
string
getMakeLine (inout file: makefile)
Get a line from the makefile.
string
getMakeTarget (inout file: makefile)
Get a target name from the makefile.
string
getMakeDependency (inout string: dependencies)
Get the first dependency from the dependencies line.
ruleType
readRule (inout makeDataType: makeData, in string: target)
Read a rule with the given target from the makefile specified by makeData.
boolean
patternRulePresent (in makeDataType: makeData, in string: target, in string: dependency)
Determine if the pattern rule target + dependency is present in makeData.
void
addPatternRule (inout makeDataType: makeData, in ruleType: rule)
Add the given rule as pattern rule to makeData.
void
addRule (inout makeDataType: makeData, in ruleType: rule)
Add the given rule either as normal rule or pattern rule to makeData.

Function Detail

applyMacros

const func string: applyMacros (in stringHash: macros, in string: stri, in boolean: leaveUndefMacros)

Apply macros from the macros hash table to the given stri. Macro invocations in stri can be written as $(CFLAGS) or as ${CFLAGS}. Besides the macros defined in macros the functions strip, subst, patsubst, dir, notdir, suffix, basename, addprefix, addsuffix, filter, filter-out, foreach, call, sort, shell, wildcard, error and warning are also processed. Additionally the shorthand replacement function $(var:pat=to) is processed. Internal macros like $@ $< $? $^ $+ and $$ are always left unchanged.

Parameters:
macros - A hash map with all defined macros.
stri - The string where the macros should be applied.
leaveUndefMacros - TRUE if undefined macros should be left as is, or FALSE if undefined macros should be removed.
Returns:
the string stri after the macros have been applied.

getMakeLine

const func string: getMakeLine (inout file: makefile)

Get a line from the makefile. Data is read until a line ending is not preceeded by a backslash (\). Line endings can be "\n" or "\r\n" (the "\r" is silently removed). A backslash at the end of a line is removed together with the line ending. This is done such that at least one space replaces the line ending. When the function is called the first char to be read must be in makefile.bufferChar. When the function is left makefile.bufferChar contains either '\n' or EOF.

Parameters:
makefile - Makefile from which the line is read.
Returns:
the line read from the makefile.

getMakeTarget

const func string: getMakeTarget (inout file: makefile)

Get a target name from the makefile. This function is also used to read macro names. When the function is called the first character of the target name must be in makefile.bufferChar. When the function is left the first character after the target name is in makefile.bufferChar.

Parameters:
makefile - Makefile from which the target name is read.
Returns:
the target name read from the makefile.

getMakeDependency

const func string: getMakeDependency (inout string: dependencies)

Get the first dependency from the dependencies line. The function removes the dependency from the dependencies line. This way consecutive calls deliver the dependencies one by one.

Parameters:
dependencies - Line of dependencies from the makefile.
Returns:
the first dependency from the dependencies line.

readRule

const func ruleType: readRule (inout makeDataType: makeData, in string: target)

Read a rule with the given target from the makefile specified by makeData. The function assumes that the colon (:) after the target has been read. The function reads the dependencies and commands of the rule.

Parameters:
makeData - Make data containing the file makefile and the defined macros.
target - The target of the rule to be read.
Returns:
the makefile rule read.

patternRulePresent

const func boolean: patternRulePresent (in makeDataType: makeData, in string: target, in string: dependency)

Determine if the pattern rule target + dependency is present in makeData.

patternRulePresent(makeData, "%.o", "%.c")
patternRulePresent(makeData, "%.o", "%.cpp")
Parameters:
makeData - Rules and macros from the makefile and flags from the command line.
target - Target of the searched pattern rule.
dependency - Dependency of the searchec pattern rule.
Returns:
TRUE, if the pattern rule target with the given dependency is present, FALSE otherwise.

addPatternRule

const proc: addPatternRule (inout makeDataType: makeData, in ruleType: rule)

Add the given rule as pattern rule to makeData.

Parameters:
makeData - Destination where the rule is stored.
rule - Makefile pattern rule to be added to makeData.

addRule

const proc: addRule (inout makeDataType: makeData, in ruleType: rule)

Add the given rule either as normal rule or pattern rule to makeData.

Parameters:
makeData - Destination where the rule is stored.
rule - Makefile rule to be added to makeData.


 previous   up   next