1 arta 1.1 #! /bin/csh -f
2
|
3 arta 1.26 # set up $JSOC_MACHINE
4 set JSOC_MACHINE = `build/jsoc_machine.csh`
5 echo "Machine type is $JSOC_MACHINE"
6 echo ""
|
7 arta 1.24
|
8 arta 1.1 set CLEAN = "no"
9 set CHKLIBS = "no"
10 set CCMD = "c"
11 set LCMD = "l"
|
12 arta 1.51 set LOCALIZE = "L"
|
13 arta 1.1
|
14 arta 1.60 set CUSTOMDEFSFILE = ""
15
|
16 arta 1.1 foreach ARG ($argv)
17 set FLAG = `echo $ARG | awk '{print substr($0, 2)}'`
18 if ($FLAG == $CCMD) then
19 set CLEAN = "yes"
20 else if ($FLAG == $LCMD) then
21 set CHKLIBS = "yes"
22 endif
23 end
24
25 if ($CHKLIBS == "no") then
|
26 arta 1.5 echo -n "Remove links for local project configuration..."
|
27 arta 1.47 if (-d proj) then
28 cd proj
29 if (-e configure) then
30 rm configure
31 endif
32 if (-e make_basic.mk) then
33 rm make_basic.mk
34 endif
35 if (-e Rules.mk) then
36 rm Rules.mk
37 endif
38 if (-e target.mk) then
39 rm target.mk
40 endif
41 cd ..
42 endif
|
43 arta 1.5 echo "done"
44
|
45 arta 1.1 echo -n "Remove links to man pages..."
|
46 arta 1.47 if (-e man) then
47 rm -rf man
48 endif
|
49 arta 1.1 echo "done"
50
51 echo -n "Removing links to headers..."
|
52 arta 1.10 if (-d base/include) then
|
53 arta 1.47 cd base/include
54 find . -name "*.h" -exec rm {} \;
55 cd ../..
|
56 arta 1.1 endif
|
57 arta 1.19
58 if (-d include) then
|
59 arta 1.47 cd include
60 find . -name "*.h" -exec rm {} \;
61 cd ..
|
62 arta 1.19 endif
|
63 arta 1.1 echo "done"
64
65 echo -n "Removing links to scripts..."
66 if (-d scripts) then
|
67 arta 1.47 cd scripts
68 find . -name "*" -exec rm {} \;
69 cd ..
|
70 arta 1.1 endif
71 echo "done"
72
73 echo -n "Removing links to jsds..."
74 if (-d jsds) then
|
75 arta 1.47 cd jsds
76 find . -name "*" -exec rm {} \;
77 cd ..
|
78 arta 1.1 endif
79 echo "done"
80
81 echo
82
83 if ($CLEAN == "yes") then
|
84 arta 1.10 if (-x base/local/libs/dsds/scripts/rmlinks.csh) then
85 base/local/libs/dsds/scripts/rmlinks.csh
|
86 arta 1.1 endif
87
|
88 arta 1.10 if (-x base/local/libs/soi/scripts/rmlinks.csh) then
89 base/local/libs/soi/scripts/rmlinks.csh
|
90 arta 1.1 endif
91 else
|
92 arta 1.53 # Make include directories here, since they are used by multiple script blocks below
93 if (!(-d base/include)) then
94 mkdir -p base/include
95 endif
96
97 if (!(-d include)) then
98 mkdir -p include
99 endif
100
|
101 arta 1.5 echo -n "Setting links for local project configuration..."
|
102 arta 1.6 if (-e suflag.txt) then
|
103 arta 1.10 cd proj
104 ln -sf ../projconf/su/configure configure
105 ln -sf ../projconf/su/make_basic.mk make_basic.mk
106 ln -sf ../projconf/su/Rules.mk Rules.mk
107 ln -sf ../projconf/su/target.mk target.mk
108 cd ..
|
109 arta 1.6 else
|
110 arta 1.10 cd proj
111 ln -sf ../projconf/ex/configure configure
112 ln -sf ../projconf/ex/make_basic.mk make_basic.mk
113 ln -sf ../projconf/ex/Rules.mk Rules.mk
114 ln -sf ../projconf/ex/target.mk target.mk
115 cd ..
|
116 arta 1.5 endif
117 echo "done"
118
|
119 arta 1.13 echo "Setting links to man pages..."
120 if (-d /home/jsoc/man) then
121 if (!(-e man)) then
122 ln -s /home/jsoc/man man
123 endif
124 endif
|
125 arta 1.1 echo "done"
|
126 arta 1.52 echo
|
127 arta 1.1
128 echo "Setting links to scripts..."
|
129 arta 1.47 if (!(-d scripts)) then
130 mkdir scripts
131 endif
|
132 arta 1.1 cd scripts
|
133 arta 1.3
134 # Sums scripts
|
135 arta 1.10 find ../base/sums/scripts -mindepth 1 \( -path \*CVS -prune -o -exec ln -s {} . \; -a -exec echo " " {} " OK" \; \) -o -exec echo " " {} " ERROR - couldn't create link" \;
|
136 arta 1.3
137 # Util scripts
|
138 arta 1.10 find ../base/util/scripts -mindepth 1 \( -path \*CVS -prune -o -exec ln -s {} . \; -a -exec echo " " {} " OK" \; \) -o -exec echo " " {} " ERROR - couldn't create link" \;
|
139 arta 1.3
|
140 arta 1.59 # Export scripts
141 find ../base/export/scripts -mindepth 1 \( -path \*CVS -prune -o -exec ln -s {} . \; -a -exec echo " " {} " OK" \; \) -o -exec echo " " {} " ERROR - couldn't create link" \;
142
|
143 arta 1.9 # DRMS / IDL-interface scripts
|
144 arta 1.10 find ../base/drms/scripts -mindepth 1 \( -path \*CVS -prune -o -exec ln -s {} . \; -a -exec echo " " {} " OK" \; \) -o -exec echo " " {} " ERROR - couldn't create link" \;
|
145 arta 1.9
|
146 arta 1.4 # Project-specific scripts - these won't show up if you don't have the project source.
|
147 arta 1.10 if (-x ../proj/configure) then
148 ../proj/configure
|
149 arta 1.4 endif
|
150 arta 1.3
|
151 arta 1.1 cd ..
152 echo "done"
153 echo
154
155 echo "Setting links to jsds..."
|
156 arta 1.47 if (!(-d jsds)) then
157 mkdir jsds
158 endif
|
159 arta 1.1 cd jsds
|
160 arta 1.10 find ../base \( -name \*.jsd -exec ln -s {} . \; -a -exec echo " " {} " OK" \; \) -o \( -name \*.jsd -exec echo " " {} " ERROR - couldn't create link" \; \)
|
161 arta 1.1 cd ..
162 echo "done"
163 echo
|
164 arta 1.14
|
165 arta 1.1 # generate links for DSDS/SOI dynamic libraries - only do this if
166 # user's environment has access to /home/soi/CM
167 if (-d /home/soi/CM/include && -d /home/soi/CM/src) then
|
168 arta 1.10 if (-x base/local/libs/dsds/scripts/genlinks.csh) then
169 base/local/libs/dsds/scripts/genlinks.csh
|
170 arta 1.1 endif
171
|
172 arta 1.10 if (-x base/local/libs/soi/scripts/genlinks.csh) then
173 base/local/libs/soi/scripts/genlinks.csh
|
174 arta 1.1 endif
175 endif
|
176 arta 1.53
|
177 arta 1.57 echo "done"
178 echo
179
|
180 arta 1.53 # Site Localization
|
181 arta 1.57
182 # Path to the configuration file - at some point, make this an argument to the configure script
|
183 arta 1.58 set LOCALIZATIONDIR = ""
|
184 arta 1.57 set conflocal = "config.local"
|
185 arta 1.58
186 if (-e $conflocal) then
187 set LOCALIZATIONDIR = `perl -n -e 'if ($_ =~ /^LOCALIZATIONDIR\s+(.+)/) { print $1; }' $conflocal`
188 endif
|
189 arta 1.57
190 if ($LOCALIZATIONDIR == "") then
191 set LOCALIZATIONDIR = ${PWD}/localization
192 endif
193
194 # Eventually, dump all these generated files into a user-specified location.
195 # This script will need to read the config.local file to get the
196 # localization directory. Otherwise, just use JSOC/localization as the default.
197 # We should put custom.mk in the localization directory too.
198 if (!(-d ${LOCALIZATIONDIR})) then
199 mkdir ${LOCALIZATIONDIR}
200 if ($? != 0) then
201 echo "Error creating localization directory."
202 endif
203 endif
204
205 if (-e ${LOCALIZATIONDIR}/custom.mk) then
206 rm ${LOCALIZATIONDIR}/custom.mk
207 endif
208
|
209 arta 1.53 if (!(-e suflag.txt)) then
210 if (!(-e config.local)) then
211 echo "Error: config.local not found. If you have a saved version of this"
212 echo " file from a previous installation, you should copy that into"
213 echo " this directory and rerun configure. Otherwise, copy the file"
214 echo " config.local.template to config.local and edit the config.local"
215 echo " file to contain site-appropriate values."
216 echo
217 echo "*** IMPORTANT *** The edited config.local will contain site-specific"
218 echo " values that should not be modified during subsequent updates to"
219 echo " NetDRMS. Keep a safe copy of it somewhere outside of the DRMS"
220 echo " directory tree, for example in /usr/local. After each NetDRMS"
221 echo " update, ensure this file is in place."
|
222 arta 1.54 exit 1;
|
223 arta 1.53 else
|
224 arta 1.57 echo "CUSTOM_DEFINES = __LOCALIZED_DEFS__" >> ${LOCALIZATIONDIR}/custom.mk
|
225 arta 1.53 ./gen_init.csh
|
226 arta 1.60
227 set CUSTOMDEFSFILE = "base/include/localization.h"
228
229 # run moreconfigure.pl - this script is written in perl because it is easier to do the compiler detection
230 # in perl. It also reads suflag.txt (if it exists) to set the default Stanford values for certain make variables
231 ./moreconfigure.pl -d${LOCALIZATIONDIR} -fcustom.mk -c${CUSTOMDEFSFILE}
232
233 # must follow moreconfigure.pl, because moreconfigure.pl will possibly set the compiler make variables,
234 # which are then referenced by lines in custom.mk generated by customizemake.pl.
|
235 arta 1.57 ./customizemake.pl ./config.local ${LOCALIZATIONDIR}
|
236 arta 1.53 endif
237 else if (-e config.local) then
238 # config.local is optional at Stanford, but it won't necessarily contain the same information that
239 # a NetDRMS config.local contains. The first section contains items that will override the
240 # the items in serverdefs.h. The second section contains items used to populate custom.mk,
241 # which causes make systems variables to be defined that override the default make behavior
242 # (such as overriding the name of the directory to which binary data are written - linux_x86_64_n02
243 # instead of linux_x86_64, for example).
244
245 # Override the defaults defined in serverdefs.h (don't use gen_init.csh as it does several things,
246 # most of which are relevant only to non-SU NetDRMS sites). This script causes all
247 # items included in config.local to override those defined in serverdefs.h, but not all
248 # items need be specified in config.local.
|
249 arta 1.60 echo "CUSTOM_DEFINES = __CUSTOMIZED_DEFS__" >> ${LOCALIZATIONDIR}/custom.mk
|
250 arta 1.53 ./customizedefs.pl
|
251 arta 1.60
252 set CUSTOMDEFSFILE = "base/include/customizeddefs.h"
253
254 # run moreconfigure.pl - this script is written in perl because it is easier to do the compiler detection
255 # in perl. It also reads suflag.txt (if it exists) to set the default Stanford values for certain make variables
256 ./moreconfigure.pl -d${LOCALIZATIONDIR} -fcustom.mk -c${CUSTOMDEFSFILE}
|
257 arta 1.53
258 # update custom.mk with data from config.local
|
259 arta 1.60 # must follow moreconfigure.pl, because moreconfigure.pl will possibly set the compiler make variables,
260 # which are then referenced by lines in custom.mk generated by customizemake.pl.
|
261 arta 1.57 ./customizemake.pl ./config.local ${LOCALIZATIONDIR}
|
262 arta 1.60 else
263 # run moreconfigure.pl - this script is written in perl because it is easier to do the compiler detection
264 # in perl. It also reads suflag.txt (if it exists) to set the default Stanford values for certain make variables
265 ./moreconfigure.pl -d${LOCALIZATIONDIR} -fcustom.mk
|
266 arta 1.53 endif
267
268 echo "Setting links to headers..."
269
270 cd base/include
271 find .. -path '../include' -prune -o -name \*.h \( \( -exec ln -s {} . \; -a -exec echo " " {} " OK" \; \) -o -exec echo " " {} " ERROR - couldn't create link" \; \)
272 cd ../..
273
274 cd include
275 if (-d ../base/include) then
276 find ../base/include -name \*.h -exec ln -s {} . \;
277 endif
278 cd ..
279 echo "done"
280 echo
281
|
282 arta 1.55 # Custom make variable values - these will override the values set in moreconfigure.pl
|
283 arta 1.53 # echo "JSOC_COMPILER = gcc" >> custom.mk
284 # echo "JSOC_FCOMPILER = gfortran" >> custom.mk
|
285 arta 1.55 # echo "DRMS_DEFAULT_RETENTION = -10" >> custom.mk
|
286 arta 1.53
|
287 arta 1.1 endif
|
288 arta 1.53 else
289 # $CHKLIBS == "yes"
290 # Enter required library names and versions here.
|
291 arta 1.1
292
293 endif
|
294 arta 1.33
|