Make: Difference between revisions

No edit summary
No edit summary
 
(One intermediate revision by the same user not shown)
Line 31: Line 31:
== Learning Make ==
== Learning Make ==
Of course you should read the fine manual.  <code>man make</code>
Of course you should read the fine manual.  <code>man make</code>
[http://mrbook.org/tutorials/make/ Tutorial]
[https://web.archive.org/web/20121027165919/http://mrbook.org/tutorials/make/ Tutorial]
 
=== Assignment Operators ===
 
This issue came up [[Using docker-compose-ci]]
<syntaxhighlight lang="makefile">
VAR = value    # Always assign (overrides previous values)
VAR := value  # Immediate assignment (expands right away)
VAR ?= value  # Conditional (only if not already set)
VAR += value  # Append to existing value
</syntaxhighlight>
 
'''in your makefile'''
<syntaxhighlight lang="makefile">
-include .env          # Load .env if it exists
export
 
COMPOSER_EXT?=        # Use value from .env if present, otherwise empty
NODE_JS?=              # Use value from .env if present, otherwise empty
</syntaxhighlight>
 
So the precendence is:
# <code>.env</code>
# makefile conditional assignment
# export to the environment for the [[Docker]] build


[[Category:Build]]
[[Category:Build]]