forked from andrewsoong/lis-test
-
Notifications
You must be signed in to change notification settings - Fork 0
/
compile
executable file
·90 lines (84 loc) · 2.11 KB
/
compile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
#!/bin/sh
#-----------------------BEGIN NOTICE -- DO NOT EDIT-----------------------
# NASA Goddard Space Flight Center Land Information System (LIS) v7.2
#
# Copyright (c) 2015 United States Government as represented by the
# Administrator of the National Aeronautics and Space Administration.
# All Rights Reserved.
#-------------------------END NOTICE -- DO NOT EDIT-----------------------
# add new option
# add another option
while getopts ":hdj:" opt
do
case $opt in
h)
echo "Usage: ./compile.sh [-h] [-d] [-j jobs]"
echo ""
echo " -h"
echo " Prints this help and exits."
echo ""
echo " -j jobs"
echo " Specifies the number of make jobs to run."
echo " See man make(1)".
echo ""
echo " -d"
echo " Generate all dependencies up front."
echo " (Recommended for Cray systems.)"
exit 0
;;
j)
njobs="-j $OPTARG"
;;
d)
all_deps_first="YES"
;;
\?)
echo "Invalid option: -$OPTARG" >&2
echo "Run './compile -h' for more help."
exit 1
;;
:)
echo "Option -$OPTARG requires an argument." >&2
echo "Run './compile -h' for more help."
exit 1
;;
esac
done
dashes="-------------------------------------------------------------------"
echo $dashes
echo "Compiling LIS version 7.2r..."
echo ""
if cd ./make
then
echo "[INFO] Compiling LIS source code"
echo ""
if [ "$all_deps_first" = "YES" ]; then
echo "[INFO] Generating all dependencies up front"
make realclean && make depend
fi
make -f Makefile $njobs
if [ $? -eq 0 ]; then
if ! cp LIS ..
then
echo ""
echo "[ERR] Cannot copy LIS executable"
echo $dashes
exit 1
else
echo ""
echo "[INFO] Compile finished"
echo $dashes
fi
else
echo ""
echo "[ERR] Compile failed"
echo $dashes
exit 1
fi
else
echo ""
echo "[ERR] Cannot enter make directory"
echo $dashes
exit 1
fi
exit 0