Print this page
9128 cw(1onbld) should be able to run multiple shadows
9129 file-locking tests shouldn't build multiple source files in one compiler invocation
9130 DTrace tst.gcc.d isn't useful
9132 cw(1onbld) shouldn't shadow pure preprocessing
Reviewed by: Toomas Soome <tsoome@me.com>
Reviewed? by: Yuri Pankov <yuripv@yuripv.net>
Reviewed? by: Robert Mustacchi <rm@joyent.com>
Reviewed? by: Jason King <jason.king@joyent.com>


  60 
  61 while getopts "Y" FLAG $*; do
  62         case $FLAG in
  63         Y)
  64                 CC_FLAG="y"
  65                 ;;
  66         *)
  67                 ndrgen_usage
  68                 ;;
  69         esac
  70 done
  71 
  72 if [[ $CC_FLAG = "y" ]] ; then
  73         shift $(($OPTIND - 1))
  74 
  75         if [[ $# -lt 1 ]] ; then
  76                 ndrgen_usage "C pre-processor path is missing"
  77         else
  78                 CC=$1
  79                 shift $(($OPTIND - 1))
  80 
  81                 # Check for cw being invoked with -_cc or -_gcc
  82                 if [[ $1 = "-_cc" || $1 = "-_gcc" ]] ; then
  83                         CC_ARG=$1
  84                         shift $(($OPTIND - 1))
  85                 fi
  86         fi
  87 fi
  88 
  89 if [[ $CC = "" ]] ; then
  90         ndrgen_usage "C pre-processor is not defined"
  91 fi
  92 
  93 if [ ! -f $CC ] || [ ! -x $CC ] ; then



  94         ndrgen_usage "cannot run $CC"
  95 fi
  96 
  97 for i
  98 do
  99         if [[ ! -r $i ]] ; then
 100                 print "$PROGNAME: ERROR: cannot read $i"
 101                 exit 1
 102         fi
 103 
 104         BASENAME=`basename $i .ndl`
 105         TMP_NAME=$BASENAME.ndl.c
 106 
 107         cp $i $TMP_NAME
 108 
 109         if $CC $CC_ARG -E  -D__a64 -D__EXTENSIONS__ -D_FILE_OFFSET_BITS=64 \
 110                 -I. -I${INCDIR} -I${INCDIR}/ndl -DNDRGEN $TMP_NAME | \
 111                 $NDRPROG > $BASENAME.raw
 112         then
 113                 touch ${BASENAME}_ndr.c
 114                 ndrgen_copy_header $i ${BASENAME}_ndr.c
 115 
 116                 cat - << EOF >> ${BASENAME}_ndr.c
 117 /*
 118  * Please do not edit this file.
 119  * It was generated using ndrgen.
 120  */
 121 
 122 #include <strings.h>
 123 #include <smbsrv/ndr.h>
 124 #include <smbsrv/ndl/$BASENAME.ndl>
 125 EOF
 126 
 127                 cat $BASENAME.raw >> ${BASENAME}_ndr.c
 128 
 129                 rm -f $BASENAME.raw


  60 
  61 while getopts "Y" FLAG $*; do
  62         case $FLAG in
  63         Y)
  64                 CC_FLAG="y"
  65                 ;;
  66         *)
  67                 ndrgen_usage
  68                 ;;
  69         esac
  70 done
  71 
  72 if [[ $CC_FLAG = "y" ]] ; then
  73         shift $(($OPTIND - 1))
  74 
  75         if [[ $# -lt 1 ]] ; then
  76                 ndrgen_usage "C pre-processor path is missing"
  77         else
  78                 CC=$1
  79                 shift $(($OPTIND - 1))






  80         fi
  81 fi
  82 
  83 if [[ $CC = "" ]] ; then
  84         ndrgen_usage "C pre-processor is not defined"
  85 fi
  86 
  87 # Remove the non-cw options
  88 CC=${CC%% -- *}
  89 
  90 if [ ! -f ${CC%% *} ] || [ ! -x ${CC%% *} ] ; then
  91         ndrgen_usage "cannot run $CC"
  92 fi
  93 
  94 for i
  95 do
  96         if [[ ! -r $i ]] ; then
  97                 print "$PROGNAME: ERROR: cannot read $i"
  98                 exit 1
  99         fi
 100 
 101         BASENAME=`basename $i .ndl`
 102         TMP_NAME=$BASENAME.ndl.c
 103 
 104         cp $i $TMP_NAME
 105 
 106         if $CC  -E  -D__a64 -D__EXTENSIONS__ -D_FILE_OFFSET_BITS=64 \
 107                 -I. -I${INCDIR} -I${INCDIR}/ndl -DNDRGEN $TMP_NAME | \
 108                 $NDRPROG > $BASENAME.raw
 109         then
 110                 touch ${BASENAME}_ndr.c
 111                 ndrgen_copy_header $i ${BASENAME}_ndr.c
 112 
 113                 cat - << EOF >> ${BASENAME}_ndr.c
 114 /*
 115  * Please do not edit this file.
 116  * It was generated using ndrgen.
 117  */
 118 
 119 #include <strings.h>
 120 #include <smbsrv/ndr.h>
 121 #include <smbsrv/ndl/$BASENAME.ndl>
 122 EOF
 123 
 124                 cat $BASENAME.raw >> ${BASENAME}_ndr.c
 125 
 126                 rm -f $BASENAME.raw