[Dovecot] Re: Dovecot 1.0beta3 - make fails without sql

Chris Wakelin c.d.wakelin at reading.ac.uk
Thu Feb 9 13:41:52 EET 2006


Timo Sirainen wrote:
> On Wed, 2006-02-08 at 16:09 +0000, Chris Wakelin wrote:
>> The problem seems to be in src/lib-sql/Makefile[.in]
>>
>> When there are no sql drivers to build, the shell-script for making
>> sql-drivers-register.c fails.
> 
> Thanks, fixed. It's only a problem with Solaris's /bin/sh though. bash
> and zsh can handle it.
> 

Darn! Solaris still doesn't like it (and it appears to be using bash as
the shell)

---

make sql-drivers-register.c

rm -f sql-drivers-register.c
echo '/* this file automatically generated by Makefile */'
>sql-drivers-register.c
echo '#include "lib.h"' >>sql-drivers-register.c
echo '#include "sql-api.h"' >>sql-drivers-register.c
if [ "" != "" ]; then \
  for i in  ; do \
        echo "extern struct sql_db driver_${i}_db;"
>>sql-drivers-register.c ; \
  done \
fi
bash: -c: line 2: syntax error near unexpected token `;'
*** Error code 2
make: Fatal error: Command failed for target `sql-drivers-register.c'

---

How about :-

sql-drivers-register.c: Makefile
        rm -f $@
        echo '/* this file automatically generated by Makefile */' >$@
        echo '#include "lib.h"' >>$@
        echo '#include "sql-api.h"' >>$@
        for i in $(sql_drivers) null ; do \
          if [ "$${i}" != "null" ]; then \
                echo "extern struct sql_db driver_$${i}_db;" >>$@ ; \
          fi \
        done
        echo 'void sql_drivers_register_all(void) {' >>$@
        for i in $(sql_drivers) null ; do \
          if [ "$${i}" != "null" ]; then \
                echo "sql_driver_register(&driver_$${i}_db);" >>$@ ; \
          fi \
        done
        echo '}' >>$@


I'm not too good at Makefiles (what needs escaping etc.) but it seems to
work, at least on Solaris when $(sql_drivers) is empty ...

Best Wishes,
Chris

-- 
--+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+-
Christopher Wakelin,                           c.d.wakelin at reading.ac.uk
IT Services Centre, The University of Reading,  Tel: +44 (0)118 378 8439
Whiteknights, Reading, RG6 2AF, UK              Fax: +44 (0)118 975 3094


More information about the dovecot mailing list