From 19500a789f5528395be450dedaa5a96ee2d1df62 Mon Sep 17 00:00:00 2001 From: Martin Wilke Date: Sat, 9 Jun 2012 12:19:12 +0000 Subject: - Add optionsNG make config sanity check support PR: 168480 Submitted by: "Bryan Drewery" Reviewed by: bapt --- Mk/bsd.port.mk | 30 ++++++++++++++++++++++++++---- 1 file changed, 26 insertions(+), 4 deletions(-) (limited to 'Mk') diff --git a/Mk/bsd.port.mk b/Mk/bsd.port.mk index 3f06809d57fd..470a2121b2d3 100644 --- a/Mk/bsd.port.mk +++ b/Mk/bsd.port.mk @@ -5981,18 +5981,39 @@ OPTIONS_WRONG_MULTI+= ${multi} .undef opt .endif #pre-check-config -.if !target(check-config) -check-config: pre-check-config +.if !target(_check-config) +_check-config: pre-check-config .for multi in ${OPTIONS_WRONG_MULTI} @${ECHO_MSG} "====> You must check at least one option in the ${multi} multi" - @exit 1 .endfor .for single in ${OPTIONS_WRONG_SINGLE} @${ECHO_MSG} "====> You must select one and only one option from the ${single} single" - @exit 1 .endfor +.if !empty(OPTIONS_WRONG_MULTI) || !empty(OPTIONS_WRONG_SINGLE) +_CHECK_CONFIG_ERROR= true +.endif +.endif # _check-config + +.if !target(check-config) +check-config: _check-config +.if !empty(_CHECK_CONFIG_ERROR) + @exit 1 +.endif .endif # check-config +.if !target(sanity-config) +sanity-config: _check-config +.if !empty(_CHECK_CONFIG_ERROR) + @echo -n "Config is invalid. Re-edit? [Y/N] "; \ + read answer; \ + case $$answer in \ + [Nn]|[Nn][Oo]) \ + exit 0; \ + esac; \ + ${MAKE} config +.endif +.endif # sanity-config + .if !target(pre-config) pre-config: _COMPLETE_OPTIONS_LIST:= ${ALL_OPTIONS} @@ -6080,6 +6101,7 @@ config: pre-config ${CAT} $${TMPOPTIONSFILE} > ${OPTIONSFILE}; \ fi; \ ${RM} -f $${TMPOPTIONSFILE} + @${MAKE} sanity-config .endif .endif # config -- cgit v1.2.3