Make7 is the Seed7 version of the make utility.
Make is used to manage the compilation process of a program.
This is done with the help of a makefile.
A makefile describes the relationships among files in the program,
and the commands for updating each file.
In a program, typically the executable file is updated from object files,
which are in turn made by compiling source files.
Make7 is designed to process makefiles from Unix and Windows make utilities.
Therefore the characteristics of several make utilities can be found in make7.
Make7 concentrates to provide basic make features in a portable way.
Many advanced features of other make utilities are left out in make7.
Make7 can be called from a command window with:
make7 [options] [targets]
Targets specifies the target rules to be processed.
When no targets are specified make7 processes the first rule of the makefile.
The following options are supported by make7:
- Write make7 usage.
- -C dir
- Change to dir before reading the makefile or doing anything else.
- -f file
- Use file as a makefile.
- Ignore all errors in commands executed.
- Print the commands that would be executed, but do not execute them.
- Silent operation. Do not print the commands as they are executed.
Make7 uses the option -f to determine the name of the makefile.
If no -f option is present, make7 will look for the makefiles makefile, and Makefile, in that order.
Example of a make7 usage:
The description of makefile properties below applies to makefiles accepted by make7.
Lines starting with the number sign (#) are interpreted as comments up to
the end of the line. The rules in a makefile look like:
target: dependencies ...
Target names consist of printable ASCII characters except space, tab, colon (:)
and equal (=). The dependencies are a possibly empty list of target names.
In the dependency list the target names are separated by spaces or tabs. The dependencies
can span two or more lines, when all lines except the last end with a backslash (\).
Lines with commands are introduced with tabs or spaces (Historically make only allowed tabs).
There can be several lines with commands (all introduced with spaces or tabs).
It is also allowed to put several semicolon separated commands in a line.
When the first character after the tab and space characters is a number sign (#)
the command line is interpreted as comment up to the end of the line. When a command is
prefixed with an at sign (@) the command is not printed, when it is executed.
When a command is prefixed with a minus sign (-) possible errors of the command
are ignored. Combinations of this prefixes (@- and -@) are also possible.
The following built-in commands are supported:
| ||rm || ||Remove files (Unix command)|
| ||del || ||Delete files (Dos/Windows command)|
| ||cp || ||Copy files (Unix command)|
| ||copy || ||Copy files (Dos/Windows command)|
| ||pwd || ||Print current working directory|
| ||echo || ||Echo string(s) to standard output|
| ||cd || ||Change directory|
| ||make || ||Call make7 command|
The built-in commands are operating system independent,
but they support only a limited set of options:
| ||rm || -f || Ignore nonexistent files (option is ignored)|
| ||cp || -n || Do not overwrite existing files|
| ||cp || -a || Preserve mode, ownership and timestamps|
| ||cp || -p || Preserve mode, ownership and timestamps|
| ||copy || /Y || Overwrite existing files|
| ||pwd || -W || Write windows path (option is ignored)|
Other commands are executed with the operating system shell.
The output of a command can be redirected into a file. E.g.:
echo "#define PATH_DELIMITER '/'" > version.h
echo "#define USE_DIRENT" >> version.h
echo "#define OBJECT_FILE_EXTENSION \".o\"" >> version.h
echo "#define C_COMPILER \"$(CC)\"" >> version.h
Echo works also without quotation marks. E.g.:
echo #define PATH_DELIMITER '\\' > version.h
echo #define USE_DIRWIN >> version.h
echo #define OBJECT_FILE_EXTENSION ".obj" >> version.h
echo #define C_COMPILER "$(CC)" >> version.h
The caret can be used in unquoted strings to describe certain special characters
(which would be interpreted wrongly by some make utilities):
echo ^#define PATH_DELIMITER '\\' > version.h
echo ^#define USE_DIRENT >> version.h
echo ^#define OBJECT_FILE_EXTENSION ".obj" >> version.h
echo ^#define EXECUTABLE_FILE_EXTENSION ".exe" >> version.h
echo ^#define C_COMPILER "$(CC)" >> version.h
Echo commands are allowed to contain a backtick (`) command. E.g.:
cd ../bin; echo "#define SEED7_LIB \"`pwd`/$(SEED7_LIB)\"" >> ../src/version.h; cd ../src
cd ../bin; echo "#define COMP_DATA_LIB \"`pwd`/$(COMP_DATA_LIB)\"" >> ../src/version.h; cd ../src
cd ../bin; echo "#define COMPILER_LIB \"`pwd`/$(COMPILER_LIB)\"" >> ../src/version.h; cd ../src
cd ../lib; echo "#define SEED7_LIBRARY \"`pwd`\"" >> ../src/version.h; cd ../src
The following pattern rules are predefined, when they are not defined in the makefile:
$(CC) -c $(CPPFLAGS) $(CFLAGS) $< -o $@
$(CC) -c $(CPPFLAGS) $(CFLAGS) $< -o $@
The following suffix rules are supported:
Lines to define makefile macros look like:
Macro names consist of printable ASCII characters except space, tab, closing parenthesis ()) and equal (=).
The value of the macro is the string after = up to, but not including, the end of the line.
Leading whitespace is not part of the value.
A macro definition is:
CFLAGS = -O2 -g -Wall -Wstrict-prototypes -Winline
A macro can be used by surrounding its name with parentheses and prefixing the expression with a dollar sign ($).
Macros can be used in targets, dependencies, commands or macro values.
The following internal macros are predefined:
| ||$@ || ||The full target name of the current target|
| ||$< || ||The first dependency of the current rule|
| ||$? || ||The dependencies of the current rule without double entries|
| ||$^ || ||The dependencies of the current rule without double entries|
| ||$+ || ||The dependencies of the current rule|
| ||$$ || ||The character $|