#! /bin/sh

############################################################
# Author:             Bobby Philip                         #
# Creation Date:      11/20/2001                           #
# Last Modified Date: 01/30/2008                           #
############################################################

#given a target directory name, creates a list of include subdirectories
#
# this is used to find all subdirectories of ROSE_BUILD/include-staging/BAckendCompiler_HEADERS
# and save them into a list
if [ $# -ne 2 ] 
then
  echo "ERROR: Usage is create_include_path parentdir includedir" 1>&2
  exit 1
else
   origparentdir="$1"
   includedir="$2"
   if [ -d "$origparentdir" ]
   then
     includeString=""
     current_dir=`pwd`
     cd "$origparentdir"
     parent_dir=`pwd`
     for fName in "$includedir"/*
     do
       if [ -d "$fName" ]
       then
         #AS(2/21/07) Changed dirincludes so that edg sees them as
         #system includes and not normal includes. This is important for
         #correct include order (system include directories should be
         #processed after all other directories) and for the handling
         #of the -nostdinc++ and -nostdinc options.
         #includeString="$includeString-I$parent_dir/$fName "
         includeString="$includeString, \"$fName\""
       fi
     done
     cd "$current_dir"
     echo "$includeString"
     exit 0
   else
     echo "ERROR: $1 is not a directory" 1>&2
     exit 1
   fi
fi
