/[MITgcm]/MITgcm_contrib/PRM/build_scripts/pkg_tool/pkg_tool.sh
ViewVC logotype

Annotation of /MITgcm_contrib/PRM/build_scripts/pkg_tool/pkg_tool.sh

Parent Directory Parent Directory | Revision Log Revision Log | View Revision Graph Revision Graph


Revision 1.1.1.1 - (hide annotations) (download) (as text) (vendor branch)
Tue Apr 5 13:18:55 2005 UTC (20 years, 3 months ago) by cnh
Branch: MAIN, baseline
CVS Tags: checkpoint63m, checkpoint63n, initial, HEAD
Changes since 1.1: +0 -0 lines
File MIME type: application/x-sh
Checking in initial PRM setup

1 cnh 1.1 #!/bin/sh
2     #
3     # Shell script to controls building several module files and
4     # then moving them to a common "package" directory.
5     # This script uses the build_mod.sh script to build the
6     # individual module source files.
7     #
8     # Usage:
9     # pkg_tool [build|clean]
10     #
11     # where
12     # pkg_prefix is a character string that is used to prefix
13     # the package.
14     #
15     fc=`which $0`
16     sroot=${fc%/*}
17     . ${sroot}/pkg_tool_funcs.sh
18     build_mod=${sroot}/../mod_tool/mod_tool.sh
19     build_make=${sroot}/../makemake/makemake.pl
20     rootdir=`pwd`
21    
22     # See which action was requested and exit with usage if it isn't
23     # there or is an unrecognised string.
24     action=$1
25     check_action $action
26    
27     # Set name of file standard output is written
28     export STDOUT=pkg_tool.stdout
29     export STDERR=pkg_tool.stderr
30     \rm -fr ${STDOUT} ${STDERR}
31     touch ${STDOUT} ${STDERR}
32     # Set name of file with package name
33     export PKG_NAME_FILE=package_name
34     export BUILD_MOD_F90_OUT_DIR=mod_tool_built_src
35    
36     # Read the package name from ${PKG_NAME_FILE}
37     com='PKG_NAME=`(grep -v '^#' ${PKG_NAME_FILE})`'
38     if [ -r ${PKG_NAME_FILE} ]; then
39     export PKG_NAME=`(grep -v '^#' ${PKG_NAME_FILE}) 2> ${STDOUT}`
40     rc=$?
41     else
42     rc=2
43     fi
44     check_rc_exit $rc "$com" \
45     "Error reading name of package from file \"${PKG_NAME_FILE}\""
46    
47     echo "# Building package \"$PKG_NAME\""
48    
49     if [ "x$action" == "xbuild" ]; then
50    
51     mkdir -p ${PKG_NAME}.pkg
52     MOD_DIR_LIST=${PKG_NAME}.dirlist
53     {
54     while read line ; do
55     is_comment_line $line; rc=$?
56     if [ "x$rc" == "x0" ]; then
57     fname=$line
58     echo "Moving to directory \"$fname\""
59     cd $fname
60     ${build_mod} build
61     cd ${BUILD_MOD_F90_OUT_DIR}
62     cp *.F90 ${rootdir}/${PKG_NAME}.pkg
63     cd $rootdir
64     fi
65     done
66     } < ${MOD_DIR_LIST}
67     cd $rootdir/${PKG_NAME}.pkg
68     ${build_make} ${PKG_NAME} f90
69    
70     fi
71    
72     if [ "x$action" == "xclean" ]; then
73    
74     rm ${PKG_NAME}.pkg/*.F90
75     MOD_DIR_LIST=${PKG_NAME}.dirlist
76     {
77     while read line ; do
78     is_comment_line $line; rc=$?
79     if [ "x$rc" == "x0" ]; then
80     fname=$line
81     echo "Moving to directory \"$fname\""
82     cd $fname
83     ${build_mod} clean
84     fi
85     done
86     } < ${MOD_DIR_LIST}
87     cd $rootdir
88    
89     fi

  ViewVC Help
Powered by ViewVC 1.1.22