1# $NetBSD: opt-env.mk,v 1.3 2022/01/23 16:09:38 rillig Exp $ 2# 3# Tests for the -e command line option. 4 5# The variable FROM_ENV is defined in ./Makefile. 6 7.MAKEFLAGS: -e 8 9.if ${FROM_ENV} != value-from-env 10. error ${FROM_ENV} 11.endif 12 13# Try to override the variable; this does not have any effect. 14FROM_ENV= value-from-mk 15.if ${FROM_ENV} != value-from-env 16. error ${FROM_ENV} 17.endif 18 19# Try to append to the variable; this also doesn't have any effect. 20FROM_ENV+= appended 21.if ${FROM_ENV} != value-from-env 22. error ${FROM_ENV} 23.endif 24 25# The default assignment also cannot change the variable. 26FROM_ENV?= default 27.if ${FROM_ENV} != value-from-env 28. error ${FROM_ENV} 29.endif 30 31# Neither can the assignment modifiers. 32.if ${FROM_ENV::=from-condition} 33.endif 34.if ${FROM_ENV} != value-from-env 35. error ${FROM_ENV} 36.endif 37 38# Even .undef doesn't work since it only affects the global scope, 39# which is independent from the environment variables. 40.undef FROM_ENV 41.if ${FROM_ENV} != value-from-env 42. error ${FROM_ENV} 43.endif 44 45all: .PHONY 46