File: codonWinstall

package info (click to toggle)
codonw 1.4.4-4
  • links: PTS, VCS
  • area: main
  • in suites: buster
  • size: 1,060 kB
  • sloc: ansic: 11,227; makefile: 209; sh: 170; perl: 36
file content (271 lines) | stat: -rwxr-xr-x 6,068 bytes parent folder | download | duplicates (5)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
#!/bin/sh
# Adapted from the SRS5 srsinstall script
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# analyse command line and print usage if wrong
#

ERR='codonWinstall: Stopping due to Error'

if [ "$#" = 0 ]; then
  option="all"
elif [ "$1" = "all" ]; then
  option="all"
elif [ "$1" = "clean" ]; then
  option="clean"
elif [ "$1" = "codonw" ]; then
  option="codonw"
elif [ "$1" = "links" ]; then
  option="links"
elif [ "$1" = "cleanall" ]; then
  option="cleanall"
elif [ "$1" = "realclean" ]; then
  option="cleanall"
else
  option="usage"
  echo "unknown option '$1'"
fi

#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# print "usage"
#

if [ "$option" = 'usage' ]; then
  cat << END

  Usage: ./codonWinstall option

  Options:

  all        does a complete installation
  codonw     compile codonw only .. no linked programmes
  links      generate links to pseudo programmes
  clean      removes all object files
  cleanall   removes all the object files, codonW, linked files and Makefile
  realclean  removes all the object files, codonW, linked files and Makefile
  
END
  exit 1
fi

#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

if [ "$option" = 'all' ]; then
  echo "... starting installation of codonW"
fi

#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# put correct "make" and "cc" commands 
#

OS=`uname`

if [ "$OS" = "SunOS" ]; then
    case "`uname -r`" in
	[56]*)   OS='Solaris' ;;
    esac
fi

# some echo commands do not support -n
# generally /usr/bin/echo doesn't but /usr/ucb/echo does, so one can hardwire
# to be independent of users path.
if [ -r /usr/ucb/echo ]; then
  ECHON="/usr/ucb/echo -n"
else
  ECHON="echo -n"
fi

# OSF/1 v4.0 /usr/ucb is symlink to /usr/bin, but /bin/sh has builtin -n
if [ "$OS" = "OSF1" ]; then
  case "`uname -r`" in
    V[4]*)  ECHON="echo -n"
	    # or can
	    #CMD_ENV=bsd ; export CMD_ENV
    ;;
  esac
fi

# we did our best, but now let's test
ECHONT="`$ECHON | wc -c`"
if [ $ECHONT != 0 ]; then
  ECHONEND="\c"
  ECHON=echo
else
  ECHONEND=""
fi


if [ ! -f "Makefile" ]; then

  $ECHON "enter the make command [make]: $ECHONEND"
  read makeCom
  if [ "$makeCom" = "" ]; then makeCom='make' ; fi

  # for OSF1 need to know if it is osf1 make or gnu make
  if [ "$OS" = "OSF1" ]; then
	$ECHON "is this OSF1 make [y]: $ECHONEND"
	read OSFmake
	if [ "$OSFmake" = "" ]; then OSFmake='y' ; fi
  fi

  if [ "$OS" = "SunOS" -o "$OS" = "Solaris" ]; then
    ccComDef='gcc'
  else
    ccComDef='cc'    
  fi

  $ECHON "enter the cc command [${ccComDef}]: $ECHONEND"
  read ccCom

  if [ "$ccCom" = "" ]; then ccCom="$ccComDef" ; fi

  echo 'choose between optimised code, or code for debugging'
  $ECHON "optimised code [y]: $ECHONEND"
  read optimCom
  if [ "$optimCom" = "" ]; then optimCom="y" ; fi


  $ECHON "enter the link command [ln]: $ECHONEND"
  read ccLn

  if [ "$ccLn" = "" ]; then ccLn="ln -f" ; fi


  $ECHON "Do you want hard or soft links [hard]: $ECHONEND"
  read ccLnflag

  if [ "$ccLnflag" = "" ]; then ccLnflag="hard" ; fi

  echo 'choose between optimised code, or code for debugging'
  $ECHON "optimised code [y]: $ECHONEND"
  read optimCom
  if [ "$optimCom" = "" ]; then optimCom="y" ; fi



  echo "...creating makefile for '$OS'"

#better rename the old makefiles
  if [ -f  "Makefile" ]; then \mv  Makefile Makefile.pre ; fi
  if [ -f  "makefile" ]; then \mv  makefile makefile.pre ; fi
  touch Makefile

# Add the logical parts of the make file

  if [ "$OS" = "OSF1" ]; then
    echo "override cflags  = $(CFLAGS) -g" >> Makefile;
  fi

  if [ "$optimCom" = "y" ]; then
    cflags="-O";
  else
    cflags="-g -DDEBUG" ;
  fi

  if [ "$ccLnflag" = "hard" ]; then
    lncmd=$ccLn;
  else
    lncmd="$ccLn -s";
  fi

 link_prog="rscu cu aau raau tidy reader cutab cutot transl bases base3s dinuc cai fop gc3s gc cbi enc" 

cat <<EOF >> Makefile

objects  = codon_us.o codons.o open_fil.o commline.o menu.o tester.o coresp.o
linked   = $link_prog

CC=$ccComDef
CFLAGS= $cflags -DBSD
LN=$lncmd


all: codonw links   

codonw: $(objects)
	$(CC) $(CFLAGS)  $(objects) -o codonw -lm

clean:
	\rm -f $(objects)

cleanall:
	\rm -f $(objects) codonw Makefile $(linked)

realclean:
	\rm -f $(objects) codonw Makefile $(linked)

codon_us.o: codon_us.c codonW.h 
	$(CC) -c $(CFLAGS) codon_us.c  

menu.o: menu.c codonW.h 
	$(CC) -c $(CFLAGS) menu.c

codons.o: codons.c codonW.h 
	$(CC) -c $(CFLAGS) codons.c

coresp.o: coresp.c codonW.h 
	$(CC) -c $(CFLAGS) coresp.c

open_fil.o:    open_fil.c codonW.h
	$(CC) -c $(CFLAGS) open_fil.c

commline.o:    commline.c codonW.h 
	$(CC) -c $(CFLAGS) commline.c

tester.o:      tester.c codonW.h
	$(CC) -c $(CFLAGS) tester.c

links: codonw
EOF


for file in $link_prog 
do
 echo "\t\t$(LN) codonw $file"  >> Makefile
done

 echo >> Makefile

fi

#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# cleans the object
#

if [ "$option" = 'clean' ]; then
  echo '...cleaning the old object files '
  echo '...make clean'
  make clean
fi
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

if [ "$option" = 'cleanall' -o "$option" = 'realclean' ]; then
  echo '...cleaning the old object files, linked files and executables'
  echo '...make realclean '
  make realclean
fi
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

if [ "$option" = 'all' ]; then
  echo '...Starting to make codonW, with auxillary programs '
  echo '...make all'
  make all
fi
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

if [ "$option" = 'codonw' ]; then
  echo '...checking codonW is up to date'
  echo '...make codonw'
  make codonw
fi
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

if [ "$option" = 'links' ]; then
  echo '... Linking auxilliary programs to  '
  echo '...make links'
  make links
fi
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~