include/
[external/binutils.git] / sim / common / gentvals.sh
index 3f837a2..6dd7315 100644 (file)
@@ -1,12 +1,13 @@
 #!/bin/sh
-# Usage: gentvals.sh type dir files pattern cpp
+# Usage: gentvals.sh target type dir files pattern cpp
 
-type=$1
-dir=$2
+target=$1
+type=$2
+dir=$3
 # FIXME: Would be nice to process #include's in these files.
-files=$3
-pattern=$4
-cpp=$5
+files=$4
+pattern=$5
+cpp=$6
 
 # FIXME: need trap to remove tmp files.
 
@@ -36,16 +37,38 @@ do
        echo "#endif" >>tmpvals.h
 done
 
-echo "#ifdef ${type}_defs"
+if test -z "$target"
+then
+       echo "#ifdef ${type}_defs"
+else
+       echo "#ifdef NL_TARGET_$target"
+       echo "#ifdef ${type}_defs"
+fi
+
 for f in $files
 do
        if test -f $dir/$f ; then
                echo "/* from $f */"
        fi
 done
-echo "/* begin $type target macros */"
-$cpp tmpvals.h | grep DEFVAL | sed -e 's/DEFVAL//' -e 's/  / /'
-echo "/* end $type target macros */"
-echo "#endif"
+
+if test -z "$target"
+then
+       echo "/* begin $type target macros */"
+else
+       echo "/* begin $target $type target macros */"
+fi
+
+$cpp -I$dir tmpvals.h | grep DEFVAL | sed -e 's/DEFVAL//' -e 's/  / /'
+
+if test -z "$target"
+then
+       echo "/* end $type target macros */"
+       echo "#endif"
+else
+       echo "/* end $target $type target macros */"
+       echo "#endif"
+       echo "#endif"
+fi
 
 rm -f tmpvals.list tmpvals.uniq tmpvals.h