#!/bin/sh -e # Idea borrowed from RedHat's kernel package # Borrowed from Debian GNU/Linux for sparc64 # Extended for x86-64 and T2 -ReneR # Usage: dir="$1" name1="asm-$2" name2="asm-$3" define="$4" if [ ! -d "$dir" ] ; then echo E: $dir is not a directory. exit 1 fi cd $dir if [ ! -d "$name1" -o ! -d "$name2" ] ; then echo E: $name1 and $name2 must exist, or you will have problems. exit 1 fi if [ ! "$define" ] ; then echo E: No define specified - this will not work. exit 1 fi rm -rf asm mkdir asm for h in `( ls $name1; ls $name2 ) | grep '\.h$' | sort -u`; do name=`echo $h | tr a-z. A-Z_` # common header cat > asm/$h << EOF /* All asm/ files are generated and point to the corresponding * file in $name1 or $name2. */ #ifndef __ASMSTUB__${name}__ #define __ASMSTUB__${name}__ EOF # common for $name1 and $name2 if [ -f $name1/$h -a -f $name2/$h ]; then cat >> asm/$h < #else #include <$name1/$h> #endif EOF # $name1 only elif [ -f $name1/$h ]; then cat >> asm/$h < #endif EOF # $name2 only else cat >> asm/$h < #endif EOF fi # common footer cat >> asm/$h <