source: trunk/SRC/Documentation/xmldoc/docompileall.sh @ 412

Last change on this file since 412 was 412, checked in by pinsard, 15 years ago

draft for docompileall.sh, not yet in production

  • Property svn:executable set to *
  • Property svn:keywords set to Id
File size: 4.5 KB
Line 
1#! /bin/sh
2#+
3#
4# NAME
5# ====
6#
7# docompileall.sh - compile all IDL modules which define PRO or FUNCTION
8#
9# SYNOPSIS
10# ========
11#
12# ::
13#
14# $ docompileall.sh -i indir
15#
16# DESCRIPTION
17# ===========
18#
19# ``docompileall.sh`` scans indir to find .pro files  which define PRO or FUNCTION.
20#
21# -i directory input
22#
23# On each file found, idl is asked to ++ compile.
24#
25# By default, indir is the current directory.
26#
27# CAUTIONS
28# ========
29#
30# SAXO_DIR must be set. The value should be the directory where
31# SAXO is available.
32#
33# for example, if you work at LOCEAN and work with default SAXO,
34# SAXO_DIR=/usr/home/smasson/SAXO_DIR/.
35#
36# For working in progress, you should checkout SAXO on a personnal
37# directory and set SAXO_DIR to the working space.
38#
39# example for me : SAXO_DIR=${HOME}/SAXO_DIR_ws/
40
41# EXAMPLES
42# ========
43#
44# For SAXO in working space ${HOME}/SAXO_DIR_ws/ :
45#
46# ::
47#
48# $ ${SAXO_DIR}/SRC/Documentation/xmldoc/docompileall.sh -i ${HOME}/SAXO_DIR_ws/
49#
50# For VARAMMA in working space /usr/home/fplod/incas/varamma/varamma_ws/
51#
52# ::
53#
54# $ ${SAXO_DIR}/SRC/Documentation/xmldoc/docompileall.sh -i /usr/home/fplod/incas/varamma/varamma_ws/
55#
56#
57# For POST_IT in working space /usr/home/fplod/incas/post_it/post_it_ws/
58#
59# ::
60#
61# $ ${SAXO_DIR}/SRC/Documentation/xmldoc/docompileall.sh -i /usr/home/fplod/incas/post_it/post_it_ws/
62#
63# TODO
64# ====
65#
66# exclude .svn directory in find command
67#
68# better handling on DEMO mode (ie information cant check)
69#       
70# EVOLUTIONS
71# ==========
72#
73# $Id$
74#
75# - fplod 20091110T134500Z aedon.locean-ipsl.upmc.fr (Darwin)
76#
77#   * creation from savesaxo.sh docompileall part
78#   * make it work from anywhere
79#
80#-
81#
82system=$(uname)
83case "${system}" in
84 AIX|IRIX64)
85 echo " www : no specific posix checking"
86 ;;
87 *)
88 set -o posix
89 ;;
90esac
91command=$(basename ${0})
92log_date=$(date -u +"%Y%m%dT%H%M%SZ")
93log=/tmp/$(basename ${command} .sh).log.${log_date}
94#
95usage=" Usage : ${command} -i indir"
96#
97minargcount=0 #++
98#echo " narg ${#}"
99if [ ${#} -lt ${minargcount} ]
100then
101 echo "eee : not enought arguments (${#} vs ${minargcount})"
102 echo "${usage}"
103 exit 1
104fi
105#
106# default
107# default IDL command and directory
108idl_command=$(which idl)
109idl_dir=$(dirname ${idl_command})
110#
111# default indir directory
112indir=$(pwd)
113#
114# read parameters on command line
115while [ ! -z "${1}" ]
116do
117 case ${1} in
118 -i)
119 indir=${2}
120 shift
121 ;;
122 -h)
123 echo "${usage}"
124 exit 0
125 ;;
126 *) # other choice
127 echo "${usage}"
128 exit 1
129 ;;
130 esac
131 shift # next flag
132done
133#
134set -u
135#
136# test in ${indir} exist
137if [ ! -d ${indir} ]
138then
139 echo "eee : ${indir} not found"
140 exit 1
141fi
142#
143cat <<EOF > /tmp/docompileall${$}.pro
144; test DEMO mode
145demo_on=LMGR(/DEMO)
146IF demo_on EQ 1 THEN BEGIN
147 exit
148ENDIF
149.reset_session
150;
151!path = expand_path('+' + '${SAXO_DIR}/SRC/') + ':' + expand_path('+' + !dir)
152resolve_all, resolve_either='def_myuniquetmpdir', skip_routines = ['xxx2ps','trends', 'label_gmt']
153resolve_all, resolve_either = 'find', skip_routines = ['xxx2ps','trends', 'label_gmt']
154def_myuniquetmpdir
155oldcm = find('oldcm_empty')
156;oldcm = find('oldcm_full')
157oldcm = oldcm[0]
158@cm_general
159file_copy, oldcm, myuniquetmpdir + 'oldcm_used.pro', /overwrite
160!path = myuniquetmpdir + ':' + !path
161IF !journal NE 0 THEN journal
162journal, myuniquetmpdir + 'cm_demomode_used.pro'
163journal
164path_cache, /rebuild
165;
166resolve_all, resolve_either='keep_compatibility', skip_routines = ['xxx2ps','trends', 'label_gmt']
167;
168EOF
169#
170more /tmp/docompileall${$}.pro
171read a
172# find .pro files
173list_files=$(find ${indir} -name "*.pro" | grep -iv label_gmt | grep -iv report)
174#
175# check if at least one file found
176if [ "${list_files}" = "" ]
177then
178 echo "eee : no . pro files found under ${indir}"
179 exit 1
180fi
181#
182# loop on each file in the list to select PRO and FUNCTION modules
183# ie exclude common files
184for i in ${list_files}
185do
186 # does it contains pro or function ?
187 egrep -iq '^ * *(pro|function)' ${i}
188 if [ ${?} -eq 0 ]
189 then
190  echo "print, '$( basename ${i} .pro ) :'" >> /tmp/docompileall${$}.pro
191  echo "resolve_all, resolve_either = '$( basename ${i} .pro )', skip_routines = ['xxx2ps','trends', 'label_gmt', 'report']" >> /tmp/docompileall${$}.pro
192 fi
193done
194echo "exit" >> /tmp/docompileall${$}.pro
195#
196IDL_STARTUP=/tmp/docompileall${$}.pro
197${idl_command} &> /tmp/docompileallerr_${$}
198grep -i "error" /tmp/docompileallerr_${$}
199# grep -q "Compilation error(s)" /tmp/docompileallerr_${$}
200if [ ${?} -ne 0 ]
201then
202 echo "all files are OK"
203 # clean
204 rm -f /tmp/docompileallerr_${$} /tmp/docompileall${$}.pro
205else
206 grep "Compilation error(s)" /tmp/docompileallerr_${$}
207 echo "eee : see /tmp/docompileallerr_${$}"
208 more /tmp/docompileallerr_${$}
209 exit 1
210fi
211
212# end
213exit 0
Note: See TracBrowser for help on using the repository browser.