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