summaryrefslogtreecommitdiff
path: root/lib/make/known-architectures/irix
blob: 3fce7a06c3987ea344920dc88687044267e1e08f (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
135
136
137
138
139
140
141
142
143
144
145
146
147
#! /bin/sh
#  /*@@
#    @file      irix
#    @date      Thu Feb 25 12:20:53 1999
#    @author    Tom Goodale
#    @desc
#               Known architectures file for SGI Irix systems
#    @enddesc
#    @version   $Header: /mnt/data2/cvs2svn/cvs-repositories/Cactus/lib/make/known-architectures/irix,v 1.30 2002-05-08 12:17:05 tradke Exp $
#  @@*/

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

  # extract the CPU type from hinv output
  # (assumes all processors are of equal type :-)
  IRIX_CPU="`hinv -t cpu | tail -1 | sed 's/^[^R]*R\([01-9]*\).*$/\1/'`"

  if test -z "$IRIX_BITS" ; then
    if test -n "`uname | grep 64`" ; then
       IRIX_BITS=64
    else
       IRIX_BITS=32
    fi
  fi

  # use the native SGI compilers by default
  if test -z "$CC"; then
    echo Setting C compiler to cc
    CC='cc'
  fi

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

  if test -z "$LD"; then
    echo Setting linker to CC
    LD='CC'
  fi


else


  # Find out which version of the C++ compiler is installed
  IRIX_CVERSION="`versions c++_dev | grep , | tail -1 | sed 's:.*, ::'`"

  IRIX_CMAJ="`echo $IRIX_CVERSION | sed 's:\([^. ]*\)\.\([^. ]*\).*:\1:'`"
  IRIX_CMIN="`echo $IRIX_CVERSION | sed 's:\([^. ]*\)\.\([^. ]*\).*:\2:'`"

  if test $IRIX_CMAJ -gt 7 -o \( $IRIX_CMAJ -eq 7 -a $IRIX_CMIN -gt 2 \) ; then
    IRIX_CCOMP='new'
  else
    IRIX_CCOMP='old'
  fi

  case "$IRIX_CPU" in
    4???)
       IRIX_FLAGS='-mips3' ;;
    8???)
       IRIX_FLAGS='-mips3' ;;
    10???)
       IRIX_FLAGS='-mips4 -r10000' ;;
    12???)
       if test $IRIX_CCOMP = 'old'; then
         IRIX_FLAGS='-mips4 -r10000'
       else
         IRIX_FLAGS='-mips4 -r12000'
       fi
       ;;
    *)
       IRIX_FLAGS='-mips4' ;;
  esac

  # Find out which version of the Fortran compilers is installed
  IRIX_FVERSION="`versions ftn_dev | grep , | tail -1 | sed 's:.*, ::'`"

  IRIX_FMAJ="`echo $IRIX_FVERSION | sed 's:\([^. ]*\)\.\([^. ]*\).*:\1:'`"
  IRIX_FMIN="`echo $IRIX_FVERSION | sed 's:\([^. ]*\)\.\([^. ]*\).*:\2:'`"

  if test $IRIX_FMAJ -gt 7 -o \( $IRIX_FMAJ -eq 7 -a $IRIX_FMIN -ge 2 \) ; then
    IRIX_FLIBS='fortran ftn ftn90'
  else
    IRIX_FLIBS='ftn ftn90'
  fi

  # now set the compiler flags
  if test $IRIX_BITS = 64; then
    IRIX_BITS_FLAG='-64'
    : ${F90FLAGS="-r10000 -TARG:proc=r10000 $IRIX_BITS_FLAG -mips4"}
    : ${F90_OPTIMISE_FLAGS='-O3 -OPT:roundoff=3:IEEE_arithmetic=3:const_copy_limit=100000'}
    : ${LIBS="malloc perfex fpe $IRIX_FLIBS m"}
  else
    IRIX_BITS_FLAG='-n32'
    : ${F90FLAGS="$IRIX_BITS_FLAG -mips3"}
    : ${F90_OPTIMISE_FLAGS='-O3 -OPT:roundoff=3:IEEE_arithmetic=3:fold_arith_limit=10000:const_copy_limit=100000'}
    : ${LIBS="malloc fpe $IRIX_FLIBS m"}
  fi

  if test $CC = 'cc'; then
    : ${CFLAGS="$IRIX_BITS_FLAG $IRIX_FLAGS"}
    : ${C_OPTIMISE_FLAGS='-O3 -INLINE -LNO -OPT:Olimit=100000'}
    : ${C_DEBUG_FLAGS='-g3'}
    : ${C_WARN_FLAGS='-fullwarn'}
  fi
  if test $CXX = 'CC'; then
    : ${CXXFLAGS="$IRIX_BITS_FLAG $IRIX_FLAGS"}
    : ${CXX_OPTIMISE_FLAGS='-O3 -INLINE -LNO -OPT:Olimit=100000'}
    : ${CXX_DEBUG_FLAGS='-g3'}
    : ${CXX_WARN_FLAGS='-fullwarn'}
  fi
  if test $LD = 'CC'; then
    : ${LDFLAGS="$IRIX_BITS_FLAG -Wl,\"-woff 84,85\""}
  fi

  : ${F77FLAGS="$F90FLAGS"}
  : ${F77_OPTIMISE_FLAGS="$F90_OPTIMISE_FLAGS"}
  : ${F90_DEBUG_FLAGS='-g3'}
  : ${F77_DEBUG_FLAGS='-g3'}
  : ${F90_WARN_FLAGS='-fullwarn'}
  : ${F77_WARN_FLAGS='-fullwarn'}
  : ${F77_DEPEND='$(CC) -E -M $@ $(CPPFLAGS)'}
  : ${F90_DEPEND='$(CXX) -E -M $@ $(CPPFLAGS)'}

  # Cache stuff
  if test -z "$L2_CACHELINE_BYTES" ; then
    L2_CACHELINE_BYTES=128
    echo "Setting L2_CACHELINE_BYTES to $L2_CACHELINE_BYTES"
  fi

  if test -z "$L2_CACHE_SIZE" ; then
    TEMP_CACHE_SIZE="`hinv | perl -ne 'if (m/Secondary.*cache/) { s/^.*: (.*)( on P.*)?$/$1/ ; s/ Mbyte.*/\*1024/ ; s/ Kbyte.*//; print}' | sort | head -n1`"
    if test -n "$TEMP_CACHE_SIZE" ; then
      L2_CACHE_SIZE="$TEMP_CACHE_SIZE*1024"
      echo "Setting L2_CACHE_SIZE to $L2_CACHE_SIZE bytes"
    else
      echo 'Unable to determine L2 Cache size on this machine.'
    fi
  fi

  # MPI stuff
  if test -n "$MPI" ; then
    NATIVE_MPI_LIBS='mpi'
  fi

fi