File: show_compile.sh

package info (click to toggle)
eccodes 2.12.0-1
  • links: PTS, VCS
  • area: main
  • in suites: buster
  • size: 480,184 kB
  • sloc: ansic: 163,815; makefile: 21,266; sh: 8,507; python: 6,026; f90: 5,762; perl: 2,891; yacc: 818; lex: 356; cpp: 305; fortran: 116; awk: 66
file content (49 lines) | stat: -rwxr-xr-x 1,389 bytes parent folder | download
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
#!/bin/sh

# Copyright 2005-2018 ECMWF.
#
# This software is licensed under the terms of the Apache Licence Version 2.0
# which can be obtained at http://www.apache.org/licenses/LICENSE-2.0.
#
# In applying this licence, ECMWF does not waive the privileges and immunities granted to it by
# virtue of its status as an intergovernmental organisation nor does it submit to any jurisdiction.
#

if [ $# -ne 1 ]; then
    echo "Usage: `basename $0` /path/to/ecCodes/installation"
    exit 1
fi

set -e
PACKAGE=eccodes_f90
ECCODES_INSTALL_PATH=$1
ECCODES_PKGCONF_PATH=$ECCODES_INSTALL_PATH/lib/pkgconfig

if [ ! -d "$ECCODES_INSTALL_PATH" ]; then
   echo "Error: Installation path does not exist!" 2>&1
   exit 1
fi
if [ ! -d "$ECCODES_PKGCONF_PATH" ]; then
   echo "Error: Could not find pkgconfig directory in installation path!" 2>&1
   echo "       Expected path: $ECCODES_PKGCONF_PATH" 2>&1
   exit 1
fi

if ! command -v pkg-config >/dev/null 2>&1; then
   echo "Error: cannot find pkg-config command!" 2>&1
   exit 1
fi

export PKG_CONFIG_PATH=$PKG_CONFIG_PATH:$ECCODES_PKGCONF_PATH
LIBS=`pkg-config $PACKAGE --libs`
INCL=`pkg-config $PACKAGE --cflags`
FCMP=`pkg-config $PACKAGE --variable=FC`
CCMP=`pkg-config $PACKAGE --variable=CC`

echo
echo "Compilation for Fortran 90 ..."
echo "$FCMP myprog.f90 $LIBS $INCL"
echo
echo "Compilation for C ..."
echo "$CCMP myprog.c $LIBS $INCL"
echo