Difference between revisions of "Module Management System"

From VSI OpenVMS Wiki
Jump to: navigation, search
(initial commit)
 
m
 
(2 intermediate revisions by the same user not shown)
Line 1: Line 1:
'''Module Management System''' (MMS) is a utility for automating building of software systems, part of [[DECset]].
+
'''Module Management System''' (MMS) is a utility for automating building of software systems, part of [[DECset]]. It is similar to Unix make and uses description files that describe how to build the system, which are then executed by MMS.
 +
 
 +
'''Targets''' are OpenVMS files that need to be built, e.g. EXE or OBJ files.
 +
 
 +
'''Sources''' are OpenVMS files that are used to build targets, e.g. OBJ or C or PAS files.
 +
 
 +
'''Action lines''' are OpenVMS commans that MMS executes. Action lines start with at least one space.
 +
 
 +
Built-in rules are made up of default macros, special macros, and string variables. A copy of the built-in rules resides at SYS$COMMON:[SYSHLP.EXAMPLES.MMS]MMS$DEFAULT_RULES.MMS.
 +
 
 +
=Macros=
 +
A macro is a name that represents a character string:
 +
 
 +
name = string
 +
 
 +
==Name==
 +
A macro name can be of unlimited length and can consist of any alphanumeric characters except the $( ) sequence, carriage return, control characters, equal sign, quotation marks, space, and tab.
 +
 
 +
==String==
 +
The macro string is the text that replaces the macro name when the macro is expanded. A macro string can consist of any character sequence. You can use a hyphen ( - ) as a continuation character to continue a macro string onto the next line of the description file. To invoke a macro, the following syntax is used:
 +
 
 +
$(name)
 +
 
 +
For example:
 +
 
 +
target = FILE.LIS
 +
$(target) :
 +
 
 +
If the value is not defined by the time it is used, its value is the null string.
 +
 
 +
==Default macros==
 +
===ADDPREFIX===
 +
$(ADDPREFIX prefix,text)
 +
This function prepends the value of prefix to the start of each word specified by text. Example:
 +
targets = FILE1 FILE2
 +
p_targets = $(ADDPREFIX OBJ$:,$(targets))    !resolved to OBJ$:FILE1, OBJ$:FILE2
 +
 
 +
===ADDSUFFIX===
 +
$(ADDSUFFIX suffix,text)
 +
This function appends the value of suffix to the end of each word specified by text. Example:
 +
targets = FILE1 FILE2
 +
s_targets = $(ADDSUFFIX .OBJ,$(targets))      !resolved to FILE1.OBJ, FILE2.OBJ
 +
 
 +
===FILTER===
 +
$(FILTER pattern...,text)
 +
This function filters text. Words specified by text that do not match any words specified by pattern are removed. Pattern words can contain the wildcard characters asterisk ( * ) and percent sign (%). Example:
 +
s_targets = FILE1.OBJ, FILE2.OBJ
 +
one_targets = $(filter *1,$(s_targets))      !resolved to FILE1.OBJ
 +
 
 +
===FILTER-OUT===
 +
$(FILTER-OUT pattern...,text)
 +
This function filters text. Words specified by text that match any words specified by pattern are removed. Pattern words can contain the wildcard characters asterisk ( * ) and percent sign (%).  Example:
 +
s_targets = FILE1.OBJ, FILE2.OBJ
 +
one_targets = $(filter-out *1,$(s_targets))      !resolved to FILE2.OBJ
 +
 
 +
===FINDSTRING===
 +
$(FINDSTRING find,text)
 +
This function performs a string search. If the value of the string specified by find occurs in the source text specified by text, the value of find is returned. Otherwise, the value is empty. Example:
 +
s_targets = FILE1.OBJ, FILE2.OBJ
 +
found_targets = $(findstring FILE1.OBJ,$(s_targets))      !resolved to FILE1.OBJ
 +
found_targets = $(findstring ALPHA,$(s_targets))          !resolved to empty string
 +
 
 +
===FIRSTWORD===
 +
$(FIRSTWORD text)
 +
This function returns the first word in the source text specified by text. Example:
 +
s_targets = FILE1.OBJ, FILE2.OBJ
 +
found_targets = $(firstword $(s_targets))      !resolved to FILE1.OBJ
 +
 
 +
===FOREACH===
 +
$(FOREACH macro,list,text)
 +
This function repeatedly expands text. For each word specified by list, the value of text is repeated with the value of macro defined as the word from list.
 +
 
 +
===JOIN===
 +
$(JOIN list,text)
 +
This function concatenates words. Each word specified by text is appended to the corresponding word in list forming a new word in the result. When the number of words in list and text are not the same, the remaining words from the longer list are simply appended to the result. Example:
 +
targets = FILE1 FILE2
 +
obj_targets = $(join $(targets),.OBJ)        ! resolved to FILE1.OBJ, FILE2.OBJ
 +
 
 +
===PATSUBST===
 +
$(PATSUBST pattern...,to,text)
 +
This function performs pattern substitution. Each word specified by text that matches a word specified by pattern is replaced by the value of to. Pattern words can contain the wildcard characters asterisk ( * ) and percent sign (%).
 +
If the value of to also contains wildcard characters, the wildcards are replaced by the text that matched the wildcard characters in pattern. Example:
 +
targets = A.LIS B.LIS
 +
new_targets = $(patsubst A*,$(s_targets),NEW.LIS)    ! resolved to NEW.LIS, B.LIS
 +
 
 +
===SORT===
 +
$(SORT text)
 +
This function sorts text. The words specified by text are sorted and arranged in lexical order; duplicate words are removed. Example:
 +
targets = A.LIS C.LIS A.LIS
 +
new_targets = $(sort $(targets))                  ! resolved to A.LIS, C.LIS
 +
 
 +
===STRIP===
 +
$(STRIP text)
 +
This function performs whitespace compression. Leading and trailing whitespace is removed from source text specified by text. Each internal sequence of whitespace characters is replaced by a single space.
 +
 
 +
===SUBST===
 +
$(SUBST from,to,text)
 +
This function performs string substitution. Each occurrence of the value from in the source text specified by text is replaced by the value of to.
 +
 
 +
===WORD===
 +
$(WORD n,text)
 +
This function returns a word (based on its position) from the source text specified by text. The value of n should range from 1 to the total number of words in the list. If n is not in this range, the result is empty. Example:
 +
targets = A.LIS C.LIS
 +
my_target = $(word 1,$(targets))                  ! A.LIS
 +
my_target = $(word 2,$(targets))                  ! C.LIS
 +
my_target = $(word 3,$(targets))                  ! empty string
 +
 
 +
===WORDS===
 +
$(WORDS text)
 +
This function returns the number of words in text. Example:
 +
targets = A.LIS C.LIS
 +
number = $(words $(targets))                        !2
 +
 
 +
===BASENAME===
 +
$(BASENAME text)
 +
For each file specification specified by text, this function returns the name portion of the specification (omitting the file type and version). Example:
 +
targets = A.LIS C.LIS
 +
number = $(basename $(targets))      !resolved to A, C
 +
 
 +
===DIR===
 +
$(DIR text)
 +
For each file specification specified by text, this function returns the directory portion of the specification (omitting the file name, type, and version). Example:
 +
targets = OBJ$:A.OBJ SRC$:C.LIS
 +
dir = $(dir $(targets))              !resolved to OBJ$, SRC$:
 +
 
 +
===FILETYPE===
 +
$(FILETYPE text)
 +
For each file specification specified by text, this function returns the file type portion of the specification (omitting the file name and version).
 +
 
 +
===FILEVERSION===
 +
$(FILEVERSION text)
 +
For each file specification specified by text, this function returns the version portion of the specification (omitting the file name and type).
 +
 
 +
===NOTDIR===
 +
$(NOTDIR text)
 +
For each file specification in text, this function returns the file name and type portion of the specification (omitting the directory and version).
 +
targets = OBJ$:A.OBJ SRC$:C.LIS
 +
dir = $(dir $(targets))              !resolved to A.OBJ,C.LIS
 +
 
 +
===WILDCARD===
 +
$(WILDCARD text)
 +
This function is used to search for files. It returns the name and type portion of files that match the file specifications specified by text. The file specifications may contain the wildcard characters asterisk ( * ) and percent sign (%).
 +
 
 +
===ORIGIN===
 +
$(ORIGIN macro)
 +
This function returns the one of the following text strings, which indicates the source of the definition of macro:
 +
* FILE
 +
* COMMAND LINE
 +
* SPECIAL
 +
* DEFAULT
 +
* CLI SYMBOL
 +
* TEMPORARY
 +
* UNDEFINED
  
 
[[Category:Utilities]]
 
[[Category:Utilities]]

Latest revision as of 13:21, 15 February 2023

Module Management System (MMS) is a utility for automating building of software systems, part of DECset. It is similar to Unix make and uses description files that describe how to build the system, which are then executed by MMS.

Targets are OpenVMS files that need to be built, e.g. EXE or OBJ files.

Sources are OpenVMS files that are used to build targets, e.g. OBJ or C or PAS files.

Action lines are OpenVMS commans that MMS executes. Action lines start with at least one space.

Built-in rules are made up of default macros, special macros, and string variables. A copy of the built-in rules resides at SYS$COMMON:[SYSHLP.EXAMPLES.MMS]MMS$DEFAULT_RULES.MMS.

Macros

A macro is a name that represents a character string:

name = string

Name

A macro name can be of unlimited length and can consist of any alphanumeric characters except the $( ) sequence, carriage return, control characters, equal sign, quotation marks, space, and tab.

String

The macro string is the text that replaces the macro name when the macro is expanded. A macro string can consist of any character sequence. You can use a hyphen ( - ) as a continuation character to continue a macro string onto the next line of the description file. To invoke a macro, the following syntax is used:

$(name)

For example:

target = FILE.LIS
$(target) :

If the value is not defined by the time it is used, its value is the null string.

Default macros

ADDPREFIX

$(ADDPREFIX prefix,text)

This function prepends the value of prefix to the start of each word specified by text. Example:

targets = FILE1 FILE2
p_targets = $(ADDPREFIX OBJ$:,$(targets))     !resolved to OBJ$:FILE1, OBJ$:FILE2

ADDSUFFIX

$(ADDSUFFIX suffix,text)

This function appends the value of suffix to the end of each word specified by text. Example:

targets = FILE1 FILE2
s_targets = $(ADDSUFFIX .OBJ,$(targets))      !resolved to FILE1.OBJ, FILE2.OBJ

FILTER

$(FILTER pattern...,text)

This function filters text. Words specified by text that do not match any words specified by pattern are removed. Pattern words can contain the wildcard characters asterisk ( * ) and percent sign (%). Example:

s_targets = FILE1.OBJ, FILE2.OBJ
one_targets = $(filter *1,$(s_targets))       !resolved to FILE1.OBJ 

FILTER-OUT

$(FILTER-OUT pattern...,text)

This function filters text. Words specified by text that match any words specified by pattern are removed. Pattern words can contain the wildcard characters asterisk ( * ) and percent sign (%). Example:

s_targets = FILE1.OBJ, FILE2.OBJ
one_targets = $(filter-out *1,$(s_targets))       !resolved to FILE2.OBJ 

FINDSTRING

$(FINDSTRING find,text)

This function performs a string search. If the value of the string specified by find occurs in the source text specified by text, the value of find is returned. Otherwise, the value is empty. Example:

s_targets = FILE1.OBJ, FILE2.OBJ
found_targets = $(findstring FILE1.OBJ,$(s_targets))       !resolved to FILE1.OBJ
found_targets = $(findstring ALPHA,$(s_targets))           !resolved to empty string

FIRSTWORD

$(FIRSTWORD text)

This function returns the first word in the source text specified by text. Example:

s_targets = FILE1.OBJ, FILE2.OBJ
found_targets = $(firstword $(s_targets))       !resolved to FILE1.OBJ

FOREACH

$(FOREACH macro,list,text)

This function repeatedly expands text. For each word specified by list, the value of text is repeated with the value of macro defined as the word from list.

JOIN

$(JOIN list,text)

This function concatenates words. Each word specified by text is appended to the corresponding word in list forming a new word in the result. When the number of words in list and text are not the same, the remaining words from the longer list are simply appended to the result. Example:

targets = FILE1 FILE2
obj_targets = $(join $(targets),.OBJ)         ! resolved to FILE1.OBJ, FILE2.OBJ

PATSUBST

$(PATSUBST pattern...,to,text)

This function performs pattern substitution. Each word specified by text that matches a word specified by pattern is replaced by the value of to. Pattern words can contain the wildcard characters asterisk ( * ) and percent sign (%). If the value of to also contains wildcard characters, the wildcards are replaced by the text that matched the wildcard characters in pattern. Example:

targets = A.LIS B.LIS
new_targets = $(patsubst A*,$(s_targets),NEW.LIS)    ! resolved to NEW.LIS, B.LIS

SORT

$(SORT text)

This function sorts text. The words specified by text are sorted and arranged in lexical order; duplicate words are removed. Example:

targets = A.LIS C.LIS A.LIS
new_targets = $(sort $(targets))                   ! resolved to A.LIS, C.LIS

STRIP

$(STRIP text)

This function performs whitespace compression. Leading and trailing whitespace is removed from source text specified by text. Each internal sequence of whitespace characters is replaced by a single space.

SUBST

$(SUBST from,to,text)

This function performs string substitution. Each occurrence of the value from in the source text specified by text is replaced by the value of to.

WORD

$(WORD n,text)

This function returns a word (based on its position) from the source text specified by text. The value of n should range from 1 to the total number of words in the list. If n is not in this range, the result is empty. Example:

targets = A.LIS C.LIS
my_target = $(word 1,$(targets))                   ! A.LIS
my_target = $(word 2,$(targets))                   ! C.LIS
my_target = $(word 3,$(targets))                   ! empty string

WORDS

$(WORDS text) This function returns the number of words in text. Example:

targets = A.LIS C.LIS
number = $(words $(targets))                        !2

BASENAME

$(BASENAME text)

For each file specification specified by text, this function returns the name portion of the specification (omitting the file type and version). Example:

targets = A.LIS C.LIS
number = $(basename $(targets))       !resolved to A, C

DIR

$(DIR text)

For each file specification specified by text, this function returns the directory portion of the specification (omitting the file name, type, and version). Example:

targets = OBJ$:A.OBJ SRC$:C.LIS
dir = $(dir $(targets))               !resolved to OBJ$, SRC$:

FILETYPE

$(FILETYPE text)

For each file specification specified by text, this function returns the file type portion of the specification (omitting the file name and version).

FILEVERSION

$(FILEVERSION text)

For each file specification specified by text, this function returns the version portion of the specification (omitting the file name and type).

NOTDIR

$(NOTDIR text)

For each file specification in text, this function returns the file name and type portion of the specification (omitting the directory and version).

targets = OBJ$:A.OBJ SRC$:C.LIS
dir = $(dir $(targets))               !resolved to A.OBJ,C.LIS

WILDCARD

$(WILDCARD text)

This function is used to search for files. It returns the name and type portion of files that match the file specifications specified by text. The file specifications may contain the wildcard characters asterisk ( * ) and percent sign (%).

ORIGIN

$(ORIGIN macro)

This function returns the one of the following text strings, which indicates the source of the definition of macro:

  • FILE
  • COMMAND LINE
  • SPECIAL
  • DEFAULT
  • CLI SYMBOL
  • TEMPORARY
  • UNDEFINED