Screenshots |
|
Make7 | Source Code |
|
|
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 the features of make in a portable way. Unportable features of other make utilities are left out in make7. UsageMake7 can be called from a command window with: make7 [options] [targets] Targets specifies the target rules to be processed. If no targets are specified make7 processes the first rule of the makefile. The following options are supported by make7:
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: ../prg/make7 depend MakefileThe 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 ... commands 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, if all lines except the last end with a backslash (\). Target names in the dependency list can be quoted with double quotes ("). This allows dependency targets with spaces. Alternatively a space in a dependency target can be preceeded by 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. If 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. If a command is prefixed with an at sign (@) the command is not printed, when it is executed. If 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:
The built-in commands are operating system independent, but they support only a limited set of options:
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, if they are not defined in the makefile: %.o: %.c $(CC) -c $(CPPFLAGS) $(CFLAGS) $< -o $@ %.obj: %.c $(CC) -c $(CPPFLAGS) $(CFLAGS) $< -o $@ The following suffix rules are supported:
Lines to define makefile macros look like: macro=value 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 ($). E.g.: $(CFLAGS) Macros can be used in targets, dependencies, commands or macro values. The following internal macros are predefined:
There are functions that can be used to transform text:
For the replacement function shorthands are defined:
The conditionals ifeq, ifneq, ifdef and ifndef can be used to activate or deactivate parts of the makefile. E.g.: ifeq ($(CC),gcc) $(CC) -o executable $(obj) $(gcc_libs) else $(CC) -o executable $(obj) $(normal_libs) endif It is possible to include files into the makefile. E.g.: ifeq (depend,$(wildcard depend)) include depend endif A different kind of conditional and include can be also introduced with an exclamation mark (!). E.g.: !if exist(depend) !include depend !endif Operation methodProcessing a makefile starts with processing the specified target rule, or with processing the first rule if no target was specified. When a rule is processed the dependency rules are called recursively. When a rule is processed and the target file is missing the commands of the rule are executed. When a rule is processed and at least one dependency file is newer than the targed file the commands of the rule are executed. Download
Make7 is written in the Seed7 programming language.
You can download make7.exe, which is binary version of make7 for Windows.
Make7 is also a part of the Seed7 package.
To use make7 from the Seed7 package it is necessary to compile the Seed7 interpreter.
Afterwards Make7 can be started from the directory s7 make7 Make7 can be also compiled with: s7c make7 This creates an executable, which can be used without the 's7' interpreter. |
|
|
|
|