shell
The shell function is unlike any other function other than the wildcard function (see The Function wildcard) in that it communicates with the world outside of make.
The shell function performs the same function that backquotes (‘`’) perform in most shells: it does command expansion. This means that it takes as an argument a shell command and evaluates to the output of the command.
export:
Exporte le contenu d'une variable dans l'environnement ou dans un fichier de façon à ce qu'il soit disponible plus tard.
word
$(word n,text)
Returns the nth word of text. The legitimate values of n start from 1. If n is bigger than the number of words in text, the value is empty. For example,
$(word 2, foo bar baz)
returns ‘bar’.
filter-out
$(filter-out pattern...,text)
Returns all whitespace-separated words in text that do not match any of the pattern words, removing the words that do match one or more. This is the exact opposite of the filter function.
For example, given:
objects=main1.o foo.o main2.o bar.o
mains=main1.o main2.o
the following generates a list which contains all the object files not in ‘mains’:
(filter-out(mains),$(objects))
subst
$(subst from,to,text)
Performs a textual replacement on the text text: each occurrence of from is replaced by to. The result is substituted for the function call. For example,
$(subst ee,EE,feet on the street)
produces the value ‘fEEt on the strEEt’.
wildcard
$(wildcard pattern...)
This string, used anywhere in a makefile, is replaced by a space-separated list of names of existing files that match one of the given file name patterns. If no existing file name matches a pattern, then that pattern is omitted from the output of the wildcard function.
foreach
$(foreach var,list,text)
The first two arguments, var and list, are expanded before anything else is done; note that the last argument, text, is not expanded at the same time. Then for each word of the expanded value of list, the variable named by the expanded value of var is set to that word, and text is expanded. Presumably text contains references to that variable, so its expansion will be different each time.
The result is that text is expanded as many times as there are whitespace-separated words in list. The multiple expansions of text are concatenated, with spaces between them, to make the result of foreach.
shell
The shell function is unlike any other function other than the wildcard function (see The Function wildcard) in that it communicates with the world outside of make.
The shell function performs the same function that backquotes (‘`’) perform in most shells: it does command expansion. This means that it takes as an argument a shell command and evaluates to the output of the command. The only processing make does on the result is to convert each newline (or carriage-return / newline pair) to a single space. If there is a trailing (carriage-return and) newline it will simply be removed.
call
CALL executes a procedure.
If the procedure has any output parameters, then a result row will be
returned, containing the values of those parameters.
fonctionne avec les sql
$(call variable,param,param,...)
When make expands this function, it assigns each param to temporary variables (1),(2), etc. The variable $(0) will contain variable. There is no maximum number of parameter arguments. There is no minimum, either, but it doesn’t make sense to use call with no parameters.
strip
$(strip string)
Removes leading and trailing whitespace from string and replaces each internal sequence of one or more whitespace characters with a single space. Thus, ‘$(strip a b c )’ results in ‘a b c’.
commande shell
type
The type command will show you how a specific command will be interpreted if used on the command line.
type [OPTIONS] FILE_NAME...
-t renvoie alias (shell alias);function (shell function);builtin (shell builtin);file (disk file);keyword (shell reserved word)
-a renvoie t et localisation
-p renvoie le path si executable
eval
y=eval ls -l # Similaire à y=ls -l
echo $y # mais les retours chariot sont supprimés parce que la variable
# n'est pas entre guillemets.
echo
echo "$y" # Les retours chariot sont préservés lorsque la variable se
# trouve entre guillemets.
[^] # Re: ?
Posté par bombadil . En réponse au message shell et make. Évalué à 1.
Et voilà
fonctions de make :
shell
The shell function is unlike any other function other than the wildcard function (see The Function wildcard) in that it communicates with the world outside of make.
The shell function performs the same function that backquotes (‘`’) perform in most shells: it does command expansion. This means that it takes as an argument a shell command and evaluates to the output of the command.
export:
Exporte le contenu d'une variable dans l'environnement ou dans un fichier de façon à ce qu'il soit disponible plus tard.
word
$(word n,text)
Returns the nth word of text. The legitimate values of n start from 1. If n is bigger than the number of words in text, the value is empty. For example,
$(word 2, foo bar baz)
returns ‘bar’.
filter-out
$(filter-out pattern...,text)
Returns all whitespace-separated words in text that do not match any of the pattern words, removing the words that do match one or more. This is the exact opposite of the filter function.
For example, given:
objects=main1.o foo.o main2.o bar.o
mains=main1.o main2.o
the following generates a list which contains all the object files not in ‘mains’:
(filter-out(mains),$(objects))
subst
$(subst from,to,text)
Performs a textual replacement on the text text: each occurrence of from is replaced by to. The result is substituted for the function call. For example,
$(subst ee,EE,feet on the street)
produces the value ‘fEEt on the strEEt’.
wildcard
$(wildcard pattern...)
This string, used anywhere in a makefile, is replaced by a space-separated list of names of existing files that match one of the given file name patterns. If no existing file name matches a pattern, then that pattern is omitted from the output of the wildcard function.
foreach
$(foreach var,list,text)
The first two arguments, var and list, are expanded before anything else is done; note that the last argument, text, is not expanded at the same time. Then for each word of the expanded value of list, the variable named by the expanded value of var is set to that word, and text is expanded. Presumably text contains references to that variable, so its expansion will be different each time.
The result is that text is expanded as many times as there are whitespace-separated words in list. The multiple expansions of text are concatenated, with spaces between them, to make the result of foreach.
shell
The shell function is unlike any other function other than the wildcard function (see The Function wildcard) in that it communicates with the world outside of make.
The shell function performs the same function that backquotes (‘`’) perform in most shells: it does command expansion. This means that it takes as an argument a shell command and evaluates to the output of the command. The only processing make does on the result is to convert each newline (or carriage-return / newline pair) to a single space. If there is a trailing (carriage-return and) newline it will simply be removed.
call
CALL executes a procedure.
If the procedure has any output parameters, then a result row will be
returned, containing the values of those parameters.
fonctionne avec les sql
$(call variable,param,param,...)
When make expands this function, it assigns each param to temporary variables (1),(2), etc. The variable $(0) will contain variable. There is no maximum number of parameter arguments. There is no minimum, either, but it doesn’t make sense to use call with no parameters.
strip
$(strip string)
Removes leading and trailing whitespace from string and replaces each internal sequence of one or more whitespace characters with a single space. Thus, ‘$(strip a b c )’ results in ‘a b c’.
commande shell
type
The type command will show you how a specific command will be interpreted if used on the command line.
type [OPTIONS] FILE_NAME...
-t renvoie alias (shell alias);function (shell function);builtin (shell builtin);file (disk file);keyword (shell reserved word)
-a renvoie t et localisation
-p renvoie le path si executable
eval
y=
eval ls -l# Similaire à y=ls -lecho $y # mais les retours chariot sont supprimés parce que la variable
# n'est pas entre guillemets.
echo
echo "$y" # Les retours chariot sont préservés lorsque la variable se
# trouve entre guillemets.