gnu make - Execution flow of Makefile which includes other makefile -
1) how makefile execution flow works, in case suppose makefile-1 includes makefile-2 , makefile-2 includes makefile-3 ?
2) in case if included makefiles contains rules , variables supposed used 3 - how works ? happens if 1 includes same makefile more once ?
3) use of export variables of included makefile ? - available in of there makefile,
what understanding, makefile interpreter(or don't know term suits better here) reads line in makefile, , if there include directive makes variable/rules available in makefile(top level make-which includes other).
4) happens if 2 included makefiles overrides variables or rule of each others ? last included makefile takes priority ?
5) if rule in included makefile calls rule of top level makefile, executes top level makefile entirely (starting first line) ?
6) there 2 kind of assignments in make:
i) expanded @ time of use (=)
ii) expanded @ time of declaration (:=) how kind of variables handles in multilevel makefiles ?
7) happens if use gnumake's functions notdir, patsubt when creates list
file = abc def ghi file += $(notdir ghi/jkl)
when notdir call happens ?
(and if use ':=' difference ?)
consider make contains following rule, gets called @ time when dependency resolved ?
rule : file
nothing special wrt ordering happens when makefile included. make, it's if constructed 1 big makefile contents of included makefile inserted include
statement appears in parent makefile, passed 1 big makefile make.
so, rules overriding things (variables, etc.) identical if override variable in single makefile: each subsequent assignment of variable replaces value of previous assignment.
if define (single-colon) rule recipe target, again later, error message , make ignores 1 of them.
the first explicit target listed in makefile, included or not, default target.
etc.
remember make never "executes" makefile entirely. make not procedural language, shell script. first parses makefiles , constructs dependency graph internally. chooses default target or targets, , walks sections of graph starting each one.
edited:
if above doesn't answer other questions, think should experiment little bit. try , see happens! it's easier asking explain it, plus you'll understand better if figure out yourself.
Comments
Post a Comment