Skip to content

Instantly share code, notes, and snippets.

@qgp9
Created July 25, 2019 10:03
Show Gist options
  • Save qgp9/e8f023538e04234ecca5316ba9b54af0 to your computer and use it in GitHub Desktop.
Save qgp9/e8f023538e04234ecca5316ba9b54af0 to your computer and use it in GitHub Desktop.
Makefile export and override
foo ?= default
override foo += added
export foo
all::
@echo outer: foo is "$(foo)"
@$(MAKE) -s -f sub-make.mk
# Variable 'foo' was "exported" from the top-level Makefile.
all::
@echo inner: foo is "$(foo)"
set -x
# Q1
make
# Q2
foo=env make
# Q3
make foo=cmd
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment