On Tue, Jan 24, 2017 at 01:01:57PM +1000, Theo Buehler wrote:
> We're currently using several idioms for conditionally executing code in
> bsd.obj.mk. I'd like to unify them for the sake of readability and
> consistency.  This was done joint with rpe.

OK rpe@
 
> Index: share/mk/bsd.obj.mk
> ===================================================================
> RCS file: /cvs/src/share/mk/bsd.obj.mk,v
> retrieving revision 1.18
> diff -u -p -r1.18 bsd.obj.mk
> --- share/mk/bsd.obj.mk       24 Jan 2017 02:56:50 -0000      1.18
> +++ share/mk/bsd.obj.mk       24 Jan 2017 02:58:50 -0000
> @@ -33,20 +33,19 @@ obj! _SUBDIRUSE
>               SETOWNER=:; \
>       fi; \
>       [[ -z $$MKDIRS ]] && MKDIRS="mkdir -p"; \
> -     if test $$here != $$subdir ; then \
> +     if [[ $$here != $$subdir ]]; then \
>               dest=${BSDOBJDIR}/$$subdir ; \
>               echo "$$here/${__objdir} -> $$dest"; \
> -             if test ! -L ${__objdir} -o \
> -                 X`readlink ${__objdir}` != X$$dest; \
> +             if [[ ! -L ${__objdir} || `readlink ${__objdir}` != $$dest ]]; \
>                   then \
> -                     if test -e ${__objdir}; then rm -rf ${__objdir}; fi; \
> +                     [[ -e ${__objdir} ]] && rm -rf ${__objdir}; \
>                       ln -sf $$dest ${__objdir}; \
>                       $$SETOWNER ${__objdir}; \
>               fi; \
> -             if test -d ${BSDOBJDIR}; then \
> -                     test -d $$dest || $$MKDIRS $$dest; \
> +             if [[ -d ${BSDOBJDIR} ]]; then \
> +                     [[ -d $$dest ]] || $$MKDIRS $$dest; \
>               else \
> -                     if test -e ${BSDOBJDIR}; then \
> +                     if [[ -e ${BSDOBJDIR} ]]; then \
>                               echo "${BSDOBJDIR} is not a directory"; \
>                       else \
>                               echo "${BSDOBJDIR} does not exist"; \
> @@ -54,7 +53,7 @@ obj! _SUBDIRUSE
>               fi; \
>       else \
>               dest=$$here/${__objdir} ; \
> -             if test ! -d ${__objdir} ; then \
> +             if [[ ! -d ${__objdir} ]]; then \
>                       echo "making $$dest" ; \
>                       $$MKDIRS $$dest; \
>                       $$SETOWNER $$dest; \

Reply via email to