Skip to content

Instantly share code, notes, and snippets.

@epcim
Created March 30, 2023 11:08
Show Gist options
  • Save epcim/02800b5a4416e5494f60049fa6dd4299 to your computer and use it in GitHub Desktop.
Save epcim/02800b5a4416e5494f60049fa6dd4299 to your computer and use it in GitHub Desktop.
makefile vars from env

scenarios: TMPDIR=new/path make and make TMPDIR=new/path

SHELL  := env TMPDIR=$(TMPDIR) $(SHELL)
TMPDIR ?= "/tmp"

all:
  @echo $(TMPDIR)
TMPDIR := "/tmp"

ifdef $$TMPDIR
TMPDIR := $$TMPDIR
endif

test:
    echo $(TMPDIR)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment