-
package_version := $(version)x0d$(date)
what is the x0d part between version and date vars? is it just string?
-
What $(dotin_files:.in=) does below
code
dotin_files := $(shell find . -type f -name \*.in)
dotin_files := $(dotin_files:.in=)
- what this means $(dotin_files:=.in)
code
$(dotin_files): $(dotin_files:=.in)
$(substitute) $@.in > $@
-
can target contain multiple files?
-
what is the meaning of declaring target variable as PHONY?
code
.PHONY: $(dotin_files)
- In the regex replacement code below
code
substitute := perl -p -e 's/@([^@]+)@/defined $$ENV{$$1} ? $$ENV{$$1} : $$&/ge'
what are $$ENV{$$1} and $$&? I guess it’s Perl scope…
thanks for your time
Variable Expansion
$()is variable expansion in make, this should just be string substitution – if your makefile isthen the variable
package_versionwill expand to1x0d1.1.10.Substitution
The syntax
$(var:a=b)is a substitution reference and will expand tovarwith a suffixasubstituted withb.For example, in
$(faabar)will expand to the stringfaa bar.Multiple Targets
Multiple targets in a make rule is equivalent to having n rules with a single target, eg
is equivalent to
remember that any variables here are expanded.
Phony Targets
The
.PHONYtarget declares that a rule doesn’t produce an actual file, so it will always be built. As always, variables are expanded first. In your case this will expand to something likeEscaping
A dollar sign is an escape character in makefiles, the
$$in your perl example is a literal$, egsubstitutewill be the stringThe dollar signs here are processed by perl, and probably give environment variables (I don’t know perl).