Make: Difference between revisions

intro
 
No edit summary
 
(2 intermediate revisions by 2 users not shown)
Line 1: Line 1:
[[File:Text-x-makefile.svg]]
[[File:Text-x-makefile.svg|right]]


== Intro ==
== Intro ==
Line 30: Line 30:


== 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]]