Wiki

A universe of ideas

User Tools

Site Tools


computer:cheat_sheets:make

.PHONY für targets die keine Dateien erzeugen und und immer ausgeführt werden sollen / FORCE für targets die files erzeugen und immer ausgeführt werden sollen (FORCE selbst ist nicht .PHONY) Quelle

GNU Make cheat scheet

Variables

Ofiziell.

$@ target: a b a c
$% The target member name, when the target is an archive member.
$< target: a b a c
$? target: a b a c (newer prerequisites)
$^ target: a b a c
$+ target: a b a c
$* The stem with which an implicit rule matches.
$| target: a b a c | d e f

… da fehlen welche

CPPFLAGS Compiler, alle Sprachen (z.B. -I…)
CFLAGS Compiler, nur C (z.B. -std=…)
CXXFLAGS Compiler, nur C++

Functions

Ofiziell.

$(subst from,to,text) Fixed string replacement.
$(patsubst %-from,%to,text) %-Pattern replacement.
Alternative 1: $(var:%-from=%-to)
Alternative 2: $(var:suffix=replacement)
$(strip string) Remove whitespace at the ends (like trim).
$(findstring find,text) Return “find” or “”.
$(filter pattern…,word…) Return word which matches any %-pattern
$(filter-out pattern…,word…) Return word which mateches none %-pattern.
$(sort word…) 1) Sort words, 2) removing duplicates.
$(dir names…) Extract the directory part of each file name.
$(notdir names…) Extract the non-directory part of each file name.
$(suffix names…) Extract the suffix (the last dot and following characters) of each file name.
$(basename names…) Extract the base name (name without suffix) of each file name.
$(addsuffix suffix,names…) Append suffix to each word in names.
$(addprefix prefix,names…) Prepend prefix to each word in names.
$(join list1,list2) Join two parallel lists of words.
$(word n,word…) The nth word.
$(firstword word…) The 1th word.
$(wordlist s,e,word…) The sth … eth word.
$(words word…) Number of words.
$(wildcard pattern…) Find file names matching a shell file name pattern (not a `%' pattern).
$(error text…) When this function is evaluated, make generates a fatal error with the message text.
$(warning text…) When this function is evaluated, make generates a warning with the message text.
$(shell command) Execute a shell command and return its output.
$(origin variable) Return a string describing how the make variable variable was defined.
$(foreach var,words,text) Evaluate text with var bound to each word in words, and concatenate the results.
$(call var,param,…) Evaluate the variable var replacing any references to $(1), $(2) with the first, second, etc. param values.

… da fehlen welche

computer/cheat_sheets/make.txt · Last modified: 2020-11-18 18:11 by 127.0.0.1