Title: Theory / Unimportant / CS / Programming / Build / gnu make
Tags: hasNotNewEffectReturnsMeaning computer_to_instruction FromInstruction FromVariables fromCommandLine récupéré automatedNewLineAfterCommaSpace comment seen_description Variable_missing_meaning hasSeenConjDef

Name: target
Definition: usually the name of a file that is generated by a program
Page: https://www.gnu.org/software/make/manual/html_node/Rule-Introduction.html#Rule-Introduction
Chapter: 2
Section: 1
Definition2: Action to carry out
Example: executable or object files
Conjdef: Either
Example2: clean

Name: prerequesite
Definition: a file that is used as input to create the target.
Page: https://www.gnu.org/software/make/manual/html_node/Rule-Introduction.html#Rule-Introduction
Chapter: 2
Section: 1

Name: A recipe
Definition: an action that Make carries out.
Page: https://www.gnu.org/software/make/manual/html_node/Rule-Introduction.html#Rule-Introduction
Chapter: 2
Section: 1

Variable: .RECIPEPREFIX
Meaning: The prefix of an instruction of a recipe
Page: https://www.gnu.org/software/make/manual/html_node/Rule-Introduction.html#Rule-Introduction
Language: gnu make
Section: 1
Chapter: 2
Initialization: tab

Name: A rule
Definition: A target/some files
Page: https://www.gnu.org/software/make/manual/html_node/Rule-Introduction.html#Rule-Introduction
https://www.gnu.org/software/make/manual/html_node/Combine-By-Prerequisite.html#Combine-By-Prerequisite
Chapter: 2
Section: 1, 6
Definition2: A prerequisite
Conjdef: A tuple with
Definition3: A recipe

Instruction: target … : prerequisites …
        recipe
        …
        …
Page: https://www.gnu.org/software/make/manual/html_node/Rule-Introduction.html#Rule-Introduction
Effect: State that, if target is called, and is not up to date with prerequisites, recipe must be executed
Language: make
Chapter: 2
Section: 1

Instruction: make foo
Page: https://www.gnu.org/software/make/manual/html_node/Simple-Makefile.html#Simple-Makefile
Effect: apply the rule named foo contained in MakeFile
Language: gnu make
Chapter: 2

Name: phony target
Definition: A target, without prerequisite
Page: https://www.gnu.org/software/make/manual/html_node/Simple-Makefile.html#Simple-MakefileU
Chapter: 2

Instruction: \
Page: https://www.gnu.org/software/make/manual/html_node/Simple-Makefile.html#Simple-Makefile
Effect: The new line symbol is ignored. The next line is the next part of the current line
Language: gnu make
Chapter: 2

Instruction: make
Page: https://www.gnu.org/software/make/manual/html_node/How-Make-Works.html#How-Make-Works
Effect: Execute the default goal of the file Makefile
Language: gnu make
Chapter: 2

Variable: default goal
Page: https://www.gnu.org/software/make/manual/html_node/How-Make-Works.html#How-Make-Works
Language: gnu make
Section: 2
Initialization: The first goal in the file, not beginning by a dot.

Name: Variable
Definition: allow a text string to be defined once and substituted in multiple places later
Page: https://www.gnu.org/software/make/manual/html_node/Variables-Simplify.html#Variables-Simplify
Chapter: 2
Section: 4

Variable: objects, OBJECTS, objs, OBJS, obj, or OBJ
Meaning: A list of all object file names.
Page: https://www.gnu.org/software/make/manual/html_node/Variables-Simplify.html#Variables-Simplify
Language: gnu make
Section: 4
Chapter: 2
Typ: recipe

Instruction: foo = bar
Page: https://www.gnu.org/software/make/manual/html_node/Variables-Simplify.html#Variables-Simplify
Effect: Create a variable named foo whose value is bar
Language: gnu make
Chapter: 2
Section: 4

Instruction: $(foo)
Page: https://www.gnu.org/software/make/manual/html_node/make-Deduces.html#make-Deduces
Effect: The value of the variable foo
Language: gnu make
Chapter: 2
Section: 5
Extra: end of chapter 2

Question: When a rule has no recipe
Answer: make use the default recipe for this extension
Page: https://www.gnu.org/software/make/manual/html_node/make-Deduces.html#make-Deduces
Chapter: 2
Section: 4
Example: for foo.o it uses cc -c foo.c -o foo.o

Question: What to do with clean
Answer: Use a phony target, in case there is a file named clean
Page: https://www.gnu.org/software/make/manual/html_node/Cleanup.html#Cleanup
Chapter: 2
Section: 7
Answer2: Don't put it as first target

Language: gnu make
Instruction: #foo
Other fields (not shown on cards):
Chapter: 3
Page: https://www.gnu.org/software/make/manual/html_node/Cleanup.html#Cleanup
Section: 1

Instruction: \#
Page: https://www.gnu.org/software/make/manual/html_node/Cleanup.html#Cleanup
Effect: A # not starting a comment
Language: gnu make
Chapter: 3
Section: 1

Variable: GNUmakefile
Meaning: A file for make, used only if make is the gnu version, ignored by other make
Page: https://www.gnu.org/software/make/manual/html_node/Cleanup.html#Cleanup
Language: gnu make
Section: 2
Chapter: 3
Typ: file

Variable: makefile, Makefile
Meaning: A file used by make by default
Page: https://www.gnu.org/software/make/manual/html_node/Cleanup.html#Cleanup
Language: gnu make
Section: 2
Chapter: 3
Typ: file

Fla: -file foo
Effect: State to use file foo for make
Page: https://www.gnu.org/software/make/manual/html_node/Cleanup.html#Cleanup
Prefix: gnu make
Flag abbreviation: -f foo
Chapter: 3
Section: 2

Instruction: include foo_1 ... foo_n
Page: https://www.gnu.org/software/make/manual/html_node/Cleanup.html#Cleanup
Effect: Make reads each file foo_i in order, as if it where in the current file
Language: gnu make
Chapter: 3
Section: 2

Variable: MAKEFILES
Meaning: A list of files which must be read before the others
Page: https://www.gnu.org/software/make/manual/html_node/MAKEFILES-Variable.html#MAKEFILES-Variable
Language: gnu make
Section: 4
Chapter: 3
Typ: environment variables

Question: What happen if one of the file read by makefile is a target of make ?
Answer: Each such targets are made again, and then make restart. (Except for targets with double colon, no prerequisite and a recipe)
Page: https://www.gnu.org/software/make/manual/html_node/Remaking-Makefiles.html#Remaking-Makefiles
Chapter: 3
Section: 5

Instruction: %
Page: https://www.gnu.org/software/make/manual/html_node/Overriding-Makefiles.html#Overriding-Makefiles
Effect: Target which match any file not matched before
Language: gnu make
Context: make target
Chapter: 3
Section: 6

Question: How to state in a makefile how to do target foo, and use every other target as in another makefile
Answer: foo:
frobnicate > foo
%: force
@$(MAKE) -f Makefile $@
force: ;
Page: https://www.gnu.org/software/make/manual/html_node/Overriding-Makefiles.html#Overriding-Makefiles
Chapter: 3
Section: 6

Name: An immediate expension
Definition: An expension of variable appening during make's first phase
Page: https://www.gnu.org/software/make/manual/html_node/Reading-Makefiles.html#Reading-Makefiles
Chapter: 3
Section: 7

Name: A deferred expension
Definition: during make's second phase
Page: https://www.gnu.org/software/make/manual/html_node/Reading-Makefiles.html#Reading-Makefiles
Chapter: 3
Section: 7
Definition2: during an immediate deferrence happening later
Conjdef: An expension of variable appening either

Instruction: .SECONDEXPANSION
Page: https://www.gnu.org/software/make/manual/html_node/Secondary-Expansion.html#Secondary-Expansion
Effect: Prerequisite of rules occurring later are expended a second time after the end of the current of the first phase of make
Language: gnu make
Chapter: 3
Section: 8

Instruction: $$(foo)
Page: https://www.gnu.org/software/make/manual/html_node/Secondary-Expansion.html#Secondary-Expansion
Effect: Expand variable foo during the second expansion and not the first one
Language: gnu make
Chapter: 3
Section: 8
Extra: Go back here after other instructions are known