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

Joel Sherrill joel.sherrill at
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

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"    
$ echo c | /bin/sed -e "s%\([^ ]\+\)%sparc-rtems/\1%g"               

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:

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

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


Joel Sherrill, Ph.D.             Director of Research & Development
joel at                 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