[GRASS-dev] GRASS 6.4.2RC1 planning

Glynn Clements glynn at gclements.plus.com
Wed Sep 28 15:22:22 EDT 2011


Hamish wrote:

[I missed this part in my previous reply.]

> This looks like it will fail if there are spaces in the path names:
> 
> make MODULE_TOPDIR="$GISBASE" \
>    ARCH_INC="-I$GISBASE/include -I${MYINST_DIR}/include -I$TMPDIR/$DIST_DIR/include" \
>    ARCH_LIBPATH="-L$GISBASE/lib -L${MYINST_DIR}/lib -L$TMPDIR/$DIST_DIR/lib" \
> 
> any hints on how to better quote ARCH_INC and ARCH_LIBPATH components?

Single quotes:

make MODULE_TOPDIR="$GISBASE" \
   ARCH_INC="'-I$GISBASE/include' '-I${MYINST_DIR}/include' '-I$TMPDIR/$DIST_DIR/include'" \
   ARCH_LIBPATH="'-L$GISBASE/lib' '-L${MYINST_DIR}/lib' '-L$TMPDIR/$DIST_DIR/lib'" \

This approach will work so long as the variable is only used within
commands. The value (which doesn't include the outer-most double
quotes) will be substituted verbatim (including the single quotes)
into the command which is passed to the shell.

Make itself doesn't have any quoting mechanism, so you can't have
spaces in any path which is used as part of a target or prerequisite,
or an "include" directive, or which is processed by make functions
(patsubst, wildcard, etc).

-- 
Glynn Clements <glynn at gclements.plus.com>


More information about the grass-dev mailing list