You are viewing a plain text version of this content. The canonical link for it is here.
Posted to general@xerces.apache.org by Michael Hucka <mh...@bbb.caltech.edu> on 2000/03/09 06:42:44 UTC

Makefile.incl problem under Solaris 2.7 + GNU make

Pardon me if this is the wrong place to send reports of this nature.

I've been trying to build Xerces 1.0.3 on a Solaris 2.7 box using GNU make,
and ran into trouble with the Makefile.incl.  The problem was that make would
generate an error when the recursive makefiles would finally reach a terminal
directory and actually try to compile some files.  Here is an example:

   make[6]: Entering directory `/remote/projects/mws/src/xml/xerces/xerces-1_0_3/src/org/apache/xerces/dom/events'
   if [ -n "" ]; \
   then for i in ;do \
   	echo "make -C $i"; make -C $i; \
        done; \
   fi
   /bin/sh: syntax error at line 1: `;' unexpected
   make[6]: *** [dirs] Error 2

I am not sure why this is happening, but it appears to center on the fact
that when the following code in Makefile.incl is run in a leaf directory,

    dirs::
    	@if [ -n "$(DIRS)" ]; \
    	then for i in $(DIRS);do \
    		echo "$(MAKE) -C $$i"; $(MAKE) -C $$i; \
    	     done; \
    	fi

the DIRS is empty, and the shell (/bin/sh in this case) tries to parse

    if [ -n "" ];
    then for i in ;do
                ^^^^

It looks like the shell isn't stopping when it hits

    if [ -n "" ]

but rather keeps going, encountering 

    for i in ;do

and generating a syntax error.  It's been too long since I've done much shell
script hacking, and I don't remember the parsing rules.  I would have thought
that it would stop when the conditional failed, but apparently it doesn't
(though maybe it's a quirk of the /bin/sh distributed with Solaris 2.7).

My solution to this involved the following changes to Makefile.incl.  There
are probably better solutions, but this seems to work.  (The make fails when
it tries to deal with the docs, but that I think is a different problem.)

Could this (or an equivalent fix) please be added to the Xerces source code
base, so that future releases don't suffer from this problem?

-----------------------------------------------------------------------------
diff -c /projects/mws/src/xml/xerces/xerces-1_0_3/src/Makefile.incl /projects/mws/src/xml/xerces/xerces-1_0_3/src/Makefile.incl.~1~
*** /projects/mws/src/xml/xerces/xerces-1_0_3/src/Makefile.incl	Wed Mar  8 21:25:52 2000
--- /projects/mws/src/xml/xerces/xerces-1_0_3/src/Makefile.incl.~1~	Wed Mar  8 21:25:52 2000
***************
*** 1,11 ****
  # Decide if we're on unix or DOS
! # ifneq ($(findstring WIN,$(shell uname)),)
  # DOS
! # CLPATHSEP := ;
! # else 
  # UNIX
  CLPATHSEP := :
! # endif
  
  #
  # Define the environment commands and/or utilities
--- 1,11 ----
  # Decide if we're on unix or DOS
! ifneq ($(findstring WIN,$(shell uname)),)
  # DOS
! CLPATHSEP := ;
! else 
  # UNIX
  CLPATHSEP := :
! endif
  
  #
  # Define the environment commands and/or utilities
***************
*** 88,110 ****
  
  dirs::
  	@if [ -n "$(DIRS)" ]; \
! 	then \
! 		$(MAKE) subdirs; \
! 	fi; \
! 	$(MAKE) compile
! 
! subdirs::
! 	@for i in $(DIRS) ; do \
  		echo "$(MAKE) -C $$i"; $(MAKE) -C $$i; \
! 	done
  
  cleandirs::
  	@if [ -n "$(DIRS)" ]; \
! 	then \
! 		$(MAKE) subcleandirs; \
! 	fi; \
! 
! subcleandirs::
! 	@for i in $(DIRS);do \
  		echo "$(MAKE) -C $$i clean"; $(MAKE) -C $$i clean; \
! 	done
--- 88,101 ----
  
  dirs::
  	@if [ -n "$(DIRS)" ]; \
! 	then for i in $(DIRS);do \
  		echo "$(MAKE) -C $$i"; $(MAKE) -C $$i; \
! 	     done; \
! 	fi
  
  cleandirs::
  	@if [ -n "$(DIRS)" ]; \
! 	then for i in $(DIRS);do \
  		echo "$(MAKE) -C $$i clean"; $(MAKE) -C $$i clean; \
! 	     done; \
! 	fi

-----------------------------------------------------------------------------
Mike Hucka, Ph.D.   --    mhucka@caltech.edu    --    ph: 626.395.6818
  Postdoctoral researcher, software developer, systems administrator
    GENESIS Development Group, Division of Biology 216-76, Caltech

Re: Makefile.incl problem under Solaris 2.7 + GNU make

Posted by Arundhati Bhowmick <ar...@hyperreal.org>.
What version of gmake were you using? I did try on solaris 2.7 and gmake 3.76.1 and it worked fine.
Arundhati

Michael Hucka wrote:

> Pardon me if this is the wrong place to send reports of this nature.
>
> I've been trying to build Xerces 1.0.3 on a Solaris 2.7 box using GNU make,
> and ran into trouble with the Makefile.incl.  The problem was that make would
> generate an error when the recursive makefiles would finally reach a terminal
> directory and actually try to compile some files.  Here is an example:
>
>    make[6]: Entering directory `/remote/projects/mws/src/xml/xerces/xerces-1_0_3/src/org/apache/xerces/dom/events'
>    if [ -n "" ]; \
>    then for i in ;do \
>         echo "make -C $i"; make -C $i; \
>         done; \
>    fi
>    /bin/sh: syntax error at line 1: `;' unexpected
>    make[6]: *** [dirs] Error 2
>
> I am not sure why this is happening, but it appears to center on the fact
> that when the following code in Makefile.incl is run in a leaf directory,
>
>     dirs::
>         @if [ -n "$(DIRS)" ]; \
>         then for i in $(DIRS);do \
>                 echo "$(MAKE) -C $$i"; $(MAKE) -C $$i; \
>              done; \
>         fi
>
> the DIRS is empty, and the shell (/bin/sh in this case) tries to parse
>
>     if [ -n "" ];
>     then for i in ;do
>                 ^^^^
>
> It looks like the shell isn't stopping when it hits
>
>     if [ -n "" ]
>
> but rather keeps going, encountering
>
>     for i in ;do
>
> and generating a syntax error.  It's been too long since I've done much shell
> script hacking, and I don't remember the parsing rules.  I would have thought
> that it would stop when the conditional failed, but apparently it doesn't
> (though maybe it's a quirk of the /bin/sh distributed with Solaris 2.7).
>
> My solution to this involved the following changes to Makefile.incl.  There
> are probably better solutions, but this seems to work.  (The make fails when
> it tries to deal with the docs, but that I think is a different problem.)
>
> Could this (or an equivalent fix) please be added to the Xerces source code
> base, so that future releases don't suffer from this problem?
>
> -----------------------------------------------------------------------------
> diff -c /projects/mws/src/xml/xerces/xerces-1_0_3/src/Makefile.incl /projects/mws/src/xml/xerces/xerces-1_0_3/src/Makefile.incl.~1~
> *** /projects/mws/src/xml/xerces/xerces-1_0_3/src/Makefile.incl Wed Mar  8 21:25:52 2000
> --- /projects/mws/src/xml/xerces/xerces-1_0_3/src/Makefile.incl.~1~     Wed Mar  8 21:25:52 2000
> ***************
> *** 1,11 ****
>   # Decide if we're on unix or DOS
> ! # ifneq ($(findstring WIN,$(shell uname)),)
>   # DOS
> ! # CLPATHSEP := ;
> ! # else
>   # UNIX
>   CLPATHSEP := :
> ! # endif
>
>   #
>   # Define the environment commands and/or utilities
> --- 1,11 ----
>   # Decide if we're on unix or DOS
> ! ifneq ($(findstring WIN,$(shell uname)),)
>   # DOS
> ! CLPATHSEP := ;
> ! else
>   # UNIX
>   CLPATHSEP := :
> ! endif
>
>   #
>   # Define the environment commands and/or utilities
> ***************
> *** 88,110 ****
>
>   dirs::
>         @if [ -n "$(DIRS)" ]; \
> !       then \
> !               $(MAKE) subdirs; \
> !       fi; \
> !       $(MAKE) compile
> !
> ! subdirs::
> !       @for i in $(DIRS) ; do \
>                 echo "$(MAKE) -C $$i"; $(MAKE) -C $$i; \
> !       done
>
>   cleandirs::
>         @if [ -n "$(DIRS)" ]; \
> !       then \
> !               $(MAKE) subcleandirs; \
> !       fi; \
> !
> ! subcleandirs::
> !       @for i in $(DIRS);do \
>                 echo "$(MAKE) -C $$i clean"; $(MAKE) -C $$i clean; \
> !       done
> --- 88,101 ----
>
>   dirs::
>         @if [ -n "$(DIRS)" ]; \
> !       then for i in $(DIRS);do \
>                 echo "$(MAKE) -C $$i"; $(MAKE) -C $$i; \
> !            done; \
> !       fi
>
>   cleandirs::
>         @if [ -n "$(DIRS)" ]; \
> !       then for i in $(DIRS);do \
>                 echo "$(MAKE) -C $$i clean"; $(MAKE) -C $$i clean; \
> !            done; \
> !       fi
>
> -----------------------------------------------------------------------------
> Mike Hucka, Ph.D.   --    mhucka@caltech.edu    --    ph: 626.395.6818
>   Postdoctoral researcher, software developer, systems administrator
>     GENESIS Development Group, Division of Biology 216-76, Caltech