hi greg,

On Sun, Apr 19, 2009 at 05:56:46PM -0500, Greg Beaver wrote:
> blasted piece of scripting doesn't work:
>
> @if test "a$(program_prefix)" != "a"; then \
>    PEAR_PREFIX = " -dp php_prefix=$(program_prefix)"; \
> fi
> @if test "a$(program_suffix)" != "a"; then \
>    PEAR_SUFFIX = " -ds php_suffix=$(program_suffix)"; \
> fi

1) you can't put arbitrary shell commands in the body of a makefile: it has
to be part of the rule for a target.
2) you need to remove spaces around the "=" assignment for it to be valid shell
   (or iow you can't mix shell and makefile syntax like that)

>
> install-pear-installer: $(SAPI_CLI_PATH)
>    @$(top_builddir)/sapi/cli/php $(PEAR_INSTALL_FLAGS)  
> $(builddir)/install-pear-nozlib.phar -d "$(peardir)" -b "$(bindir)"  
> $(PEAR_PREFIX) $(PEAR_SUFFIX)
>
>
> What I am trying to do is to pass in those options ONLY if  
> --program_prefix or --program_suffix were specified in the configure 
> line.
>
> Any working solution is appreciated.

here's one way using makefile syntax (not sure if this works with other
than gnu makefiles though)

ifneq(,$(program_prefix))
  PEAR_PREFIX = " -dp php_prefix=$(program_prefix)"; \
endif
ifneq(,$(program_suffix))
  PEAR_SUFFIX = " -ds php_suffix=$(program_suffix)"; \
endif

> install-pear-installer: $(SAPI_CLI_PATH)
>    @$(top_builddir)/sapi/cli/php $(PEAR_INSTALL_FLAGS)  
> $(builddir)/install-pear-nozlib.phar -d "$(peardir)" -b "$(bindir)"  
> $(PEAR_PREFIX) $(PEAR_SUFFIX)

suggestion two, maybe more portable?:

export PEAR_SUFFIX
export PEAR_PREFIX

install-pear-installer: $(SAPI_CLI_PATH)
   @$(top_builddir)/sapi/cli/php $(PEAR_INSTALL_FLAGS) 
$(builddir)/install-pear-nozlib.phar -d "$(peardir)" -b "$(bindir)"  
$${PEAR_PREFIX:- -ds php_prefix=$(program_prefix)} $${PEAR_SUFFIX:- -ds 
php_suffix=$(program_suffix)}

though that mnight have interesting results if program_suffix has a '}' in it...


hth,
        sean

Attachment: signature.asc
Description: Digital signature

Reply via email to