opnsense-src/contrib/bmake/unit-tests/envfirst.mk
Simon J. Gerraty dba7b0ef92 Merge bmake-20210206
Changes of interest

  o unit-tests: use private TMPDIR to avoid errors from other users
  o avoid strdup in mkTempFile
  o always use vfork
  o job.c: do not create empty shell files in jobs mode
    reduce unnecessary calls to waitpid
  o cond.c: fix debug output for comparison operators in conditionals
2021-02-10 22:03:22 -08:00

44 lines
1,022 B
Makefile

# $NetBSD: envfirst.mk,v 1.5 2021/02/04 21:42:47 rillig Exp $
#
# The -e option makes environment variables stronger than global variables.
.MAKEFLAGS: -e
.if ${FROM_ENV} != value-from-env
. error ${FROM_ENV}
.endif
# Try to override the variable; this does not have any effect.
FROM_ENV= value-from-mk
.if ${FROM_ENV} != value-from-env
. error ${FROM_ENV}
.endif
# Try to append to the variable; this also doesn't have any effect.
FROM_ENV+= appended
.if ${FROM_ENV} != value-from-env
. error ${FROM_ENV}
.endif
# The default assignment also cannot change the variable.
FROM_ENV?= default
.if ${FROM_ENV} != value-from-env
. error ${FROM_ENV}
.endif
# Neither can the assignment modifiers.
.if ${FROM_ENV::=from-condition}
.endif
.if ${FROM_ENV} != value-from-env
. error ${FROM_ENV}
.endif
# Even .undef doesn't work since it only affects the global scope,
# which is independent from the environment variables.
.undef FROM_ENV
.if ${FROM_ENV} != value-from-env
. error ${FROM_ENV}
.endif
all:
@: nothing