Make: Difference between revisions
m site inactive, replace with archive.org |
No edit summary |
||
| Line 32: | Line 32: | ||
Of course you should read the fine manual. <code>man make</code> | Of course you should read the fine manual. <code>man make</code> | ||
[https://web.archive.org/web/20121027165919/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]] | ||