summaryrefslogtreecommitdiff
path: root/lib/make/known-architectures/aix
blob: 1f0036fd688e692ac8ec1763426eb2e4e8c69a7e (plain)
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
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
#! /bin/sh
#  /*@@
#    @file      aix
#    @date      Wed Jul 14 12:38:45 1999
#    @author    Tom Goodale
#    @desc
#               Known-architectures file for IBM AIX systems
#    @enddesc
#    @version   $Header$
#  @@*/

if test "$CCTK_CONFIG_STAGE" = 'preferred-compilers' ; then

  # default to building 64-bit executables using the native AIX compilers
  if test -z "$AIX_BITS" ; then
    AIX_BITS=64
  fi

  if test -z "$CC"; then
    echo Setting C compiler to xlc
    CC=xlc_r
  fi

  if test -z "$CXX"; then
    echo Setting C++ compiler to xlC
    CXX=xlC_r
  fi

  # use the Cactus preprocessor for Fortran
  if test -z "$FPP"; then
    FPP='$(PERL) $(CCTK_HOME)/lib/sbin/cpp.pl'
    echo Setting FPP to $FPP
  fi

else

  if test "X$AIX_BITS" != 'X32' -a "X$AIX_BITS" != 'X64' ; then
    echo "Invalid setting '$AIX_BITS' for AIX_BITS (must be either '32' or '64')"
    exit 1
  fi

  : ${ARFLAGS="-X$AIX_BITS -rucs"}

  : ${F90FLAGS="-q$AIX_BITS -qmaxmem=-1 -qspill=10000"}
  : ${F77FLAGS="-q$AIX_BITS -qmaxmem=-1 -qfixed"}
  : ${F90_OPTIMISE_FLAGS='-O5'}
  : ${F77_OPTIMISE_FLAGS='-O5'}
  : ${F90_DEBUG_FLAGS='-g'}
  : ${F77_DEBUG_FLAGS='-g'}

  : ${F90_SUFFIX='f'}
  CCTK_WriteLine make.arch.defn 'F90FLAGS += $(AIX_$(subst .,,$(suffix $<))_FLAGS)'
  CCTK_WriteLine make.arch.defn 'AIX_F90_FLAGS ='
  CCTK_WriteLine make.arch.defn 'AIX_f90_FLAGS ='
  CCTK_WriteLine make.arch.defn 'AIX_F_FLAGS = -qfixed'
  CCTK_WriteLine make.arch.defn 'AIX_f_FLAGS = -qfixed'
  FPP='$(PERL) $(CCTK_HOME)/lib/sbin/cpp.pl'

  case "$CC" in
    gcc)
     : ${C_DEPEND_OUT=' > $@'}
     ;;
    cc|xlc|xlc_r)
     : ${C_DEPEND='$(CC) -E -M $(CPPFLAGS)'}
     : ${C_DEPEND_OUT=' > /dev/null ; mv $(basename $(basename $@)).u $@'}
     : ${CFLAGS="-q$AIX_BITS -qspill=17000 -qmaxmem=-1"}
     ;;
    *)
     ;;
  esac

  case "$CXX" in
    'g++'|'c++')
     : ${CXX_DEPEND_OUT=' > $@'}
     ;;
    xlC|xlC_r)
     : ${CXX_DEPEND='$(CXX) -E -M $(CPPFLAGS)'}
     : ${CXX_DEPEND_OUT=' > /dev/null ; mv $(basename $(basename $@)).u $@'}
     : ${CXXFLAGS="-q$AIX_BITS -qspill=10000 -qmaxmem=-1"}
     ;;
    *)
     ;;
  esac

  : ${F_DEPEND='$(PERL) $(CCTK_HOME)/lib/sbin/cpp.pl -M $(CPPFLAGS)'}
  : ${F77_DEPEND=$F_DEPEND}

  if test -z "$LIBS" -a "$LD" != 'xlf90' ; then
    LIBS=xlf90
    if test -r /usr/lib/libxlopt.a ; then
      LIBS="$LIBS xlopt"
    fi
  fi

  # in 32-bit mode: allow each process to use up to 2 GB of virtual memory
  # (default is only 256 MB)
  if test "$LD" != 'g++' -a "$LD" != 'c++'; then
    if test "$AIX_BITS" = 32; then
      : ${LDFLAGS="-q$AIX_BITS -bmaxdata:0x80000000"}
    else
      : ${LDFLAGS="-q$AIX_BITS"}
    fi
  fi

  # MPI stuff

  if test -n "$MPI" ; then
    # must not set linker flags for 64-bit configurations
    # (LD will figure these out)
    if test "X$AIX_BITS" = "X32" ; then
      NATIVE_MPI_LIBS='mpi'
      NATIVE_MPI_LIB_DIRS='/usr/lpp/ppe.poe/lib'
    else
      NATIVE_MPI_LIBS=' '
    fi
    NATIVE_MPI_INC_DIRS='/usr/lpp/ppe.poe/include'
    if test "X$MPI" = 'XNATIVE' ; then
      case "$CC:$CXX" in
        "xlc:xlC"|"cc:xlC")
          LD="mpCC -q$AIX_BITS"
          ;;
        "xlc_r:xlC_r")
          LD="mpCC_r -q$AIX_BITS"
          ;;
         *)
        echo 'NATIVE MPI requires xlc and xlC'
        echo 'Please reconfigure with these compilers'
        exit 1
         ;;
      esac
    fi
  fi

fi