On 2012-10-24, Oleksandr Gavenko wrote:

> and all build artefacts has been placed at current dir. Another benefits I
> can change build dir (like this like usual proprietary standard for
> dev-projects, but little trick required to create this dir if it does not
> exist):
>
>   $ cat Makefile
>
>   ifeq '' '${B}'
>     B := $(abspath .)/
>   else
>     $(shell mkdir -p ${B})
>   endif
>
>   $ make B=_build/

I fix above code for production use:

  B := $(abspath .)/
  ifeq '' '$(filter %/,${B})'
    $(error B value must end with slash but actually is '${B}')
  endif
  ifeq '' '$(wildcard ${B})'
    $(shell mkdir -p ${B})
  endif

It handle case when user set B without trailing slash and dynamically create
non-existing dir.

-- 
Best regards!


_______________________________________________
Help-make mailing list
Help-make@gnu.org
https://lists.gnu.org/mailman/listinfo/help-make

Reply via email to