OSDN Git Service

Merge branch 'master' of git.sourceforge.jp:/gitroot/eos/base
[eos/base.git] / sbin / dotSourceInMakefileCreate
1 #!/bin/sh
2 #
3 # dotSourceInMakefileCreate  1.1
4 #
5 # The latest update : 01/03/96 at 21:16:33
6 #
7 #@(#) dotSourceInMakefileCreate Function
8 #@(#)
9 #
10 #@(#) Usage : dotSourceInMakefileCreate  fullDirectory  Target World
11 #
12 #@(#) Attention
13 #@(#)
14 #@(#) Parameter: 
15 #@(#)     Essential:
16 #@(#)         SourceFileName
17 #@(#)     Optional:
18 #@(#)
19
20 usage()
21 {
22         echo "Usage: dotSourceInMakefileCreate BaseDirectoryToBeConsidered [AddedTarget] [AddetedWorld] "
23         exit
24 }
25
26 NameRead()
27 {
28         ans="N"
29         while [ $ans != "Y" -a $ans != "y" ]
30         do
31                 echo $1
32                 read Name
33                 echo "$Name is good ?"
34                 read ans
35         done
36 }
37 # Store Flags
38 FlagsCharacter="-"
39
40 case $# in 
41         0)
42                 ;;
43         *)
44                 while [ `echo $1 | cut -c1` = ${FlagsCharacter} ]
45                 do
46                         if [ `echo $1 | cut -c2` = "h" ] 
47                         then
48                                 usage
49                         else
50                                 parms="${parms} $1"
51                                 shift 
52                         fi
53                 done
54                 ;;
55 esac
56
57 #
58 currentDir=`pwd`
59
60 for file in ${filename}
61 do
62         FullName=${currentDir}/${file}  
63         Name=`basename ${FullName}`
64         Dir=`dirname ${FullName}`
65 done
66
67 case $# in
68         0) # No filename 
69                 Full=./ 
70                 ;;
71         1) # 
72                 Full=$1
73                 echo "All world in ${Full} is replaced!!"
74                 ;;
75         2) # 
76                 Full=$1
77                 Target=$2
78                 echo "${Target} in ${Full} is added !!"
79                 ;;
80         3) # 
81                 Full=$1
82                 Target=$2
83                 World=$3
84                 echo "${Target} in ${Full} is added in ${World}!!"
85                 ;;
86         *) #
87                 usage   
88                 ;;
89 esac
90
91 mv -f ${Full}/.Source ${Full}/.Source.org
92 ls -1F ${Full} | awk '
93         BEGIN {
94                 printf("SOURCE=\\\n")
95                 i=0;
96         } 
97         $0 !~ /Test/ && $0 !~ /Closed/ && $0 !~ /Config/ && $0 !~ /CVS/ && /\// {
98                 i++; 
99                 gsub(/\//, "");
100                 printf("%s \\\n", $0);
101         }
102         END {
103                 printf("#LastSource\n");
104         }
105 ' > ${Full}/.Source
106