summaryrefslogtreecommitdiff
path: root/lib/make/known-architectures/cygwin
blob: bb780612183d3c3721dcb5ec5e930a4c0d442397 (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
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
#! /bin/sh
# /*@@
#   @file      cygwin
#   @date      Thu Jun 24 22:56:51 1999
#   @author    Tom Goodale
#   @desc 
#   Known architecture file for Windows using cygwin.
#   @enddesc 
#   @version $Header$
# @@*/

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

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

  if test -z "$CXX"; then
    echo Setting C++ compiler to cl
    CXX="cl /TP"
  fi

  if test -z "$LD"; then
    LD='$(CC)'
  fi

  if test -z "$FPP" -a -z "$FPPFLAGS"; then
    FPP='/usr/bin/cpp'
    FPPFLAGS='-traditional'
    echo Setting FPP to $FPP
    echo Setting FPPFLAGS to $FPPFLAGS
  fi

else

  CCTK_WriteLine cctk_Archdefs.h '/* WIN stuff */'
  CCTK_WriteLine cctk_Archdefs.h '#define WIN32'

  CYGWIN_CC_COMP=

  if test "`$CC 2>&1 | grep -i microsoft`" ; then 
    CYGWIN_CC_COMP=microsoft
  elif test "`$CC 2>&1 | grep -i intel`" ; then 
    CYGWIN_CC_COMP=intel
#  elif test "`$CC 2>&1 | grep -i gcc`" ; then
#    CYGWIN_CC_COMP=gnu
  else
    echo Unknown Windows C compiler.
    echo Please add appropriate information to 
    echo $srcdir/known-architectures/cygwin
    echo and send the updated file to CactusMaint
    echo We will try anyway ...
    CYGWIN_CC_COMP=unknown
  fi

  CYGWIN_CXX_COMP=

  if test "`$CXX 2>&1 | grep -i microsoft`" ; then 
    CYGWIN_CXX_COMP=microsoft
  elif test "`$CXX 2>&1 | grep -i intel`" ; then 
    CYGWIN_CXX_COMP=intel
#  elif test "`$CXX 2>&1 | grep -i gcc`" ; then
#    CYGWIN_CXX_COMP=gnu
  else
    echo Unknown Windows C++ compiler.
    echo Please add appropriate information to 
    echo $srcdir/known-architectures/cygwin
    echo and send the updated file to CactusMaint
    echo We will try anyway ...
    CYGWIN_CXX_COMP=unknown
  fi

  CYGWIN_F90_COMP=

  if test -n "$F90" ; then 
    if test "`$F90 2>&1 | grep -i digital`" ; then 
        CYGWIN_F90_COMP=digital
    elif test "`$F90 2>&1 | grep -i compaq`" ; then 
        CYGWIN_F90_COMP=compaq
    elif test "`$F90 2>&1 | grep -i intel`" ; then 
        CYGWIN_F90_COMP=intel
    elif test "`$F90 2>&1 | grep -i g77`" ; then
        CYGWIN_F90_COMP=gnu
    else
        echo Unknown Windows f90 compiler.
        echo Please add appropriate information to 
        echo $srcdir/known-architectures/cygwin
        echo and send the updated file to CactusMaint
        echo We will try anyway ...
       CYGWIN_F90_COMP=unknown
    fi
  else
    CYGWIN_F90_COMP=none
  fi

# /Gd means use __cdecl, it's /Gz for __stdcall

  case "$CYGWIN_CC_COMP" in
    microsoft|intel)
      : ${CFLAGS="/nologo /Gd"}
      : ${C_OPTIMISE_FLAGS="/Oxy-"}
      : ${CCOMPILEONLY="/c /Fo"}
      : ${OPTIONSEP="# not even a single a single space under cygwin"}
      ;;
    *)
      ;;
  esac

  case "$CYGWIN_CXX_COMP" in
    microsoft|intel)
      : ${CXXFLAGS="/nologo /Gd"}
      : ${CXX_OPTIMISE_FLAGS="/Oxy-"}
      : ${CREATEEXE="/Fe"}
      : ${CCOMPILEONLY="/c /Fo"}
      : ${CACTUSLIBLINKLINE='/link /libpath:"$(call TRANSFORM_DIRS,$(CCTK_LIBDIR))" $(foreach lib,$(ALLCACTUSLIBS), $(LIBNAME_PREFIX)$(lib)$(LIBNAME_SUFFIX))'}
      GENERAL_LIBRARIES='$(foreach i,$(LIBDIRS),/libpath:"$(call TRANSFORM_DIRS,$(i))") $(LIBS:%=%.lib) /NODEFAULTLIB:libcd /NODEFAULTLIB:libcmt'
      : ${OPTIONSEP="# not even a single a single space under cygwin"}
      ;;
    *)
      ;;
  esac

  case "$CYGWIN_F90_COMP" in
     digital)
     : ${F90_LIBS="dfor dfconsol dfport"} 
     : ${FCOMPILEONLY="/compile_only /object:"}
     : ${F90FLAGS="/fast /iface:cref"}
     : ${F77FLAGS="/fast /iface:cref"}
     CCTK_WriteLine cctk_Archdefs.h '#define WIN32_DIGITAL_FORTRAN'
     ;;
     compaq)
     : ${F90_LIBS="dfor dfconsol dfport"} 
     : ${FCOMPILEONLY="/compile_only /object:"}
     : ${F90FLAGS="/nologo /fast /iface:cref"}
     : ${F77FLAGS="/nologo /fast /iface:cref"}
     CCTK_WriteLine cctk_Archdefs.h "#define WIN32_DIGITAL_FORTRAN"
     ;;
     intel)
     : ${F90_LIBS=""} 
     : ${FCOMPILEONLY="/c /Fo"}
     : ${F90FLAGS="/nologo"}
     : ${F77FLAGS="/nologo"}
     ;;
     gnu)
     : ${F90_LIBS="g2c"} 
     : ${FCOMPILEONLY="-c -o"}
     : ${F90FLAGS=""}
     : ${F77FLAGS=""}
     ;;
     *)
     :
     ;;
  esac

  DIRSEP="\\\\"

# Convert //a to a: 

  GET_WD="cygpath -wa ."

  TRANSFORM_DIRS='$(shell cygpath -wa $(1))'

# The -nostdinc stops it picking stdio.h, etc, from the GNU headers.
# The -x c++ is because some of the Windows headers contain C++ comments
  C_DEPEND='$(CPP) -x c++ -E -MM -nostdinc -D_WIN32 $(CPPFLAGS) $(CFLAGS) '
  CXX_DEPEND='$(CPP) -x c++ -E -MM -nostdinc -D_WIN32 $(CPPFLAGS) $(CXXFLAGS) '

# Add in system include dirs from $(INCLUDE).  These may contain spaces.
# The -D_M_IX86 is necessary for things like winnt.h.  Since this is
# only used for generating dependencies, it shouldn't make a difference
# if we use this same flag on ia64.
  C_DEPEND_OUT='-D_M_IX86 -I"$(strip $(subst ;," -I",$(INCLUDE)))" > $@'
  CXX_DEPEND_OUT='-D_M_IX86 -I"$(strip $(subst ;," -I",$(INCLUDE)))" > $@'

  MKDIR="mkdir "
  MKDIRFLAGS=" -p "

  LIBNAME_PREFIX=""
  LIBNAME_SUFFIX=".lib"

  LIBS="$F90_LIBS wsock32"

# The Windows file system requires perl backup files to be made when
# doing in place editing
  PERL_BACKUP_NECESSARY='yes'

  if test "x$cross_compiling" = "xyes" ; then
    case "$host_cpu" in
      i?86)
        ENDIAN=little
        SIZEOF_LONG_LONG=8
        SIZEOF_LONG_INT=4
        SIZEOF_INT=4
        SIZEOF_SHORT_INT=2

        SIZEOF_LONG_DOUBLE=8
        SIZEOF_DOUBLE=8
        SIZEOF_FLOAT=4

        SIZEOF_POINTER=4
      ;;
      ia64)
        ENDIAN=little
        SIZEOF_LONG_LONG=8
        SIZEOF_LONG_INT=8
        SIZEOF_INT=4
        SIZEOF_SHORT_INT=2

        SIZEOF_LONG_DOUBLE=8
        SIZEOF_DOUBLE=8
        SIZEOF_FLOAT=4

        SIZEOF_POINTER=8
      ;;
      *)
        echo "Don't know details for cross-compilation to $host_cpu"
    esac
  fi

# MPI stuff
#
# Windows has no native MPI, so we don't set any NATIVE_MPI_XXX variables.
# This is caught by lib/make/extras/MPI/NATIVE then.

fi