Make installation guide




















This tells make that variables which are not explicitly mentioned in an export or unexport directive should be exported. Any variable given in an unexport directive will still not be exported. If you use export by itself to export variables by default, variables whose names contain characters other than alphanumerics and underscores will not be exported unless specifically mentioned in an export directive.

The behavior elicited by an export directive by itself was the default in older versions of GNU make. If your makefiles depend on this behavior and you want to be compatible with old versions of make , you can write a rule for the special target.

This will be ignored by old make s, while the export directive will cause a syntax error. Likewise, you can use unexport by itself to tell make not to export variables by default. Since this is the default behavior, you would only need to do this if export had been used by itself earlier in an included makefile, perhaps.

You cannot use export and unexport by themselves to have variables exported for some recipes and not for others. The last export or unexport directive that appears by itself determines the behavior for the entire run of make. The incrementation happens when make sets up the environment for a recipe.

This variable, if defined in the outer-level makefile, is passed down through the environment; then it serves as a list of extra makefiles for the sub- make to read before the usual or specified ones. This variable is set up automatically by make to contain the flag letters that make received. In response, it takes the flags from that value and processes them as if they had been given as arguments. See Overriding Variables. This is not usually useful to do.

You probably do not care about this. If you want your makefiles to be compatible with old make programs, use this technique; it will work fine with more modern make versions too. That variable is set only for compatibility; make does not interpret a value you set for it in any way.

If you do put MAKEFLAGS in your environment, you should be sure not to include any options that will drastically affect the actions of make and undermine the purpose of makefiles and of make itself.

When the same sequence of commands is useful in making various targets, you can define it as a canned sequence with the define directive, and refer to the canned sequence from the recipes for those targets. The canned sequence is actually a variable, so the name must not conflict with other variable names. Here run-yacc is the name of the variable being defined; endef marks the end of the definition; the lines in between are the commands. See Defining Multi-Line Variables , for a complete explanation of define.

The first command in this example runs Yacc on the first prerequisite of whichever rule uses the canned sequence. The output file from Yacc is always named y. To use the canned sequence, substitute the variable into the recipe of a rule. You can substitute it like any other variable see Basics of Variable References. Because variables defined by define are recursively expanded variables, all the variable references you wrote inside the define are expanded now.

This is a realistic example, but this particular one is not needed in practice because make has an implicit rule to figure out these commands based on the file names involved see Using Implicit Rules. In recipe execution, each line of a canned sequence is treated just as if the line appeared on its own in the rule, preceded by a tab. In particular, make invokes a separate sub-shell for each line. For example, using this canned sequence:.

But it will echo the following two recipe lines. On the other hand, prefix characters on the recipe line that refers to a canned sequence apply to every line in the sequence. So the rule:.

It is sometimes useful to define recipes which do nothing. This is done simply by giving a recipe that consists of nothing but whitespace. You could also use a line beginning with a recipe prefix character to define an empty recipe, but this would be confusing because such a line looks empty. You may be wondering why you would want to define a recipe that does nothing. One reason this is useful is to prevent a target from getting implicit recipes from implicit rules or the.

You may be inclined to define empty recipes for targets that are not actual files, but only exist so that their prerequisites can be remade. However, this is not the best way to do that, because the prerequisites may not be remade properly if the target file actually does exist. See Phony Targets , for a better way to do this. These values are substituted by explicit request into targets, prerequisites, recipes, and other parts of the makefile. In some other versions of make , variables are called macros.

Variables can represent lists of file names, options to pass to compilers, programs to run, directories to look in for source files, directories to write output in, or anything else you can imagine. However, variable names containing characters other than letters, numbers, and underscores should be considered carefully, as in some shells they cannot be passed through the environment to a sub- make see Communicating Variables to a Sub- make. Variable names are case-sensitive.

It is traditional to use upper case letters in variable names, but we recommend using lower case letters for variable names that serve internal purposes in the makefile, and reserving upper case for parameters that control implicit rules or for parameters that the user should override with command options see Overriding Variables. A few variables have names that are a single punctuation character or just a few characters.

These are the automatic variables , and they have particular specialized uses. See Automatic Variables. Variable references can be used in any context: targets, prerequisites, recipes, most directives, and new variable values. Here is an example of a common case, where a variable holds the names of all the object files in a program:. A dollar sign followed by a character other than a dollar sign, open-parenthesis or open-brace treats that single character as the variable name.

However, this practice can lead to confusion e. One place where readability is often improved is automatic variables see Automatic Variables. There are two ways that a variable in GNU make can have a value; we call them the two flavors of variables. The two flavors are distinguished in how they are defined and in what they do when expanded. The first flavor of variable is a recursively expanded variable.

The value you specify is installed verbatim; if it contains references to other variables, these references are expanded whenever this variable is substituted in the course of expanding some other string.

When this happens, it is called recursive expansion. This flavor of variable is the only sort supported by most other versions of make. It has its advantages and its disadvantages. An advantage most would say is that:. A major disadvantage is that you cannot append something on the end of a variable, as in. Actually make detects the infinite loop and reports an error.

Another disadvantage is that any functions see Functions for Transforming Text referenced in the definition will be executed every time the variable is expanded. This makes make run slower; worse, it causes the wildcard and shell functions to give unpredictable results because you cannot easily control when they are called, or even how many times. To avoid all the problems and inconveniences of recursively expanded variables, there is another flavor: simply expanded variables.

The value of a simply expanded variable is scanned once and for all, expanding any references to other variables and functions, when the variable is defined. The actual value of the simply expanded variable is the result of expanding the text that you write. It does not contain any references to other variables; it contains their values as of the time this variable was defined.

See The shell Function. Simply expanded variables generally make complicated makefile programming more predictable because they work like variables in most programming languages. They allow you to redefine a variable using its own value or its value processed in some way by one of the expansion functions and to use the expansion functions much more efficiently see Functions for Transforming Text.

You can also use them to introduce controlled leading whitespace into variable values. Leading whitespace characters are discarded from your input before substitution of variable references and function calls; this means you can include leading spaces in a variable value by protecting them with variable references, like this:. Here the value of the variable space is precisely one space. Since trailing space characters are not stripped from variable values, just a space at the end of the line would have the same effect but be rather hard to read.

If you put whitespace at the end of a variable value, it is a good idea to put a comment like that at the end of the line to make your intent clear. Conversely, if you do not want any whitespace characters at the end of your variable value, you must remember not to put a random comment on the end of the line after some whitespace, such as this:. This is called a conditional variable assignment operator, because it only has an effect if the variable is not yet defined.

This statement:. This section describes some advanced features you can use to reference variables in more flexible ways. A substitution reference substitutes the value of a variable with alterations that you specify.

See Setting Variables. We provide substitution references as well as patsubst for compatibility with other implementations of make. Another type of substitution reference lets you use the full power of the patsubst function.

See Functions for String Substitution and Analysis , for a description of the patsubst function. Computed variable names are a complicated concept needed only for sophisticated makefile programming. For most purposes you need not consider them, except to know that making a variable with a dollar sign in its name might have strange results.

However, if you are the type that wants to understand everything, or you are actually interested in what they do, read on. Variables may be referenced inside the name of a variable. This is called a computed variable name or a nested variable reference. The previous example shows two levels of nesting, but any number of levels is possible. For example, here are three levels:. References to recursively-expanded variables within a variable name are re-expanded in the usual fashion.

Nested variable references can also contain modified references and function invocations see Functions for Transforming Text , just like any other reference. For example, using the subst function see Functions for String Substitution and Analysis :. A computed variable name need not consist entirely of a single variable reference. It can contain several variable references, as well as some invariant text. The only restriction on this sort of use of nested variable references is that they cannot specify part of the name of a function to be called.

This is because the test for a recognized function name is done before the expansion of nested references.

This restriction could be removed in the future if that change is shown to be a good idea. You can also use computed variable names in the left-hand side of a variable assignment, or in a define directive, as in:. Note that nested variable references are quite different from recursively expanded variables see The Two Flavors of Variables , though both are used together in complex ways when doing makefile programming.

See The Two Flavors of Variables. The variable name may contain function and variable references, which are expanded when the line is read to find the actual variable name to use. There is no limit on the length of the value of a variable except the amount of memory on the computer. You can split the value of a variable into multiple physical lines for readability see Splitting Long Lines.

Most variable names are considered to have the empty string as a value if you have never set them. Several variables have built-in initial values that are not empty, but you can set them in the usual ways see Variables Used by Implicit Rules.

Several special variables are set automatically to a new value for each rule; these are called the automatic variables see Automatic Variables. This operator first evaluates the right-hand side, then passes that result to the shell for execution. If the result of the execution ends in a newline, that one newline is removed; all other newlines are replaced by spaces. The resulting string is then placed into the named recursively-expanded variable.

Alternatively, you can set a simply expanded variable to the result of running a program using the shell function call. As with the shell function, the exit status of the just-invoked shell script is stored in the. Often it is useful to add more text to the value of a variable already defined.

See The Two Flavors of Variables , for an explanation of the two flavors of variables. In fact,. Recall that when you define a recursively-expanded variable, make does not expand the value you set for variable and function references immediately.

Instead it stores the text verbatim, and saves these variable and function references to be expanded later, when you refer to the new variable see The Two Flavors of Variables. Take this common example:. Thus, includes need not be defined yet for its value to take effect. This is pretty close, but not quite what we want. If a variable has been set with a command argument see Overriding Variables , then ordinary assignments in the makefile are ignored.

If you want to set the variable in the makefile even though it was set with a command argument, you can use an override directive, which is a line that looks like this:. Variable assignments marked with the override flag have a higher priority than all other assignments, except another override. Subsequent assignments or appends to this variable which are not marked override will be ignored.

The override directive was not invented for escalation in the war between makefiles and command arguments. It was invented so you can alter and add to values that the user specifies with command arguments.

You could use this override directive:. You can also use override directives with define directives. This is done as you might expect:. Another way to set the value of a variable is to use the define directive. This directive has an unusual syntax which allows newline characters to be included in the value, which is convenient for defining both canned sequences of commands see Defining Canned Recipes , and also sections of makefile syntax to use with eval see Eval Function.

The define directive is followed on the same line by the name of the variable being defined and an optional assignment operator, and nothing more. The value to give the variable appears on the following lines.

The end of the value is marked by a line containing just the word endef. Aside from this difference in syntax, define works just like any other variable definition. The variable name may contain function and variable references, which are expanded when the directive is read to find the actual variable name to use. The final newline before the endef is not included in the value; if you want your value to contain a trailing newline you must include a blank line. For example in order to define a variable that contains a newline character you must use two empty lines, not one:.

You may omit the variable assignment operator if you prefer. You may nest define directives: make will keep track of nested directives and report an error if they are not all properly closed with endef. Note that lines beginning with the recipe prefix character are considered part of a recipe, so any define or endef strings appearing on such a line will not be considered make directives. However, note that using two separate lines means make will invoke the shell twice, running an independent sub-shell for each line.

If you want variable definitions made with define to take precedence over command-line variable definitions, you can use the override directive together with define :. If you want to clear a variable, setting its value to empty is usually sufficient. Expanding such a variable will yield the same result empty string regardless of whether it was set or not.

However, if you are using the flavor see Flavor Function and origin see Origin Function functions, there is a difference between a variable that was never set and a variable with an empty value.

In such situations you may want to use the undefine directive to make a variable appear as if it was never set. If you want to undefine a command-line variable definition, you can use the override directive together with undefine , similar to how this is done for variable definitions:. Variables in make can come from the environment in which make is run. Every environment variable that make sees when it starts up is transformed into a make variable with the same name and value.

However, an explicit assignment in the makefile, or with a command argument, overrides the environment. But this is not recommended practice. Thus, by setting the variable CFLAGS in your environment, you can cause all C compilations in most makefiles to use the compiler switches you prefer.

This is safe for variables with standard or conventional meanings because you know that no makefile will use them for other things. Note this is not totally reliable; some makefiles set CFLAGS explicitly and therefore are not affected by the value in the environment. When make runs a recipe, variables defined in the makefile are placed into the environment of each shell.

This allows you to pass values to sub- make invocations see Recursive Use of make. By default, only variables that came from the environment or the command line are passed to recursive invocations. You can use the export directive to pass other variables. See Communicating Variables to a Sub- make , for full details. Other use of variables from the environment is not recommended. It is not wise for makefiles to depend for their functioning on environment variables set up outside their control, since this would cause different users to get different results from the same makefile.

This is against the whole purpose of most makefiles. It would be very undesirable for this choice to affect make ; so, make handles the SHELL environment variable in a special way; see Choosing the Shell.

One exception to that is automatic variables see Automatic Variables. The other exception is target-specific variable values. This feature allows you to define different values for the same variable, based on the target that make is currently building. Target-specific variable assignments can be prefixed with any or all of the special keywords export , override , or private ; these apply their normal behavior to this instance of the variable only.

Multiple target values create a target-specific variable value for each member of the target list individually. All variables that appear within the variable-assignment are evaluated within the context of the target: thus, any previously-defined target-specific variable values will be in effect. Target-specific variables have the same priority as any other makefile variable.

Specifying the override directive will allow the target-specific variable value to be preferred. There is one more special feature of target-specific variables: when you define a target-specific variable that variable value is also in effect for all prerequisites of this target, and all their prerequisites, etc. So, for example, a statement like this:. Be aware that a given prerequisite will only be built once per invocation of make, at most. If the same file is a prerequisite of multiple targets, and each of those targets has a different value for the same target-specific variable, then the first target to be built will cause that prerequisite to be built and the prerequisite will inherit the target-specific value from the first target.

It will ignore the target-specific values from any other targets. In addition to target-specific variable values see Target-specific Variable Values , GNU make supports pattern-specific variable values. In this form, the variable is defined for any target that matches the pattern specified. As with target-specific variable values, multiple pattern values create a pattern-specific variable value for each pattern individually. The variable-assignment can be any valid form of assignment.

Any command line variable setting will take precedence, unless override is specified. If a target matches more than one pattern, the matching pattern-specific variables with longer stems are interpreted first. This results in more specific variables taking precedence over the more generic ones, for example:.

Pattern-specific variables which result in the same stem length are considered in the order in which they were defined in the makefile. Pattern-specific variables are searched after any target-specific variables defined explicitly for that target, and before target-specific variables defined for the parent target. As described in previous sections, make variables are inherited by prerequisites.

This capability allows you to modify the behavior of a prerequisite based on which targets caused it to be rebuilt. Sometimes, however, you may not want a variable to be inherited. For these situations, make provides the private modifier. Although this modifier can be used with any variable assignment, it makes the most sense with target- and pattern-specific variables.

Any variable marked private will be visible to its local target but will not be inherited by prerequisites of that target. A global variable marked private will be visible in the global scope but will not be inherited by any target, and hence will not be visible in any recipe. Due to the private modifier, a. Contains the name of each makefile that is parsed by make , in the order in which it was parsed.

The name is appended just before make begins to parse the makefile. Thus, if the first thing a makefile does is examine the last word in this variable, it will be the name of the current makefile. Once the current makefile has used include , however, the last word will be the just-included makefile.

Sets the default goal to be used if no targets were specified on the command line see Arguments to Specify the Goals. The following example illustrates these cases:. Note that assigning more than one target name to. This variable is set only if this instance of make has restarted see How Makefiles Are Remade : it will contain the number of times this instance has restarted.

You should not set, modify, or export this variable. When make starts it will check whether stdout and stderr will show their output on a terminal. If set these variables will be marked for export. These variables will not be changed by make and they will not be modified if already set. These values can be used particularly in combination with output synchronization see Output During Parallel Execution to determine whether make itself is writing to a terminal; they can be tested to decide whether to force recipe commands to generate colorized output for example.

If you invoke a sub- make and redirect its stdout or stderr it is your responsibility to reset or unexport these variables as well, if your makefiles rely on them.

The first character of the value of this variable is used as the character make assumes is introducing a recipe line. If the variable is empty as it is by default that character is the standard tab character. For example, this is a valid makefile:. The value of. Expands to a list of the names of all global variables defined so far. This includes variables which have empty values, as well as built-in variables see Variables Used by Implicit Rules , but does not include any variables which are only defined in a target-specific context.

Note that any value you assign to this variable will be ignored; it will always return its special value. Expands to a list of special features supported by this version of make. Possible values include, but are not limited to:. Supports ar archive files using special file name syntax. See Using make to Update Archive Files. Supports the -L --check-symlink-times flag. See Syntax of Conditionals. See Parallel Execution.

Supports the. See Using One Shell. Supports order-only prerequisites. See Types of Prerequisites. See How Patterns Match. Supports target-specific and pattern-specific variable assignments. See Target-specific Variable Values. Supports the undefine directive. See Undefine Directive. Has GNU Guile available as an embedded extension language.

Supports dynamically loadable objects for creating custom extensions. See Loading Dynamic Objects. Expands to a list of directories that make searches for included makefiles see Including Other Makefiles. Each word in this variable is a new prerequisite which is added to targets for which it is set. These prerequisites differ from normal prerequisites in that they do not appear in any of the automatic variables see Automatic Variables.

A bootstrapper can be used to upgrade, remove, configure software already installed on your computer. A software installer keeps track of what software is installed by which installation scripts and where it is placed. It will make sure that programs make proper use of the software and it will update the software with newer versions. An upgrade is a software installation that replaces an existing software package with a newer version of the software.

A software repository is a location where software and software packages are stored and accessed from. Software localization, also known as software internationalization, is the process of adapting software for use in different regions or countries.

Software license agreements outline what a user can and cannot do with software that they have purchased. I regret that your article ends on such a negative note although there are solutions. Helene, thanks for your thoughtful comment. I was trying to make the point that in situations where the readers do not have access to such sophisticated content management systems it would be prudent to cover important information in more reference materials than one, despite the inevitable redundancy and overlapping.

Best regards. You must be logged in to post a comment. This site uses Akismet to reduce spam. Learn how your comment data is processed. Table of Contents. Log in to Reply. Leave a Comment Cancel Reply You must be logged in to post a comment. How to Write a Software Installation Guide.

How to Write a Documentation Plan. How to Test the quality of a User Guide. How to Write a Terrible Technical Document. Your character product key not required for digital licenses. For help finding it, go to Find your Windows product key. After you've created the installation media, you can reset or reinstall Windows. To learn more, go to Recovery options in Windows. Windows 10 Windows 8. Need more help? Join the discussion.

Was this information helpful? Yes No. Dokit Dokit is the easiest documentation tool for creating and distributing manuals, operating procedures and step by step instructions.

Among its wide range of features , Dokit allows its users to… Structure content metadata, templates, etc. Annotate images Translate and have a multi-language option Set-up an approval process Chat and collaborate with others users Make instructions and manuals available anywhere mobile, tablets, offline, PDF, etc. To find out about these features and many more, take the tour SwipeGuide SwipeGuide , the Dutch platform for creating visual instructions, was created in with the sole aim of eliminating traditional paper user guides.

Dozuki Dozuki , just like its competitor above i. Speachme Speachme is an interesting documentation tool since it only allows you to create and share video tutorials.

StepShot Stepshot is a software which enables its users — mainly companies — to create training manuals for software-based applications and workflow presentations among others. Final thought Technical documents are based on clear and well-written instructions to help employees and end-users perform simple and complex tasks. Leave a Reply Cancel Reply Your email address will not be published.

Comment Name.



0コメント

  • 1000 / 1000