top level build problem c instead of "TARGET/c"

Joel Sherrill joel.sherrill at OARcorp.com
Thu May 25 19:25:32 UTC 2000


I have finally reproduced a problem reported multiple times
on the list with beta's.  I have tracked down the 
cause to a specific spot and wanted some feedback on 
my proposed fix.

Does this look familiar to you?

make[1]: Leaving directory `/home/joel/b-rtems/tools'
Making all in c
/bin/bash: c: No such file or directory

I got this on Solaris with CONFIG_SHELL settings of
/bin/sh, ksh, and an old bash. It is because of this 
substitution in the top level Makefile:

target_subdirs = c
...
SUBDIRS = doc make tools c

The "c" subdirectory should be "sparc-rtems/c" in
both cases.  This is what is produced there when this
works.  I tracked this down to the following
sed in the top level configure.in:

TARGET_SUBDIRS=`echo "$target_subdirs" | \
 sed -e "s%\([^ ]\+\)%$target_alias/\1%g"`

Basically sed on some OSes (Solaris in this case is broken).
Look at the output of the following:

$ echo c | /usr2/tools/bin/sed -e "s%\([^ ]\+\)%sparc-rtems/\1%g"    
sparc-rtems/c
$ echo c | /bin/sed -e "s%\([^ ]\+\)%sparc-rtems/\1%g"               
c 

If you tripped this problem and the default sed in your
path fails the above test, then I have explained the failure. :)
My fix is to avoid sed.  This is what I ended up with:

Index: configure.in
===================================================================
RCS file: /usr1/CVS/rtems/configure.in,v
retrieving revision 1.101.2.2
diff -u -r1.101.2.2 configure.in
--- configure.in	2000/05/08 18:59:18	1.101.2.2
+++ configure.in	2000/05/25 19:21:50
@@ -45,10 +45,10 @@
 RTEMS_CONFIG_SUBDIRS(c)
 
 if test "$target_alias" != "$host_alias"; then
-changequote(,)dnl
-TARGET_SUBDIRS=`echo "$target_subdirs" | \
- sed -e "s%\([^ ]\+\)%$target_alias/\1%g"`
-changequote([,])dnl
+TARGET_SUBDIRS=
+for t in $target_subdirs ; do
+  TARGET_SUBDIRS="${TARGET_SUBDIRS} ${target_alias}/${t}"
+done
 else
 TARGET_SUBDIRS="$target_subdirs"
 fi

After applying this patch, you will need to run bootstrap.
[Or edit the generated configure by hand to make the above
substitution]

Comments?


-- 
Joel Sherrill, Ph.D.             Director of Research & Development
joel at OARcorp.com                 On-Line Applications Research
Ask me about RTEMS: a free RTOS  Huntsville AL 35805
   Support Available             (256) 722-9985



More information about the users mailing list