1 |
#! /bin/csh -f |
2 |
|
3 |
# set up $JSOC_MACHINE |
4 |
set JSOC_MACHINE = `build/jsoc_machine.csh` |
5 |
echo "Machine type is $JSOC_MACHINE" |
6 |
echo "" |
7 |
|
8 |
set CLEAN = "no" |
9 |
set CHKLIBS = "no" |
10 |
set CCMD = "c" |
11 |
set LCMD = "l" |
12 |
set LOCALIZE = "L" |
13 |
|
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 |
echo -n "Remove links for local project configuration..." |
25 |
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 |
echo "done" |
42 |
|
43 |
echo -n "Remove links to man pages..." |
44 |
if (-e man) then |
45 |
rm -rf man |
46 |
endif |
47 |
echo "done" |
48 |
|
49 |
echo -n "Removing links to headers..." |
50 |
if (-d base/include) then |
51 |
cd base/include |
52 |
find . -name "*.h" -exec rm {} \; |
53 |
cd ../.. |
54 |
endif |
55 |
|
56 |
if (-d include) then |
57 |
cd include |
58 |
find . -name "*.h" -exec rm {} \; |
59 |
cd .. |
60 |
endif |
61 |
echo "done" |
62 |
|
63 |
echo -n "Removing links to scripts..." |
64 |
if (-d scripts) then |
65 |
cd scripts |
66 |
find . -name "*" -exec rm {} \; |
67 |
cd .. |
68 |
endif |
69 |
echo "done" |
70 |
|
71 |
echo -n "Removing links to jsds..." |
72 |
if (-d jsds) then |
73 |
cd jsds |
74 |
find . -name "*" -exec rm {} \; |
75 |
cd .. |
76 |
endif |
77 |
echo "done" |
78 |
|
79 |
echo |
80 |
|
81 |
if ($CLEAN == "yes") then |
82 |
if (-x base/local/libs/dsds/scripts/rmlinks.csh) then |
83 |
base/local/libs/dsds/scripts/rmlinks.csh |
84 |
endif |
85 |
|
86 |
if (-x base/local/libs/soi/scripts/rmlinks.csh) then |
87 |
base/local/libs/soi/scripts/rmlinks.csh |
88 |
endif |
89 |
else |
90 |
# 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 |
echo -n "Setting links for local project configuration..." |
100 |
if (-e suflag.txt) then |
101 |
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 |
else |
108 |
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 |
endif |
115 |
echo "done" |
116 |
|
117 |
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 |
echo "done" |
124 |
echo |
125 |
|
126 |
echo "Setting links to scripts..." |
127 |
if (!(-d scripts)) then |
128 |
mkdir scripts |
129 |
endif |
130 |
cd scripts |
131 |
|
132 |
# Sums scripts |
133 |
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 |
|
135 |
# Util scripts |
136 |
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 |
|
138 |
# DRMS / IDL-interface scripts |
139 |
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 |
|
141 |
# Project-specific scripts - these won't show up if you don't have the project source. |
142 |
if (-x ../proj/configure) then |
143 |
../proj/configure |
144 |
endif |
145 |
|
146 |
cd .. |
147 |
echo "done" |
148 |
echo |
149 |
|
150 |
echo "Setting links to jsds..." |
151 |
if (!(-d jsds)) then |
152 |
mkdir jsds |
153 |
endif |
154 |
cd jsds |
155 |
find ../base \( -name \*.jsd -exec ln -s {} . \; -a -exec echo " " {} " OK" \; \) -o \( -name \*.jsd -exec echo " " {} " ERROR - couldn't create link" \; \) |
156 |
cd .. |
157 |
echo "done" |
158 |
echo |
159 |
|
160 |
# 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 |
if (-x base/local/libs/dsds/scripts/genlinks.csh) then |
164 |
base/local/libs/dsds/scripts/genlinks.csh |
165 |
endif |
166 |
|
167 |
if (-x base/local/libs/soi/scripts/genlinks.csh) then |
168 |
base/local/libs/soi/scripts/genlinks.csh |
169 |
endif |
170 |
endif |
171 |
|
172 |
echo "done" |
173 |
echo |
174 |
|
175 |
# Site Localization |
176 |
|
177 |
# Path to the configuration file - at some point, make this an argument to the configure script |
178 |
set LOCALIZATIONDIR = "" |
179 |
set conflocal = "config.local" |
180 |
|
181 |
if (-e $conflocal) then |
182 |
set LOCALIZATIONDIR = `perl -n -e 'if ($_ =~ /^LOCALIZATIONDIR\s+(.+)/) { print $1; }' $conflocal` |
183 |
endif |
184 |
|
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 |
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 |
exit 1; |
222 |
else |
223 |
echo "CUSTOM_DEFINES = __LOCALIZED_DEFS__" >> ${LOCALIZATIONDIR}/custom.mk |
224 |
./gen_init.csh |
225 |
./customizemake.pl ./config.local ${LOCALIZATIONDIR} |
226 |
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 |
echo "CUSTOM_DEFINES = __CUSTOMIZED_DEFS__" >> ${LOCALIZATIONDIR}/custom.mk |
241 |
|
242 |
# update custom.mk with data from config.local |
243 |
./customizemake.pl ./config.local ${LOCALIZATIONDIR} |
244 |
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 |
# Custom make variable values - these will override the values set in moreconfigure.pl |
261 |
# echo "JSOC_COMPILER = gcc" >> custom.mk |
262 |
# echo "JSOC_FCOMPILER = gfortran" >> custom.mk |
263 |
# echo "DRMS_DEFAULT_RETENTION = -10" >> custom.mk |
264 |
|
265 |
endif |
266 |
else |
267 |
# $CHKLIBS == "yes" |
268 |
# Enter required library names and versions here. |
269 |
|
270 |
|
271 |
endif |
272 |
|