~ubuntu-branches/ubuntu/trusty/nwchem/trusty-proposed

« back to all changes in this revision

Viewing changes to .pc/10_force_gcc-4.7.patch/src/config/makefile.h

  • Committer: Package Import Robot
  • Author(s): Michael Banck, Daniel Leidert, Andreas Tille, Michael Banck
  • Date: 2013-07-04 12:14:55 UTC
  • mfrom: (1.1.2)
  • Revision ID: package-import@ubuntu.com-20130704121455-5tvsx2qabor3nrui
Tags: 6.3-1
* New upstream release.
* Fixes anisotropic properties (Closes: #696361).
* New features include:
  + Multi-reference coupled cluster (MRCC) approaches
  + Hybrid DFT calculations with short-range HF 
  + New density-functionals including Minnesota (M08, M11) and HSE hybrid
    functionals
  + X-ray absorption spectroscopy (XAS) with TDDFT
  + Analytical gradients for the COSMO solvation model
  + Transition densities from TDDFT 
  + DFT+U and Electron-Transfer (ET) methods for plane wave calculations
  + Exploitation of space group symmetry in plane wave geometry optimizations
  + Local density of states (LDOS) collective variable added to Metadynamics
  + Various new XC functionals added for plane wave calculations, including
    hybrid and range-corrected ones
  + Electric field gradients with relativistic corrections 
  + Nudged Elastic Band optimization method
  + Updated basis sets and ECPs 

[ Daniel Leidert ]
* debian/watch: Fixed.

[ Andreas Tille ]
* debian/upstream: References

[ Michael Banck ]
* debian/upstream (Name): New field.
* debian/patches/02_makefile_flags.patch: Refreshed.
* debian/patches/06_statfs_kfreebsd.patch: Likewise.
* debian/patches/07_ga_target_force_linux.patch: Likewise.
* debian/patches/05_avoid_inline_assembler.patch: Removed, no longer needed.
* debian/patches/09_backported_6.1.1_fixes.patch: Likewise.
* debian/control (Build-Depends): Added gfortran-4.7 and gcc-4.7.
* debian/patches/10_force_gcc-4.7.patch: New patch, explicitly sets
  gfortran-4.7 and gcc-4.7, fixes test suite hang with gcc-4.8 (Closes:
  #701328, #713262).
* debian/testsuite: Added tests for COSMO analytical gradients and MRCC.
* debian/rules (MRCC_METHODS): New variable, required to enable MRCC methods.

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
 
 
2
# $Id: makefile.h 24201 2013-05-09 00:59:44Z edo $
 
3
#
 
4
 
 
5
# Common definitions for all makefiles ... these can be overridden
 
6
# either in each makefile by putting additional definitions below the
 
7
# include statement, or on the command line
 
8
 
 
9
#
 
10
# TOPDIR points to your top-level directory that contains 
 
11
# src, lib, config, ... (SRCDIR, etc., are derived from TOPDIR)
 
12
# Do a setenv for NWCHEM_TOP to be the top level directory
 
13
#
 
14
# RELEASE is empty for the development branch of NWChem and is the
 
15
# version number for releases.  If RELEASE is not empty and if NWCHEM_TOP 
 
16
# does not already contain the value of RELEASE, it is appended with 
 
17
# a hyphen to NWCHEM_TOP in order to derive the directory path TOPDIR.
 
18
 
 
19
# For development tree 
 
20
#RELEASE := 
 
21
# For current release tree
 
22
RELEASE := 6.3
 
23
 
 
24
#
 
25
 
 
26
ifndef NWCHEM_TOP
 
27
error1:
 
28
$(info     )
 
29
$(info You must define NWCHEM_TOP in your environment to be the path)
 
30
$(info of the top level nwchem directory ... something like)
 
31
$(info     setenv NWCHEM_TOP /msrc/home/elvis/nwchem)
 
32
$(info     )
 
33
$(error )
 
34
endif
 
35
 
 
36
# Select the old (pre-autotools version of GA) by uncommenting the next line.
 
37
# The value of OLD_GA does not matter -- it is detected as an ifdef only.
 
38
#OLD_GA = y 
 
39
 
 
40
#
 
41
# Do a setenv for NWCHEM_TARGET to be the machine and NWCHEM_TARGET_CPU the CPU to build for
 
42
#
 
43
# NWCHEM_TARGET :  
 
44
#                  CYGNUS       (Windows under Cygwin tools)
 
45
#                  DECOSF
 
46
#                  IBM
 
47
#                  LINUX        NWCHEM_TARGET_CPU :
 
48
#                                                  nothing for X86 (e.g. do not set this)
 
49
#                                                  ALPHA for AlphaLinux (broke)
 
50
#                                                  POWERPC for MkLinux 
 
51
#                  SGI
 
52
#                  SGI_N32      NWCHEM_TARGET_CPU : R8000 or R10000
 
53
#                  SGITFP       NWCHEM_TARGET_CPU : R8000 or R10000
 
54
#                  SOLARIS      NWCHEM_TARGET_CPU : not defined or ULTRA
 
55
#                  LAPI         NWCHEM_TARGET_CPU : P2SC
 
56
#                      (uses thread safe libraries and LAPI)
 
57
#
 
58
#
 
59
 
 
60
ifndef NWCHEM_TARGET
 
61
error2:
 
62
        @echo You must define NWCHEM_TARGET in your environment to be the name
 
63
        @echo of the machine you wish to build for ... for example
 
64
        @echo     setenv NWCHEM_TARGET SOLARIS
 
65
        @echo Known targets are SOLARIS, SGI_N32, ...
 
66
        @echo See the INSTALL instructions for a complete list
 
67
        @exit 2
 
68
endif
 
69
 
 
70
     TARGET := $(NWCHEM_TARGET)
 
71
ifeq (,$(RELEASE))
 
72
     TOPDIR := $(NWCHEM_TOP)
 
73
     CODE_BRANCH := Development
 
74
else
 
75
     ifeq (,$(findstring $(RELEASE),$(NWCHEM_TOP)))
 
76
          TOPDIR := $(NWCHEM_TOP)-$(RELEASE)
 
77
     else
 
78
          TOPDIR := $(NWCHEM_TOP)
 
79
     endif
 
80
     CODE_BRANCH := $(RELEASE)
 
81
endif
 
82
 
 
83
#dummy:
 
84
#       echo NWCHEM_TOP=$(NWCHEM_TOP) RELEASE=$(RELEASE) TOPDIR=$(TOPDIR)
 
85
 
 
86
     SRCDIR := $(TOPDIR)/src
 
87
ifndef NWCHEM_TARGET_CPU
 
88
     LIBDIR := $(TOPDIR)/lib/$(NWCHEM_TARGET)
 
89
     BINDIR := $(TOPDIR)/bin/$(NWCHEM_TARGET)
 
90
else
 
91
     LIBDIR := $(TOPDIR)/lib/$(NWCHEM_TARGET)_$(NWCHEM_TARGET_CPU)
 
92
     BINDIR := $(TOPDIR)/bin/$(NWCHEM_TARGET)_$(NWCHEM_TARGET_CPU)
 
93
endif
 
94
     INCDIR := $(TOPDIR)/src/include
 
95
     CNFDIR := $(TOPDIR)/src/config
 
96
 
 
97
#
 
98
# Define LIBPATH to be paths for libraries that you are linking in
 
99
# from precompiled sources and are not building now. These libraries
 
100
# will be searched AFTER anything you are building now.
 
101
# e.g. LIBPATH = -L/msrc/proj/mss/lib
 
102
#
 
103
    LIBPATH = 
 
104
ifdef OLD_GA
 
105
    LIBPATH = -L$(SRCDIR)/tools/lib/$(TARGET)
 
106
else
 
107
    LIBPATH = -L$(SRCDIR)/tools/install/lib
 
108
endif
 
109
 
 
110
#
 
111
# Define INCPATH to be directories to get includes for
 
112
# libraries that you are not building now.  These directories
 
113
# will be searched AFTER anything you are building now.
 
114
#
 
115
    INCPATH = 
 
116
ifdef OLD_GA
 
117
    INCPATH = -I$(SRCDIR)/tools/include
 
118
else
 
119
    INCPATH = -I$(SRCDIR)/tools/install/include
 
120
endif
 
121
 
 
122
# These subdirectories will build the core, or supporting libraries
 
123
# that are required by all NWChem modules.  The include directory is
 
124
# first to insure that all include files will be properly installed
 
125
# prior to trying to compile anything.
 
126
#
 
127
# The core libraries are usually rather platform-dependent and are
 
128
# specified below.  Use of MPI requires substituting the tcgmsg-mpi
 
129
# wrapper for the normal tcgmsg library.
 
130
# the 2 following environmental variables are need for linking
 
131
# LIBMPI - represents the name of mpi library (with -l)
 
132
# MPI_LIB - represents the path to the mpi library
 
133
#LIBMPI =  -lmpich
 
134
#MPI_LIB= /usr/local/lib
 
135
 
 
136
#JN: under the new structure, tools should be listed first as
 
137
# their header files are needed for dependency analysis of
 
138
# other NWChem modules
 
139
 
 
140
NW_CORE_SUBDIRS = tools include basis geom inp input  \
 
141
        pstat rtdb task symmetry util peigs perfm bq cons $(CORE_SUBDIRS_EXTRA)
 
142
 
 
143
# Include the modules to build defined by 'make nwchem_config' at top level
 
144
 
 
145
include $(CNFDIR)/nwchem_config.h
 
146
#
 
147
 
 
148
# Finally, we can set the full list of interesting directories, which
 
149
# is what most makefile will care about.
 
150
 
 
151
NWSUBDIRS = $(NW_CORE_SUBDIRS) $(NW_MODULE_SUBDIRS)
 
152
 
 
153
BUILDING_PYTHON = $(filter $(NWSUBDIRS),python)
 
154
##########################################################
 
155
#                                                        #
 
156
# Should NOT need to modify below here unless porting to #
 
157
# a new machine or changing compiler options             #
 
158
#                                                        #
 
159
##########################################################
 
160
 
 
161
# Each machine dependent section should define the following as necessary.
 
162
# (defaults if any in parentheses)
 
163
#
 
164
#         FC = path to Fortran compiler (f77)
 
165
#         CC = path to ANSI C compiler (cc)
 
166
#         AS = path to the assembler (as)
 
167
#         AR = path to archive builder (ar)
 
168
#        CPP = path to ANSI-like C preprocessor (cpp)
 
169
#     RANLIB = path to ranlib or something harmless if not required
 
170
#      SHELL = path to the Bourne Shell
 
171
#       MAKE = DON'T define this ... it will break the passing of command
 
172
#              arguments.  Simply use the correct path to GNU make on the 
 
173
#              command line and all will work just dandy.
 
174
#  MAKEFLAGS = options to GNU make ... -j controls no. of threads used
 
175
#              for parallel builds. --no-print-directory says be quiet about
 
176
#              changing directory.
 
177
#    INSTALL = command to install an executable when it is built
 
178
#    
 
179
# C/FOPTIONS = essential compiler options independent of optimization level
 
180
#              C/FOPTIONS should not usually be overridden on the command line
 
181
#   C/FDEBUG = compiler flags to enable enable debugging and used for
 
182
#              all routines not vital for performance (OBJ in makelib.h)
 
183
#C/FOPTIMIZE = compiler flags to enable optimization for important routines.
 
184
#              (OBJ_OPTIMIZE in makelib.h)
 
185
#
 
186
#              C/FDEBUG and C/FOPTIMIZE can be overridden on the command 
 
187
#              line to change the optimization level for routines normally 
 
188
#              compiled with them.
 
189
#
 
190
#  EXPLICITF = undefined if the Fortran compiler runs .F files thru .f
 
191
#              Otherwise set it to anything and define FCONVERT to be a 
 
192
#              command to make $< (which will be a .F file) into $*.f
 
193
#
 
194
#   FCONVERT = command to convert a .F into a .f 
 
195
#
 
196
#  LDOPTIONS = additional options to be passed to the linker (LDFLAGS is
 
197
#              built from this and the library path info).  LDOPTIONS is
 
198
#              the best way to add to the link command.
 
199
#
 
200
#    ARFLAGS = options for AR (ru)
 
201
#
 
202
#    DEFINES = C preprocessor defines for both C and Fortran
 
203
#
 
204
#  CORE_LIBS = List of libraries and paths for libraries in addition 
 
205
#              to the LIBDIR and LIBPATH options.
 
206
#
 
207
# CORE_SUBDIRS_EXTRA = List of additional directories (e.g., BLAS) that
 
208
#                 are needed on this machine.
 
209
# MODULE_SUBDIRS_EXTRA = List of additional directories (e.g., stepper) that
 
210
#                 are needed for top-level modules on this machine.
 
211
#                 (Should not normally be used)
 
212
#
 
213
# The following are defined for all machines at the bottom of this file
 
214
#
 
215
#   C/FFLAGS = all options to the C/Fortran compilers (note CPPFLAGS are 
 
216
#              separate).  These comprise C/FOPTIONS and C/FOPT.
 
217
#   INCLUDES = C preprocessor include paths for both C and Fortran.
 
218
#              In princpile this could be machine dependent but is not yet.
 
219
#   CPPFLAGS = options to C preprocessor that both C and Fortran will use.
 
220
#              This comprises the includes and defines.
 
221
#    LDFLAGS = options for the linker.  Currently paths from LIBDIR and
 
222
#              LIBPATH.
 
223
#
 
224
# NWCHEM_TARGET_CPU environment variable is used to select compiler flags
 
225
# optimal for given CPU. The following values are recognized on particular
 
226
# platforms:
 
227
#
 
228
#        NWCHEM_TARGET                NWCHEM_TARGET_CPU          
 
229
#           LAPI                         P2SC
 
230
#           SGITFP                       R10000/R8000
 
231
#           SGI_N32                      R10000/R8000
 
232
#
 
233
 
 
234
 
 
235
#
 
236
# Establish some required defaults which may need overriding
 
237
# for some machines
 
238
 
 
239
           SHELL = /bin/sh
 
240
         ARFLAGS = r
 
241
          FDEBUG = -g
 
242
          CDEBUG = -g
 
243
              AR = ar
 
244
 
 
245
ifdef OLD_GA
 
246
       CORE_LIBS = -lnwcutil -lpario -lglobal -lma -lpeigs -lperfm -lcons -lbq -lnwcutil
 
247
else
 
248
       CORE_LIBS = -lnwcutil -lga -larmci -lpeigs -lperfm -lcons -lbq -lnwcutil
 
249
endif
 
250
 
 
251
    ifdef USE_INTEGER4
 
252
      integer4:
 
253
        @echo 
 
254
        @echo USE_INTEGER4 option no longer supported
 
255
        @echo please do not set it
 
256
        @echo 
 
257
        @exit 1
 
258
    endif
 
259
 
 
260
#
 
261
# Machine specific stuff
 
262
#
 
263
 
 
264
ifeq ($(TARGET),SOLARIS)
 
265
      SHELL := $(NICE) /bin/sh
 
266
     RANLIB = echo
 
267
  MAKEFLAGS = -j 2 --no-print-directory
 
268
    INSTALL = echo $@ is built
 
269
#
 
270
# You can use either the f77 or f90 compiler BUT if using f90
 
271
# you'll need to specify -DINTEGER_1='integer*1' in the selci
 
272
# and util makefiles.
 
273
#
 
274
         CC = cc
 
275
         FC = f77
 
276
 
 
277
# Don't need this if using the SUN performance library
 
278
#  need for BLASOPT business because of lapack and other possible missing entries
 
279
ifndef BLASOPT
 
280
CORE_SUBDIRS_EXTRA = blas lapack 
 
281
endif
 
282
 
 
283
    DEFINES = -DSOLARIS  -DNOAIO
 
284
# Note that WS6 does not optimize robustly and if using this you must 
 
285
#   - put "-nodpend -xvector=no" on FOPTIONS after -fast
 
286
#   - remove "-fsimple=2 -depend -xvector=yes" from FOPTIMIZE.
 
287
#   - remove -lmvec from CORELIBS
 
288
# to get link with sunperf, type BLASOPT="-xlic_lib=sunperf"
 
289
#
 
290
# These options are set for WS5
 
291
 
 
292
  ifeq ($(CC),fcc)
 
293
#    Fujitsu SPARC systems (thanks to Herbert Fruchtl)
 
294
    COPTIONS = -Kdalign
 
295
    COPTIMIZE = -Kfast_GP=2
 
296
    DEFINES += -DFUJITSU_SOLARIS
 
297
  endif
 
298
 
 
299
  ifeq ($(FC),frt)
 
300
#    Fujitsu SPARC systems (thanks to Herbert Fruchtl)
 
301
# Fujitsu with Parallelnavi compilers
 
302
# If using Fujitsu compilers on Sun hardware, replace -Kfast_GP=2 with
 
303
#  -Kfast
 
304
     DEFINES += -DFUJITSU_SOLARIS -DEXTNAME
 
305
     FOPTIONS = -Kdalign -w -fw -X9 
 
306
     FOPTIMIZE = -Kfast_GP=2 
 
307
     FDEBUG=
 
308
     LINK.f = $(FC) $(LDFLAGS) $(FOPTIONS) $(FOPTIMIZE)
 
309
   else
 
310
     FOPTIONS = -stackvar -dalign 
 
311
     FOPTIMIZE = -fast -O5 -fsimple=2 -depend -xvector=yes
 
312
     FDEBUG = -g -O1 -nodepend
 
313
     LINK.f = $(FC) $(LDFLAGS) $(FOPTIONS)
 
314
   endif
 
315
 
 
316
  ifeq ($(FC),frt)
 
317
     CORE_LIBS +=  -SSL2
 
318
  else
 
319
    LDOPTIONS = -xildoff
 
320
    CORE_LIBS +=  -llapack $(BLASOPT) -lblas  -lmvec
 
321
  endif
 
322
 
 
323
 
 
324
      EXTRA_LIBS = -ldl 
 
325
# this creates a static executable
 
326
#EXTRA_LIBS = -Bdynamic -ldl -lXext -lnsl  -Bstatic  
 
327
 
 
328
 
 
329
ifeq ($(BUILDING_PYTHON),python)
 
330
# Both tk/tcl and BLT need X11 (common)
 
331
      EXTRA_LIBS += -lX11
 
332
endif
 
333
 
 
334
#end of solaris
 
335
endif
 
336
 
 
337
ifeq ($(TARGET),SOLARIS64)
 
338
#
 
339
# Sun running Solaris 64-bit ... NEEDS WORKSHOP 6.1 or later compilers
 
340
# due to bugs in earlier compilers.  Also cannot yet use sunperf due to
 
341
# the braindead naming of the 64-bit interface.
 
342
#
 
343
# You can use either the f77 or f90 compiler BUT if using f90
 
344
# you'll need to specify -DINTEGER_1='integer*1' in the selci
 
345
# and util makefiles.
 
346
#
 
347
 
 
348
      SHELL := $(NICE) /bin/sh
 
349
    CORE_SUBDIRS_EXTRA = blas lapack
 
350
         CC = cc
 
351
         FC = f77
 
352
   DEFINES = -DSOLARIS  -DNOAIO -DSOLARIS64
 
353
   DEFINES  +=  -DEXT_INT
 
354
 
 
355
  COPTIMIZE = -O
 
356
     RANLIB = echo
 
357
  MAKEFLAGS = -j 2 --no-print-directory
 
358
    INSTALL = echo $@ is built
 
359
 
 
360
  ifeq ($(CC),fcc)
 
361
#    Fujitsu SPARC systems (thanks to Herbert Fruchtl)
 
362
    COPTIONS = -Kdalign -KV9FMADD
 
363
    COPTIMIZE = -Kfast_GP=2 -KV9FMADD
 
364
    DEFINES += -DFUJITSU_SOLARIS
 
365
  else
 
366
# SUN/Solaris options for WS6.1
 
367
   COPTIONS = -xarch=v9 -dalign
 
368
  endif
 
369
 
 
370
  ifeq ($(FC),frt)
 
371
#    Fujitsu SPARC systems (thanks to Herbert Fruchtl)
 
372
# Fujitsu with Parallelnavi compilers
 
373
# If using Fujitsu compilers on Sun hardware, replace -Kfast_GP=2 with
 
374
#  -Kfast
 
375
     DEFINES += -DFUJITSU_SOLARIS -DEXTNAME
 
376
     FOPTIONS = -Kdalign -w -fw -X9  -KV9FMADD
 
377
     ifdef USE_I4FLAGS
 
378
       FOPTIONS += -CcdLL8
 
379
     else
 
380
       FOPTIONS += -CcdLL8 -CcdII8
 
381
     endif
 
382
     FOPTIMIZE = -Kfast_GP=2  -KV9FMADD
 
383
     FDEBUG=
 
384
   else
 
385
#  SUN/Solaris f77 options 
 
386
     FOPTIONS = -stackvar -fast -nodepend -xvector=no -xarch=v9a
 
387
     ifdef USE_I4FLAGS
 
388
       FOPTIONS +=  -xtypemap=real:64,double:64,integer:32
 
389
     else
 
390
       FOPTIONS +=  -xtypemap=real:64,double:64,integer:64
 
391
     endif
 
392
       FOPTIMIZE = -g -O5
 
393
       FDEBUG = -g -O1
 
394
    endif
 
395
 
 
396
  LINK.f = $(FC) $(LDFLAGS) $(FOPTIONS)
 
397
  ifeq ($(FC),frt)
 
398
    LDOPTIONS = -SSL2
 
399
    CORE_LIBS +=  -llapack -lblas
 
400
  else
 
401
    LDOPTIONS = -xs -xildoff
 
402
ifdef BLASOPT
 
403
    CORE_LIBS +=   $(BLASOPT)   -lmvec
 
404
else
 
405
    CORE_LIBS +=  -llapack -lblas  -lmvec
 
406
endif
 
407
    CORE_LIBS += -lsocket -lrpcsvc -lnsl
 
408
    EXTRA_LIBS =  -ldl -lfsu
 
409
  endif
 
410
 
 
411
 
 
412
#end of solaris
 
413
endif
 
414
 
 
415
ifeq ($(TARGET),PURESOLARIS)
 
416
#
 
417
# NOT TESTED RECENTLY
 
418
#
 
419
# Sun running Solaris 2.4 or later and if you want to use purecoverage tool you must
 
420
#
 
421
      SHELL := $(NICE) /bin/sh
 
422
    CORE_SUBDIRS_EXTRA = blas lapack
 
423
         CC = purecov gcc
 
424
         FC = purecov f77
 
425
     RANLIB = echo
 
426
  MAKEFLAGS = -j 2 --no-print-directory
 
427
    INSTALL = echo $@ is built
 
428
# -fast introduces many options that must be applied to all files
 
429
# -stackvar puts locals on t
 
430
# the stack which seems a good thing
 
431
#     but may need to increase the stacksize at runtime using limit
 
432
# -xs allows debugging without .o files
 
433
   FOPTIONS = -Nl199 -fast -dalign -stackvar
 
434
   COPTIONS = -Wall
 
435
# Under Solaris -O3 is the default with -fast (was -O2 with SUNOS)
 
436
# -fsimple=2 enables more rearranging of floating point expressions
 
437
# -depend enables more loop restructuring
 
438
  FOPTIMIZE = -O3 -fsimple=2 -depend 
 
439
# Under Solaris -g no longer disables optimization ... -O2 seems solid
 
440
# but is slow and impairs debug ... use -O1 for speed and debugability
 
441
     FDEBUG = -g -O1
 
442
  COPTIMIZE = -g -O1
 
443
   LIBPATH += -L/usr/ucblib
 
444
   LIBPATH += -L/afs/msrc/sun4m_54/apps/purecov
 
445
   OPTIONS = -xildoff -Bstatic
 
446
   CORE_LIBS +=  -llapack $(BLASOPT) -lblas
 
447
# First four needed for parallel stuff, last for linking with profiling
 
448
           EXTRA_LIBS = -lsocket -lrpcsvc -lnsl -lucb -lintl -lc -lc -lpurecov_stubs
 
449
 
 
450
#end of puresolaris
 
451
endif
 
452
 
 
453
 
 
454
ifeq ($(TARGET),CRAY-T3E)
 
455
#
 
456
#
 
457
   CORE_SUBDIRS_EXTRA = blas lapack # Only a couple of routines not in scilib
 
458
               RANLIB = echo
 
459
            MAKEFLAGS = -j 1 --no-print-directory
 
460
              INSTALL = @echo $@ is built
 
461
        OUTPUT_OPTION =
 
462
 
 
463
                   FC = f90
 
464
                  CPP = /opt/ctl/CC/CC/lib/mppcpp -P  -N
 
465
             FOPTIONS = -d p -F 
 
466
             COPTIONS =
 
467
               FDEBUG = -O scalar1
 
468
#               FDEBUG = -g
 
469
            FOPTIMIZE = -O scalar3,aggress,unroll2,vector3
 
470
#,pipeline3
 
471
               CDEBUG = -O 1
 
472
            COPTIMIZE = -O
 
473
#
 
474
# to debug code you must remove the -s flag unless you know assembler
 
475
#
 
476
#            LDOPTIONS = -g -Xm  -lmfastv
 
477
            LDOPTIONS = -Wl"-s" -Xm  -lmfastv
 
478
 
 
479
              DEFINES = -DCRAY_T3E -DCRAY_T3D -D__F90__ -DUSE_FCD
 
480
 
 
481
               LINK.f = f90 $(LDFLAGS)
 
482
 
 
483
            CORE_LIBS += -llapack $(BLASOPT) -lblas
 
484
#
 
485
 
486
ifeq ($(BUILDING_PYTHON),python)
 
487
#** on the NERSC CRAY-T3E you need to:
 
488
#**** % module load python
 
489
#**** % module load tcltk
 
490
      EXTRA_LIBS += -ltk -ltcl -lX11
 
491
endif
 
492
#
 
493
 
 
494
      FCONVERT      = $(CPP) $(CPPFLAGS)  $< | sed '/^\#/D'  > $*.f
 
495
      EXPLICITF     = TRUE
 
496
endif
 
497
 
 
498
ifeq ($(TARGET),SGITFP)
 
499
#
 
500
# SGI power challenge
 
501
#
 
502
# CORE_SUBDIRS_EXTRA are those machine specific libraries required 
 
503
#
 
504
# TPS 95/11/22:
 
505
# Optimization options const_copy_limit=18000, global_limit=18000 and 
 
506
# fprop_limit=1200 added to FOPTIMIZE to allow full optimization of the 
 
507
# MD module nwArgos on SGI Power Indigo^2
 
508
#
 
509
# RJH ... note that fprop_limit is not supported by 7.0 compilers
 
510
#
 
511
# TPS 95/12/12:
 
512
# Increased fprop_limit to 1750
 
513
# Removed -j 12 from MAKEFLAGS
 
514
# Added -lnwcutil to core libraries
 
515
#
 
516
# TPS 96/01/14:
 
517
# Increased const_copy_limit and global_limit to 18500
 
518
#
 
519
# RJH ... from Roberto ... on the R10k TENV=3 may cause very expensive
 
520
#     interrupts (he recommends 1 when we go to 10K, but 3 is good for 8k)
 
521
#     ... also going to 10K use -SWP:if_conversion=OFF
 
522
#     ... in going to 6.1/2 then should also set -SWP:*ivdep*=ON/OFF
 
523
#         (default changed from agressive to conservative and we want
 
524
#         the agressive)
 
525
#     ... sometimes the default KAP parameters are best (only for critical
 
526
#         routines)
 
527
#     ... -dr=AKC forces it to recognize all compiler directives (C=CRAY
 
528
#         not on by default) ... can put everywhere.
 
529
#     ... on -WK also add -r=3 (level of reduction) even with -o=1
 
530
#     ... could benefit from -Wk on FOPTIMIZE ... actually have it on now.
 
531
#     ... roundoff/ieee only modify pipelining which happens only at O3
 
532
#
 
533
# TPS 96/06/27:
 
534
# Added -lnwcutil to core libraries (again!)
 
535
#
 
536
# TPS 96/07/26:
 
537
# Fortran optimization limits: const_copy_limit=20000 
 
538
#                              global_limit=20000
 
539
#                              fprop_limit=2000
 
540
#
 
541
# JN 96/10/02:
 
542
# Replaced -DLongInteger with -DEXT_INT for consistency with GA, DRA, PEIGS ...
 
543
#
 
544
# JN 99/05/26: MA now has its own library -lma
 
545
#
 
546
# TLW 99/10/08:
 
547
# From Gerardo Cisneros
 
548
#  - took out obsolete options
 
549
#       "-OPT:fold_arith_limit=4000"
 
550
#       "-OPT:fprop_limit=2000"
 
551
#       "-OPT:global_limit=20000"
 
552
#       "-SWP:if_conversion=OFF"
 
553
 
 
554
 
 
555
        CPP = /usr/lib/cpp
 
556
  CORE_SUBDIRS_EXTRA = blas lapack
 
557
         FC = f77
 
558
     RANLIB = echo
 
559
 
 
560
 
 
561
    INSTALL = @echo nwchem is built
 
562
  MAKEFLAGS = -j 4 --no-print-directory
 
563
 
 
564
# RJH ... moved -OPT... to the FOPTIMIZE macro since it's an optimization!
 
565
# (that breaks things).
 
566
  FOPTIONS = -d8 -i8 -mips4 -align64 -64 -r8 -G 0 
 
567
  COPTIONS = -fullwarn -mips4 -64
 
568
 
 
569
#optimization flags for R8000 (IP21)
 
570
# FOPTIMIZE_8K = -O3 -OPT:fold_arith_limit=4000:const_copy_limit=20000:global_limit=20000:fprop_limit=2000 -TENV:X=3 -WK,-so=1,-o=1,-r=3,-dr=AKC
 
571
 FOPTIMIZE_8K = -O3 -OPT:const_copy_limit=20000 -TENV:X=3 -WK,-so=1,-o=1,-r=3,-dr=AKC
 
572
FVECTORIZE_8K = -O3 -TENV:X=3 -WK,-dr=AKC
 
573
 
 
574
#optimization flags for R10000 (IP28)
 
575
 FOPTIMIZE_10K = -O3 -OPT:const_copy_limit=20000:Olimit=4800 -TENV:X=1 -WK,-so=1,-o=1,-r=3,-dr=AKC
 
576
FVECTORIZE_10K = -O3 -TENV:X=1 -WK,-dr=AKC
 
577
 
 
578
#optimization flags for R12000 (IP30)
 
579
 FOPTIMIZE_12K = -O3 -OPT:const_copy_limit=20000:Olimit=4800 -TENV:X=1 -WK,-so=1,-o=1,-r=3,-dr=AKC
 
580
FVECTORIZE_12K = -O3 -TENV:X=1 -WK,-dr=AKC
 
581
 
 
582
 COPTIMIZE = -O
 
583
 FOPTIMIZE = -O3
 
584
 
 
585
ifeq ($(NWCHEM_TARGET_CPU),R12000)
 
586
 FOPTIMIZE = $(FOPTIMIZE_12K)
 
587
 FVECTORIZE = $(FVECTORIZE_12K)
 
588
endif
 
589
ifeq ($(NWCHEM_TARGET_CPU),R10000)
 
590
 FOPTIMIZE = $(FOPTIMIZE_10K)
 
591
 FVECTORIZE = $(FVECTORIZE_10K)
 
592
endif
 
593
ifeq ($(NWCHEM_TARGET_CPU),R8000)
 
594
 FOPTIMIZE = $(FOPTIMIZE_8K)
 
595
 FVECTORIZE = $(FVECTORIZE_8K)
 
596
endif
 
597
  FOPTIMIZE += -OPT:roundoff=3:IEEE_arithmetic=3
 
598
  FVECTORIZE += -OPT:roundoff=3:IEEE_arithmetic=3
 
599
 
 
600
  DEFINES = -DSGI -DSGITFP -DEXT_INT
 
601
  CORE_LIBS += -llapack $(BLASOPT) -lblas
 
602
ifeq ($(BUILDING_PYTHON),python)
 
603
#needed for python 2.2.2
 
604
      EXTRA_LIBS += -lpthread
 
605
endif
 
606
endif
 
607
 
 
608
 
 
609
 
 
610
 
 
611
ifeq ($(TARGET),SGI_N32)
 
612
#
 
613
# SGI 64-bit MIPS-4 processors (R5k, R8k, R10k) under IRIX > 6.0  (ABI)
 
614
#
 
615
# JN, 12.06.96:
 
616
# -n32 allows to use 64-bit processor features and 32-bit address space
 
617
# 32-bit address space - use SGITFP if 64-bit addresses needed
 
618
#
 
619
# SGI BLAS can be used directly
 
620
 
 
621
    CORE_SUBDIRS_EXTRA = lapack
 
622
         FC = f77
 
623
         CPP = /usr/lib/cpp
 
624
         AR = ar
 
625
     RANLIB = echo
 
626
 
 
627
    INSTALL = @echo nwchem is built
 
628
  MAKEFLAGS = -j 4 --no-print-directory
 
629
    DEFINES = -DSGI  -DSGI_N32
 
630
 
 
631
# RJH ... moved -OPT... to the FOPTIMIZE macro since it's an optimization!
 
632
# (that breaks things).
 
633
  FOPTIONS = -n32 -mips4 -G 0 
 
634
  COPTIONS = -n32 -mips4 -fullwarn
 
635
 
 
636
#optimization flags for R8000 (IP21)
 
637
 FOPTIMIZE_8K = -O3 -OPT:const_copy_limit=20000 -TENV:X=3 -WK,-so=1,-o=1,-r=3,-dr=AKC
 
638
FVECTORIZE_8K = -O3 -TENV:X=3 -WK,-dr=AKC
 
639
 
 
640
#optimization flags for R10000 (IP28)
 
641
 FOPTIMIZE_10K = -O3 -OPT:const_copy_limit=20000 -TENV:X=1 -WK,-so=1,-o=1,-r=3,-dr=AKC 
 
642
FVECTORIZE_10K = -O3 -TENV:X=1 -WK,-dr=AKC
 
643
 
 
644
#optimization flags for R12000 (IP27)
 
645
# FOPTIMIZE_12K = -O   -r12000  -TARG:platform=ip27  -LNO:cs2=8M -TENV:X=3
 
646
# FOPTIMIZE_12K = -O3 -r12000 -TARG:platform=ip27 -LNO:prefetch=1:cs2=8M:fusion=2:fission=2 -LIST:all_options -OPT:swp=ON:space=ON 
 
647
# FVECTORIZE_12K = -O3 -r12000 -TARG:platform=ip27 -LNO:prefetch=1:cs2=8M:fusion=2:fission=2 -LIST:all_options -OPT:swp=ON:space=ON 
 
648
# The above options are some Edo used to optimize for a particular machine
 
649
 FOPTIMIZE_12K = -O3 -OPT:const_copy_limit=20000 -TENV:X=1 -WK,-so=1,-o=1,-r=3,-dr=AKC 
 
650
FVECTORIZE_12K = -O3 -TENV:X=1 -WK,-dr=AKC
 
651
 
 
652
 FOPTIMIZE = -O3
 
653
 COPTIMIZE = -O2
 
654
 
 
655
ifeq ($(NWCHEM_TARGET_CPU),R12000)
 
656
 FOPTIMIZE = $(FOPTIMIZE_12K)
 
657
 FVECTORIZE = $(FVECTORIZE_12K)
 
658
endif
 
659
ifeq ($(NWCHEM_TARGET_CPU),R10000)
 
660
 FOPTIMIZE = $(FOPTIMIZE_10K)
 
661
 FVECTORIZE = $(FVECTORIZE_10K)
 
662
endif
 
663
ifeq ($(NWCHEM_TARGET_CPU),R8000)
 
664
 FOPTIMIZE = $(FOPTIMIZE_8K)
 
665
 FVECTORIZE = $(FVECTORIZE_8K)
 
666
endif
 
667
  FOPTIMIZE += -OPT:roundoff=3:IEEE_arithmetic=3
 
668
  FVECTORIZE += -OPT:roundoff=3:IEEE_arithmetic=3
 
669
 
 
670
ifeq ($(BUILDING_PYTHON),python)
 
671
# needed if python was compiled with gcc (common)
 
672
      EXTRA_LIBS += -L/msrc/apps/gcc-2.8.1/lib/gcc-lib/mips-sgi-irix6.5/2.8.1 -lgcc
 
673
# needed here if using a python version with tk/tcl extensions  (common)
 
674
      EXTRA_LIBS += -L/msrc/apps/lib -ltk8.0 -ltcl8.0 
 
675
# needed here if using a python version built with BLT extensions
 
676
#     EXTRA_LIBS += -L/msrc/apps/lib -lBLT 
 
677
# Both tk/tcl and BLT need X11 (common)
 
678
      EXTRA_LIBS += -lX11
 
679
endif
 
680
 
 
681
       CORE_LIBS += -llapack $(BLASOPT) -lblas 
 
682
ifeq ($(BUILDING_PYTHON),python)
 
683
#needed for python 2.2.2
 
684
      EXTRA_LIBS += -lpthread
 
685
endif
 
686
endif
 
687
 
 
688
ifeq ($(TARGET),HPUX)
 
689
#
 
690
# HPUX 11.0
 
691
#
 
692
# removed reference to MLIB since 8.3 version of MLIB 
 
693
# does not support +ppu
 
694
#
 
695
 
 
696
  CORE_SUBDIRS_EXTRA = blas lapack
 
697
  MAKEFLAGS = -j 1 --no-print-directory
 
698
  CPP = /lib/cpp -P
 
699
  CC = cc
 
700
  FC = f90
 
701
  LDOPTIONS = -g -Wl,+vallcompatwarnings  +U77   
 
702
  LDOPTIONS +=  +DA2.0 +DS2.0 +O2
 
703
  LDOPTIONS +=   +O2
 
704
  LINK.f = f90   $(LDFLAGS) 
 
705
  CORE_LIBS +=  $(BLASOPT) -llapack -lblas   -lm
 
706
  FDEBUG = -g
 
707
  FOPTIONS =  +ppu -Wl,-a,archive
 
708
  COPTIONS = -Aa -D_HPUX_SOURCE +e 
 
709
  FOPTIMIZE = +O2 +Onolimit
 
710
  FOPTIMIZE += +DA2.0 +DS2.0a  +Odataprefetch  +Onofltacc +Onoinitcheck
 
711
  FOPTIMIZE += +Oprocelim +Oentrysched +Ofastaccess
 
712
  FVECTORIZE = +Oall +Onofltacc
 
713
  COPTIMIZE = -O
 
714
  RANLIB = echo
 
715
 
 
716
 DEFINES = -DHPUX -DEXTNAME
 
717
ifeq ($(BUILDING_PYTHON),python)
 
718
# needed if python was compiled with gcc (common)
 
719
      EXTRA_LIBS += -L/usr/local/lib/gcc-lib/hppa1.0-hp-hpux11.00/2.8.0 -lgcc
 
720
endif
 
721
 
 
722
endif
 
723
 
 
724
ifeq ($(TARGET),HPUX64)
 
725
#
 
726
# HPUX 11.0
 
727
#
 
728
 
 
729
  CORE_SUBDIRS_EXTRA = blas lapack
 
730
  _CPU = $(shell uname -m  )
 
731
  MAKEFLAGS = -j 1 --no-print-directory
 
732
  CPP = /lib/cpp -P
 
733
  CC = cc
 
734
  FC = f90
 
735
  LDOPTIONS = -Wl,+vallcompatwarnings  +U77   
 
736
  CORE_LIBS +=  -llapack $(BLASOPT) -lblas  -lm
 
737
  CDEBUG =
 
738
  FDEBUG = -g
 
739
  FOPTIONS =  +ppu  #+U77  
 
740
  COPTIONS = -Aa -D_HPUX_SOURCE +e 
 
741
  ifeq ($(_CPU),ia64)
 
742
    FOPTIONS += +DD64 +DSitanium2 +Ofltacc=relaxed +Olibcalls +Onolimit +FPD
 
743
    COPTIONS += +DD64
 
744
    FOPTIMIZE = +O2
 
745
    FVECTORIZE = +Ofast  +O3 +Onoptrs_to_globals +Oloopblock 
 
746
    FDEBUG = +Ofast 
 
747
  else
 
748
    FOPTIONS +=  +DA2.0W 
 
749
    COPTIONS +=  +DA2.0W 
 
750
    FOPTIMIZE = +O2
 
751
    FVECTORIZE =  +Oall +Onofltacc
 
752
  endif
 
753
  
 
754
  COPTIMIZE = -O
 
755
  RANLIB = echo
 
756
 
 
757
 DEFINES = -DHPUX -DEXTNAME -DHPUX64 
 
758
 ifdef USE_I4FLAGS
 
759
 else
 
760
   FOPTIONS +=  +i8 
 
761
 endif
 
762
 DEFINES +=  -DEXT_INT
 
763
 
 
764
endif
 
765
 
 
766
 
 
767
 
 
768
 
 
769
ifeq ($(TARGET),IBM)
 
770
#
 
771
# IBM AIX
 
772
#
 
773
 
 
774
    CORE_SUBDIRS_EXTRA = lapack blas
 
775
         FC = xlf
 
776
         ifeq ($(FC),xlf)
 
777
           _FC=xlf
 
778
         endif
 
779
         CC = xlc
 
780
    ARFLAGS = urs
 
781
     RANLIB = echo
 
782
  MAKEFLAGS = -j 5 --no-print-directory
 
783
    INSTALL = @echo $@ is built
 
784
        CPP = /usr/lib/cpp -P
 
785
 
 
786
   FOPTIONS = -qEXTNAME -qnosave -qalign=4k -qxlf77=leadzero
 
787
# -qinitauto=FF
 
788
   COPTIONS = 
 
789
# -qstrict required with -O3 (according to Edo)
 
790
# -qfloat=rsqrt gives faster square roots (off by -qstrict)
 
791
# -qfloat=fltint gives faster real-integer conversion (off by -qstrict)
 
792
# -qhot seems to break a lot of things so don't ever use it
 
793
  FOPTIMIZE = -O3 -qstrict -NQ40000 -NT80000 -qarch=auto -qtune=auto -NS2048
 
794
  ifdef RSQRT
 
795
    FOPTIMIZE  += -qfloat=rsqrt:fltint
 
796
  endif
 
797
  COPTIMIZE = -O -qarch=auto -qtune=auto
 
798
  ifdef  USE_GPROF
 
799
    FOPTIONS += -pg
 
800
    LDOPTIONS += -pg
 
801
  endif
 
802
 
 
803
    DEFINES = -DIBM -DAIX -DEXTNAME
 
804
   CORE_LIBS +=  $(BLASOPT) 
 
805
ifdef USE_ESSL
 
806
   DEFINES += -DESSL
 
807
   CORE_LIBS += -lessl
 
808
endif
 
809
 
 
810
       LIBPATH += -L/usr/lib 
 
811
 
 
812
  LDOPTIONS += -bmaxstack:0x60000000 -bmaxdata:0x60000000 -bloadmap:nwchem.lapi_map
 
813
       CORE_LIBS +=  -llapack $(BLASOPT) -lblas \
 
814
              -brename:.daxpy_,.daxpy \
 
815
              -brename:.dcopy_,.dcopy \
 
816
              -brename:.ddot_,.ddot \
 
817
              -brename:.dgemm_,.dgemm \
 
818
              -brename:.dgemv_,.dgemv \
 
819
              -brename:.dgesv_,.dgesv \
 
820
              -brename:.dgetrf_,.dgetrf \
 
821
              -brename:.dgetrs_,.dgetrs \
 
822
              -brename:.dlaset_,.dlaset \
 
823
              -brename:.dpotrf_,.dpotrf \
 
824
              -brename:.dpotri_,.dpotri \
 
825
              -brename:.dscal_,.dscal \
 
826
              -brename:.dspsvx_,.dspsvx \
 
827
              -brename:.idamax_,.idamax \
 
828
              -brename:.dswap_,.dswap \
 
829
              -brename:.dger_,.dger \
 
830
              -brename:.dtrsm_,.dtrsm \
 
831
              -brename:.dnrm2_,.dnrm2 \
 
832
              -brename:.dtrmm_,.dtrmm \
 
833
              -brename:.drot_,.drot \
 
834
              -brename:.dasum_,.dasum \
 
835
              -brename:.dtrmv_,.dtrmv \
 
836
              -brename:.dspmv_,.dspmv \
 
837
              -brename:.dspr_,.dspr \
 
838
              -brename:.dsyrk_,.dsyrk \
 
839
              -brename:.dsyr2k_,.dsyr2k \
 
840
              -brename:.dsymv_,.dsymv \
 
841
              -brename:.lsame_,.lsame \
 
842
              -brename:.xerbla_,.xerbla \
 
843
              -brename:.zgemm_,.zgemm \
 
844
              -brename:.dsyr2_,.dsyr2 \
 
845
              -brename:.dznrm2_,.dznrm2 \
 
846
              -brename:.zaxpy_,.zaxpy \
 
847
              -brename:.zcopy_,.zcopy \
 
848
              -brename:.zdotc_,.zdotc \
 
849
              -brename:.zdscal_,.zdscal \
 
850
              -brename:.zgemv_,.zgemv \
 
851
              -brename:.zgerc_,.zgerc \
 
852
              -brename:.zhemv_,.zhemv \
 
853
              -brename:.zher2_,.zher2 \
 
854
              -brename:.zher2k_,.zher2k \
 
855
              -brename:.zscal_,.zscal \
 
856
              -brename:.zswap_,.zswap \
 
857
              -brename:.ztrmm_,.ztrmm \
 
858
              -brename:.ztrmv_,.ztrmv \
 
859
              -brename:.izamax_,.izamax
 
860
#              -brename:.zherk_,.zherk \
 
861
#              -brename:.zhemm_,.zhemm \
 
862
#              -brename:.ztrsm_,.ztrsm \
 
863
#              -brename:.dtrsv_,.dtrsv \
 
864
#              -brename:.ztrsv_,.ztrsv 
 
865
#              -brename:.dsymm_,.dsymm \
 
866
#
 
867
 
 
868
##comment out from dtrmm_ inclusive
 
869
 
 
870
  EXPLICITF = TRUE
 
871
  FCONVERT = $(CPP) $(CPPFLAGS) $< > $*.f
 
872
#
 
873
endif
 
874
 
 
875
ifeq ($(TARGET),IBM64)
 
876
 
877
# IBM AIX 64-bit
 
878
# tested on ecs1 May 10 2000 AIX 4.3.3.10
 
879
# does not run on AIX  4.3.2.1 (skunkworks)
 
880
#
 
881
   ifeq ($(LAPACK_LIB),)
 
882
      CORE_SUBDIRS_EXTRA += lapack
 
883
   endif
 
884
   ifeq ($(BLAS_LIB),)
 
885
      CORE_SUBDIRS_EXTRA += blas
 
886
   endif
 
887
         FC = xlf
 
888
         ifeq ($(FC),xlf)
 
889
           _FC=xlf
 
890
         endif
 
891
         CC = xlc
 
892
         AR = ar -X 64
 
893
     RANLIB = echo
 
894
  MAKEFLAGS = -j 11 --no-print-directory
 
895
    INSTALL = @echo $@ is built
 
896
        CPP = /usr/lib/cpp -P
 
897
 
 
898
   FOPTIONS = -qEXTNAME -qnosave -qalign=4k -q64 -qxlf77=leadzero
 
899
   COPTIONS = -q64
 
900
  FOPTIMIZE = -O3 -qstrict -NQ40000 -NT80000  -qarch=auto -qtune=auto
 
901
RSQRT=y
 
902
    FDEBUG = -O2 -qmaxmem=8192
 
903
  ifdef RSQRT
 
904
    FOPTIMIZE  += -qfloat=rsqrt:fltint
 
905
  endif
 
906
    XLF8= $(shell /usr/bin/lslpp -l xlfcmp  2>&1|grep COMM|head -n 1| awk ' / [8-9]./  {print "Y"};/[ ][1][0-9]./  {print "Y"}')
 
907
  ifdef XLF8
 
908
    FVECTORIZE= -O3 -qstrict -qtune=auto -qarch=auto -qcache=auto -qalign=natural -qnozerosize -qlargepage -qnozerosize -qipa=level=2
 
909
#old    FOPTIMIZE = -O4  -NQ40000 -NT80000  -qarch=auto -qtune=auto
 
910
    FOPTIMIZE = -O3   -qarch=auto -qtune=auto
 
911
#adding -qstrict to fix linking problem for v10.1
 
912
    FOPTIMIZE  += -qstrict# -qipa -qhot -qlargepage -qessl 
 
913
    FOPTIONS += -blpdata  
 
914
    FOPTIMIZE  += -qfloat=rsqrt:fltint
 
915
    FVECTORIZE  += -qfloat=rsqrt:fltint
 
916
  endif
 
917
   COPTIMIZE = -O -qmaxmem=8192
 
918
 
 
919
    DEFINES = -DIBM -DAIX -DEXTNAME
 
920
    DEFINES += -DCHKUNDFLW
 
921
       LIBPATH += -L/usr/lib -L/lib 
 
922
ifdef USE_I4FLAGS
 
923
   FOPTIONS += -qintsize=4
 
924
else
 
925
   FOPTIONS += -qintsize=8 
 
926
endif
 
927
   DEFINES  += -DEXT_INT 
 
928
  ifdef  USE_GPROF
 
929
    FOPTIONS += -pg
 
930
    LDOPTIONS += -pg
 
931
  endif
 
932
  LDOPTIONS += -bloadmap:nwchem.ibm64map -bbigtoc # bigtoc requires bmaxdata
 
933
  LDOPTIONS += -bmaxstack:0x80000000 -bmaxdata:0x200000000 # this limits MA to 8GB
 
934
  ifeq ($(LAPACK_LIB),)
 
935
     CORE_LIBS += -llapack
 
936
  endif
 
937
  CORE_LIBS += $(BLASOPT)
 
938
  ifeq ($(BLAS_LIB),)
 
939
     CORE_LIBS += -lblas
 
940
  endif
 
941
  XLFBREN = y
 
942
 
 
943
 
 
944
  EXPLICITF = TRUE
 
945
  FCONVERT = $(CPP) $(CPPFLAGS) $< > $*.f
 
946
#
 
947
endif
 
948
 
 
949
 
 
950
ifeq ($(TARGET),LAPI)
 
951
#
 
952
    CORE_SUBDIRS_EXTRA = lapack blas
 
953
         FC = mpxlf_r 
 
954
ifdef OLDXLF
 
955
         FC += -qnohpf
 
956
endif
 
957
         CC = mpcc_r
 
958
    ARFLAGS = urs
 
959
     RANLIB = echo
 
960
  MAKEFLAGS = -j 1 --no-print-directory
 
961
    INSTALL = @echo $@ is built
 
962
        CPP = /usr/lib/cpp -P
 
963
     MPILIB = 
 
964
LARGE_FILES = YES
 
965
 
 
966
  LDOPTIONS = -lc_r -lxlf90_r -lm_r -qEXTNAME -qnosave -qalign=4k -g 
 
967
   LINK.f   = mpcc_r   $(LDFLAGS)
 
968
   FOPTIONS = -qEXTNAME -qnosave -qalign=4k  -qxlf77=leadzero
 
969
  ifdef  USE_GPROF
 
970
    FOPTIONS += -pg
 
971
    LDOPTIONS += -pg
 
972
  endif
 
973
# -qinitauto=7F # note that grad_force breaks with this option
 
974
   COPTIONS = 
 
975
  FOPTIMIZE = -O3 -qstrict -NQ40000 -NT80000 -NS10000 -qipa=level=2
 
976
  ifdef RSQRT
 
977
    FOPTIMIZE  += -qfloat=rsqrt:fltint
 
978
  endif
 
979
  COPTIMIZE = -O
 
980
        FC += -qarch=auto -qtune=auto -qcache=auto -qthreaded
 
981
        CC += -qarch=auto -qtune=auto -qcache=auto
 
982
 
 
983
 
 
984
    DEFINES = -DLAPI -DSP1 -DAIX -DEXTNAME
 
985
    DEFINES += -DCHKUNDFLW
 
986
 
 
987
USE_ESSL = YES
 
988
ifdef USE_ESSL
 
989
 CORE_LIBS +=  -lessl
 
990
endif
 
991
ifdef USE_PESSL
 
992
   DEFINES += -DESSL
 
993
 CORE_LIBS += -lpessl -lblacs 
 
994
endif
 
995
# Need ESSL before our own BLAS library but still need our
 
996
# own stuff for misc. missing routines
 
997
 
 
998
CORE_LIBS +=  -llapack -lblas
 
999
 
 
1000
  LDOPTIONS += -bloadmap:nwchem.lapimap -bbigtoc
 
1001
  LDOPTIONS += -bmaxstack:0x60000000 -bmaxdata:0x60000000 # needed because of bigtoc
 
1002
 
 
1003
 EXPLICITF = TRUE
 
1004
  FCONVERT = $(CPP) $(CPPFLAGS) $< > $*.f
 
1005
#
 
1006
endif
 
1007
 
 
1008
ifeq ($(TARGET),LAPI64)
 
1009
#
 
1010
    CORE_SUBDIRS_EXTRA = lapack blas
 
1011
         FC = mpxlf_r 
 
1012
         CC = mpcc_r
 
1013
    ARFLAGS = urs
 
1014
     RANLIB = echo
 
1015
  MAKEFLAGS = -j 3 --no-print-directory
 
1016
    INSTALL = @echo $@ is built
 
1017
        CPP = /usr/lib/cpp -P
 
1018
     MPILIB = 
 
1019
LARGE_FILES = YES
 
1020
 
 
1021
  LDOPTIONS = -lc_r -lxlf90_r -lm_r -qEXTNAME -qnosave -q64  -bloadmap:nwchem.lapi64_map $(LAPI64LIBS)
 
1022
   LINK.f   = mpxlf_r   $(LDFLAGS)
 
1023
 
 
1024
   FOPTIONS = -qEXTNAME -qnosave -q64 -qalign=4k -qxlf77=leadzero -qthreaded
 
1025
       AR   = ar -X 64
 
1026
   COPTIONS = -q64
 
1027
  FOPTIMIZE = -O3 -qstrict -NQ40000 -NT80000
 
1028
  FOPTIMIZE += -qarch=auto -qtune=auto -qcache=auto
 
1029
  ifdef RSQRT
 
1030
    FOPTIMIZE  += -qfloat=rsqrt:fltint
 
1031
  endif
 
1032
  COPTIMIZE = -O
 
1033
    XLF8= $(shell xlf -qversion  2>&1|grep Version|head -1| awk ' / [8-9]./  {print "Y"};/[ ][1][0-9]./  {print "Y"}')
 
1034
    XLF10 = $(shell xlf -qversion  2>&1|grep Version|head -1| awk ' / 10./ {print "Y"}')
 
1035
    XLF11 = $(shell xlf -qversion  2>&1|grep Version|head -1| awk ' / 11./ {print "Y"}')
 
1036
  ifdef XLF8
 
1037
    FVECTORIZE= -O3 -qstrict -qtune=auto -qarch=auto -qcache=auto -qalign=natural -qnozerosize -qlargepage -qnozerosize -qipa=level=2
 
1038
    FOPTIMIZE = -O4  -NQ40000 -NT80000  -qarch=auto -qtune=auto
 
1039
    FOPTIMIZE  += -qipa -qhot -qlargepage -qessl 
 
1040
    FOPTIONS += -blpdata  
 
1041
    FOPTIMIZE  += -qfloat=rsqrt:fltint
 
1042
    FVECTORIZE  += -qfloat=rsqrt:fltint
 
1043
  endif
 
1044
 
 
1045
    DEFINES = -DLAPI64 -DEXTNAME -DLAPI -DSP1 -DAIX
 
1046
    DEFINES += -DCHKUNDFLW
 
1047
ifdef USE_I4FLAGS
 
1048
   FOPTIONS += -qintsize=4
 
1049
else
 
1050
   FOPTIONS += -qintsize=8
 
1051
endif
 
1052
  DEFINES += -DEXT_INT
 
1053
  CORE_LIBS +=  $(BLASOPT) -llapack -lblas
 
1054
  LDOPTIONS += -bloadmap:nwchem.lapi64map -bbigtoc
 
1055
  LDOPTIONS += -bmaxstack:0x80000000 -bmaxdata:0x80000000 # needed because of bigtoc
 
1056
#  LDOPTIONS += -bmaxstack:0xe0000000 -bmaxdata:0xe0000000 # this for large memory
 
1057
  XLFBREN = y
 
1058
 
 
1059
 EXPLICITF = TRUE
 
1060
  FCONVERT = $(CPP) $(CPPFLAGS) $< > $*.f
 
1061
#
 
1062
endif
 
1063
 
 
1064
ifeq ($(TARGET),DECOSF)
 
1065
#
 
1066
# DEC AXP OSF1
 
1067
#
 
1068
# JN 96/10/02:
 
1069
# Replaced -DLongInteger with -DEXT_INT for consistency with GA, DRA, PEIGS ...
 
1070
 
 
1071
    CORE_SUBDIRS_EXTRA = blas lapack
 
1072
#                  NICE = nice
 
1073
#                SHELL := $(NICE) /bin/sh
 
1074
                    FC = f77
 
1075
                    AR = ar
 
1076
                RANLIB = echo
 
1077
                   CPP = /usr/bin/cpp -P -C     
 
1078
 
 
1079
               INSTALL = @echo nwchem is built
 
1080
             MAKEFLAGS = -j 1 --no-print-directory
 
1081
 
 
1082
# -fpe2 and call to util/dec_fpe.f from nwchem.F necessary to avoid
 
1083
# braindead alpha undflows inside texas (c6h6 6-31g)
 
1084
 
 
1085
# assume noaccuracy_sensitive was breaking the code in recent versions (EA)
 
1086
              FDEBUG = -g -O0
 
1087
              FOPTIONS = -align dcommons -math_library fast -fpe2 -check nounderflow -check nopower -check nooverflow  -warn argument_checking -warn unused -automatic -math_library fast
 
1088
 
 
1089
             COPTIONS = 
 
1090
             LDOPTIONS = -O
 
1091
             LINK.f = f77 $(LDFLAGS)
 
1092
             FOPTIMIZE =  -O4  -tune host -arch host  
 
1093
             FVECTORIZE = -fast -O4 -tune host -arch host
 
1094
             COPTIMIZE = -O
 
1095
 
 
1096
               DEFINES = -DDECOSF
 
1097
ifdef USE_I4FLAGS
 
1098
              FOPTIONS +=  -i4
 
1099
else
 
1100
              FOPTIONS +=  -i8
 
1101
endif
 
1102
               DEFINES +=  -DEXT_INT 
 
1103
             CORE_LIBS +=  -llapack $(BLASOPT) -lblas 
 
1104
            EXTRA_LIBS = -laio 
 
1105
ifeq ($(BUILDING_PYTHON),python)
 
1106
      EXTRA_LIBS += -lX11
 
1107
endif
 
1108
endif
 
1109
ifeq ($(TARGET),MACX)
 
1110
  FC = gfortran
 
1111
  _FC = gfortran
 
1112
#
 
1113
# MacOSX 
 
1114
#
 
1115
ifdef USE_VECLIB
 
1116
    CORE_SUBDIRS_EXTRA =  blas
 
1117
else
 
1118
    CORE_SUBDIRS_EXTRA =  blas lapack
 
1119
endif
 
1120
               _CPU = $(shell machine  )
 
1121
                    FC = gfortran
 
1122
               INSTALL = @echo nwchem is built
 
1123
               RANLIB = ranlib
 
1124
             MAKEFLAGS = -j 1 --no-print-directory
 
1125
             DEFINES =-DMACX
 
1126
 
 
1127
  ifeq ($(FC),xlf)
 
1128
    _FC=xlf
 
1129
    XLFMAC=y
 
1130
    FOPTIONS = -qextname -qfixed -qnosave  -qalign=4k
 
1131
    FOPTIONS +=  -NQ40000 -NT80000 -NS2048 -qmaxmem=8192 -qxlf77=leadzero
 
1132
    FOPTIMIZE= -O3 -qstrict  -qarch=auto -qtune=auto -qcache=auto -qcompact
 
1133
    ifdef RSQRT
 
1134
      FOPTIMIZE  += -qfloat=rsqrt:fltint
 
1135
    endif
 
1136
    FVECTORIZE += $(FOPTIMIZE) -qunroll=yes 
 
1137
    FDEBUG= -O2 -qcompact 
 
1138
    DEFINES  +=-DXLFLINUX -DCHKUNDFLW
 
1139
     FOPTIONS += $(INCLUDES) -WF,"$(DEFINES)" $(shell echo $(LIB_DEFINES) | sed -e "s/-D/-WF,-D/g"   | sed -e 's/\"/\\\"/g'  | sed -e "s/\'/\\\'/g")
 
1140
  endif
 
1141
  ifeq ($(FC),g77)
 
1142
#g77, only decent one form Fink http://fink.sf.net
 
1143
#gcc version 3.4 20031015 (experimental)
 
1144
    _G77V33= $(shell g77 -v  2>&1|egrep spec|head -n 1|awk ' /3.3/  {print "Y"}')
 
1145
    FDEBUG= -O1 -g
 
1146
    FOPTIONS   = -fno-second-underscore -fno-globals -Wno-globals
 
1147
    FOPTIMIZE  = -O3 -fno-inline-functions -funroll-loops
 
1148
    FOPTIMIZE += -falign-loops=16 -falign-jumps=16 -falign-functions=16
 
1149
    FOPTIMIZE += -ffast-math -mpowerpc-gpopt
 
1150
    FOPTIMIZE += -maltivec
 
1151
    ifeq ($(_G77V33),Y)
 
1152
      FOPTIONS += -fno-force-mem 
 
1153
      FOPTIMIZE += -fno-force-mem 
 
1154
    endif
 
1155
    ifeq ($(_CPU),ppc970)
 
1156
#G5
 
1157
      FOPTIMIZE += -mtune=970 -mcpu=970 -mpowerpc64
 
1158
    endif
 
1159
    ifeq ($(_CPU),ppc7450)
 
1160
#G4
 
1161
      FOPTIMIZE += -mtune=7450 -mcpu=7450
 
1162
    endif
 
1163
    endif
 
1164
      ifeq ($(FC),gfortran)
 
1165
    _FC=gfortran
 
1166
#gcc version 4.2.0 200512 (experimental)
 
1167
        LINK.f = gfortran  $(LDFLAGS) 
 
1168
        FOPTIONS   = -Wextra #-Wunused #-ffast-math
 
1169
        FOPTIMIZE  = -O2 -ffast-math -Wuninitialized 
 
1170
        DEFINES  += -DGFORTRAN
 
1171
        GNUMAJOR=$(shell $(FC) -dM -E - < /dev/null | egrep __VERS | cut -c22)
 
1172
        ifdef GNUMAJOR
 
1173
        GNUMINOR=$(shell $(FC) -dM -E - < /dev/null | egrep __VERS | cut -c24)
 
1174
        GNU_GE_4_6 = $(shell [ $(GNUMAJOR) -gt 4 -o \( $(GNUMAJOR) -eq 4 -a $(GNUMINOR) -ge 6 \) ] && echo true)
 
1175
        endif
 
1176
        ifeq ($(GNU_GE_4_6),true)
 
1177
        DEFINES  += -DGCC46
 
1178
    endif
 
1179
        ifdef USE_OPENMP
 
1180
           FOPTIONS  += -fopenmp
 
1181
           LDOPTIONS += -fopenmp
 
1182
           DEFINES += -DUSE_OPENMP
 
1183
        endif
 
1184
        ifeq ($(_CPU),ppc970)
 
1185
#G5
 
1186
         FVECTORIZE = -ffast-math  -O2 -ftree-vectorize 
 
1187
         FVECTORIZE += -ftree-vectorizer-verbose=1
 
1188
         FOPTIMIZE += -mtune=970 -mcpu=970 -mpowerpc64
 
1189
         FVECTORIZE += -mtune=970 -mcpu=970 -mpowerpc64
 
1190
        endif
 
1191
       ifeq ($(_CPU),ppc7450)
 
1192
#G4
 
1193
        FVECTORIZE = -ffast-math  -O2 -ftree-vectorize 
 
1194
        FVECTORIZE += -ftree-vectorizer-verbose=1
 
1195
        FOPTIMIZE  += -fprefetch-loop-arrays #-ftree-loop-linear
 
1196
        FOPTIMIZE += -mtune=7450 -mcpu=7450
 
1197
       endif
 
1198
       ifeq ($(_CPU),i486)
 
1199
#gcc version 4.2.0 200608 (experimental)
 
1200
#         FOPTIONS= -malign-double# this break with gfort 4.2 and later http://gcc.gnu.org/bugzilla/show_bug.cgi?id=29562
 
1201
         FOPTIMIZE+= -funroll-all-loops -mtune=native 
 
1202
         FVECTORIZE=-O3 -ffast-math -mtune=native -mfpmath=sse -msse3 -ftree-vectorize -ftree-vectorizer-verbose=1   -fprefetch-loop-arrays  -funroll-all-loops 
 
1203
#         FOPTIMIZE=-O1
 
1204
#         FVECTORIZE=-O1
 
1205
       endif
 
1206
        ifdef USE_F2C
 
1207
#possible segv with use of zdotc (e.g. with GOTO BLAS)
 
1208
#http://gcc.gnu.org/bugzilla/show_bug.cgi?id=20178
 
1209
          FOPTIONS +=  -ff2c -fno-second-underscore
 
1210
        endif
 
1211
        FDEBUG = -g -O1
 
1212
        DEFINES  += -DCHKUNDFLW -DGCC4
 
1213
      endif
 
1214
      ifeq ($(FC),ifort)
 
1215
    _FC=ifort
 
1216
#ifort 9.1
 
1217
#        LINK.f = ifort  $(LDFLAGS) 
 
1218
        FOPTIONS   = -align    -mp1 -w -g -vec-report1
 
1219
  ifdef  USE_GPROF
 
1220
    FOPTIONS += -qp
 
1221
  endif
 
1222
    FOPTIMIZE = -O3 -prefetch  -unroll 
 
1223
    FDEBUG=-O0 -g
 
1224
    DEFINES   += -DIFCLINUX
 
1225
    endif
 
1226
    ifeq ($(CC),xlc)
 
1227
      COPTIONS  +=  -qlanglvl=extended
 
1228
    else
 
1229
      COPTIONS   = -Wall -no-cpp-precomp
 
1230
      COPTIMIZE  = -g -O2
 
1231
    endif
 
1232
    ifdef  USE_GPROF
 
1233
      FOPTIONS += -pg
 
1234
      LDOPTIONS += -pg
 
1235
      COPTIONS += -pg
 
1236
    endif
 
1237
ifdef USE_VECLIB
 
1238
             CORE_LIBS += $(BLASOPT)  -Wl,-framework -Wl,vecLib -lblas
 
1239
else
 
1240
             CORE_LIBS +=   -llapack $(BLASOPT)  -lblas
 
1241
endif
 
1242
  ifeq ($(FC),xlf) 
 
1243
     LDOPTIONS = -Wl,-multiply_defined -Wl,warning
 
1244
  else
 
1245
  _GCC4= $(shell gcc -v  2>&1|egrep spec|head -n 1|awk ' / 3./  {print "N";exit}; / 2./ {print "N";exit};{print "Y"}')
 
1246
    ifeq ($(_GCC4),Y) 
 
1247
#      EXTRA_LIBS += 
 
1248
    else
 
1249
      EXTRA_LIBS += -lm -lcc_dynamic
 
1250
    endif
 
1251
  endif
 
1252
  endif
 
1253
#
 
1254
   _V104=$(shell uname -v 2>&1|awk ' /Version 7./ {print "N";exit}; /Version 8./ {print "Y";exit}')
 
1255
  ifeq ($(_V104),Y)
 
1256
    EXTRA_LIBS +=-lSystemStubs
 
1257
 
 
1258
 
 
1259
endif
 
1260
ifeq ($(TARGET),MACX64)
 
1261
  FC = gfortran
 
1262
  _FC = gfortran
 
1263
#
 
1264
# MacOSX 64bit
 
1265
#
 
1266
ifdef USE_VECLIB
 
1267
   ifdef USE_64TO32
 
1268
      CORE_SUBDIRS_EXTRA =
 
1269
   else
 
1270
      vecliberr:
 
1271
                @echo The Apple supplied vector math library does not support 8-byte integers
 
1272
                @echo You must also set USE_64TO32 and do a "make 64_to_32" to change the source code
 
1273
                @exit 1
 
1274
   endif
 
1275
else
 
1276
   ifeq ($(BLAS_LIB),)
 
1277
      CORE_SUBDIRS_EXTRA += blas
 
1278
   endif
 
1279
   ifeq ($(LAPACK_LIB),)
 
1280
      CORE_SUBDIRS_EXTRA += lapack
 
1281
   endif
 
1282
endif
 
1283
               _CPU = $(shell machine  )
 
1284
                    FC = gfortran
 
1285
               INSTALL = @echo nwchem is built
 
1286
               RANLIB = ranlib
 
1287
             MAKEFLAGS = -j 1 --no-print-directory
 
1288
             DEFINES =-DMACX
 
1289
 
 
1290
      ifeq ($(FC),gfortran)
 
1291
    _FC=gfortran
 
1292
#gcc version 
 
1293
        LINK.f = gfortran  $(LDFLAGS) 
 
1294
        FOPTIONS   = -Wextra #-Wunused #-ffast-math
 
1295
        FOPTIONS += -fdefault-integer-8
 
1296
        FOPTIMIZE  = -O2 -ffast-math -Wuninitialized 
 
1297
       DEFINES  += -DGFORTRAN -DGCC4
 
1298
       DEFINES  += -DEXT_INT
 
1299
#
 
1300
         FOPTIMIZE+= -funroll-all-loops -mtune=native 
 
1301
         FVECTORIZE=-O3 -ffast-math -mtune=native -mfpmath=sse -msse3 -ftree-vectorize -ftree-vectorizer-verbose=1   -fprefetch-loop-arrays  -funroll-all-loops 
 
1302
#         FOPTIMIZE=-O1
 
1303
#         FVECTORIZE=-O1
 
1304
        GNUMAJOR=$(shell $(FC) -dumpversion | cut -f1 -d.)
 
1305
        GNUMAJOR=$(shell $(FC) -dM -E - < /dev/null | egrep __VERS | cut -c22)
 
1306
        ifdef GNUMAJOR
 
1307
        GNUMINOR=$(shell $(FC) -dM -E - < /dev/null | egrep __VERS | cut -c24)
 
1308
        GNU_GE_4_6 = $(shell [ $(GNUMAJOR) -gt 4 -o \( $(GNUMAJOR) -eq 4 -a $(GNUMINOR) -ge 6 \) ] && echo true)
 
1309
        ifeq ($(GNU_GE_4_6),true)
 
1310
         DEFINES  += -DGCC46
 
1311
        endif
 
1312
        endif
 
1313
       endif
 
1314
    ifdef  USE_GPROF
 
1315
      FOPTIONS += -pg
 
1316
      LDOPTIONS += -pg
 
1317
      COPTIONS += -pg
 
1318
    endif
 
1319
ifdef USE_VECLIB
 
1320
             CORE_LIBS += $(BLASOPT)  -Wl,-framework -Wl,vecLib -lblas
 
1321
else
 
1322
   ifeq ($(LAPACK_LIB),)
 
1323
      CORE_LIBS += -llapack
 
1324
   endif
 
1325
   CORE_LIBS +=    $(BLASOPT)
 
1326
   ifeq ($(BLAS_LIB),)
 
1327
      CORE_LIBS += -lblas
 
1328
   endif
 
1329
endif
 
1330
  _GCC4= $(shell gcc -v  2>&1|egrep spec|head -n 1|awk ' / 3./  {print "N";exit}; / 2./ {print "N";exit};{print "Y"}')
 
1331
    ifeq ($(_GCC4),Y) 
 
1332
#      EXTRA_LIBS += 
 
1333
    else
 
1334
      EXTRA_LIBS += -lm -lcc_dynamic
 
1335
    endif
 
1336
#
 
1337
 
 
1338
endif
 
1339
 
 
1340
 
 
1341
ifeq ($(TARGET),$(findstring $(TARGET),LINUX LINUX64 CYGNUS CYGWIN INTERIX))
 
1342
#
 
1343
#
 
1344
# Linux or Cygwin under Windows running on an x86 using g77
 
1345
#
 
1346
       NICE = nice -n 2
 
1347
      SHELL := $(NICE) /bin/sh
 
1348
    CORE_SUBDIRS_EXTRA = blas lapack
 
1349
         CC = gcc
 
1350
     RANLIB = ranlib
 
1351
  MAKEFLAGS = -j 1 --no-print-directory
 
1352
    INSTALL = @echo $@ is built
 
1353
        CPP = gcc -E -nostdinc -undef -P
 
1354
   FCONVERT = (/bin/cp $< /tmp/$$$$.c; \
 
1355
                        $(CPP) $(CPPFLAGS) /tmp/$$$$.c | sed '/^$$/d' > $*.f; \
 
1356
                        /bin/rm -f /tmp/$$$$.c) || exit 1
 
1357
 
 
1358
         FC  = gfortran
 
1359
         LINUXCPU_ = $(shell uname -m |\
 
1360
                 awk ' /sparc/ { print "sparc" }; /i*86/ { print "x86" };  /ppc*/ { print "ppc"} ' )
 
1361
 
 
1362
ifeq ($(BUILDING_PYTHON),python)
 
1363
#   EXTRA_LIBS += -ltk -ltcl -L/usr/X11R6/lib -lX11 
 
1364
#   EXTRA_LIBS += -L/home/edo/tcltk/lib/LINUX -ltk8.3 -ltcl8.3 -L/usr/X11R6/lib -lX11 -ldl
 
1365
# needed if python was built with pthread support
 
1366
   EXTRA_LIBS += -lz  -lreadline -lncurses -lnwcutil  -lpthread -lutil -ldl -lsysfs
 
1367
endif
 
1368
 
 
1369
  DEFINES = -DLINUX -DGCC4 -DGCC46
 
1370
  FOPTIONS   += -fno-second-underscore -Wall
 
1371
  FOPTIONS   += -ffixed-line-length-72 -ffixed-form
 
1372
  FOPTIMIZE  += -g -O2 
 
1373
  FOPTIONS   += -Wno-globals
 
1374
  COPTIONS   += -Wall
 
1375
  COPTIMIZE  += -g -O2
 
1376
 
 
1377
      FOPTIMIZE  = -O2 
 
1378
      ifeq ($(FC),gfortran)
 
1379
        FOPTIONS   = -Wextra -ffast-math #-Wunused  
 
1380
        FOPTIMIZE  += -ffast-math -Wuninitialized
 
1381
        _FC=gfortran
 
1382
        DEFINES  += -DGFORTRAN
 
1383
      endif
 
1384
      COPTIONS   = -Wall
 
1385
      COPTIMIZE  = -g -O2
 
1386
 
 
1387
ifeq ($(LINUXCPU),x86) 
 
1388
  ifeq ($(TARGET),CYGNUS)
 
1389
    DEFINES += -DCYGNUS
 
1390
  endif
 
1391
  ifeq ($(TARGET),CYGWIN)
 
1392
    DEFINES += -DCYGWIN -DCYGNUS
 
1393
  endif
 
1394
  
 
1395
  _CPU_ = $(shell uname -m  )
 
1396
  _G77V33= $(shell g77 -v  2>&1|egrep spec|head -n 1|awk ' /3.3/  {print "Y"}')
 
1397
 
 
1398
      ifeq ($(FC),g77)
 
1399
  FOPTIONS   += -fno-second-underscore   
 
1400
  FOPTIONS   += -fno-f90  -ffixed-line-length-72 -ffixed-form
 
1401
  FOPTIMIZE  +=  -O2  -malign-double -finline-functions 
 
1402
  COPTIONS   += -Wall  -malign-double 
 
1403
  COPTIMIZE  += -g -O2
 
1404
    FOPTIONS  +=  -malign-double -fno-globals -Wno-globals  -fno-silent #-Wunused  
 
1405
    FOPTIMIZE += -Wuninitialized -ffast-math -funroll-loops -fstrength-reduce 
 
1406
    FOPTIMIZE += -fno-move-all-movables -fno-reduce-all-givs 
 
1407
    FOPTIMIZE += -fforce-addr 
 
1408
# see http://gcc.gnu.org/bugzilla/show_bug.cgi?id=13037
 
1409
#  for atomscf/orderd.f  (bug report by Kirill Smelkov)
 
1410
    ifeq ($(_G77V33),Y)
 
1411
      FOPTIONS += -fno-force-mem 
 
1412
      FOPTIMIZE += -fno-force-mem 
 
1413
    else
 
1414
      FOPTIMIZE += -fforce-mem 
 
1415
    endif
 
1416
endif
 
1417
 
 
1418
 
 
1419
    ifeq ($(_CPU),i686)
 
1420
     _GOTSSE2= $(shell cat /proc/cpuinfo | egrep sse2 | tail -n 1 | awk ' /sse2/  {print "Y"}')
 
1421
      ifeq ($(_GOTSSE2),Y) 
 
1422
        _CPU=i786
 
1423
      endif
 
1424
    endif
 
1425
 
 
1426
    ifeq ($(_CPU),i786)
 
1427
      COPTIONS   =  -march=i686 
 
1428
      ifdef USE_GCC31
 
1429
        FDEBUG=-O1 -g
 
1430
        COPTIMIZE +=-march=pentium4 -mcpu=pentium4 #-msse2 -mfpmath=sse 
 
1431
#        COPTIMIZE +=-fprefetch-loop-arrays -minline-all-stringops -fexpensive-optimizations
 
1432
        FOPTIMIZE +=-march=pentium4 -mcpu=pentium4# -msse2 -mfpmath=sse 
 
1433
#        FOPTIMIZE +=-fprefetch-loop-arrays -minline-all-stringops -fexpensive-optimizations
 
1434
      else
 
1435
        FOPTIMIZE  += -march=i686
 
1436
        COPTIONS   = -Wall -march=i686 -malign-double 
 
1437
      endif
 
1438
    else
 
1439
    ifneq ($(_CPU),x86)
 
1440
      COPTIONS   +=  -march=$(_CPU)
 
1441
      FOPTIONS   +=  -march=$(_CPU)
 
1442
    endif
 
1443
    endif
 
1444
    ifeq ($(_CPU),k7)
 
1445
       FOPTIONS   = -fno-second-underscore  
 
1446
       COPTIONS   = -Wall -malign-double
 
1447
       ifdef  USE_GCC31
 
1448
        FOPTIONS += -march=athlon
 
1449
        COPTIONS += -march=athlon
 
1450
       else
 
1451
        FOPTIONS += -march=k6
 
1452
        COPTIONS += -march=k6
 
1453
       endif
 
1454
    endif
 
1455
 
 
1456
  ifeq ($(FC),pgf77)
 
1457
    DEFINES   += -DPGLINUX
 
1458
# added -Kieee to get dlamc1 to work on pgf77 3.1-3 EA Jun 8th 2000
 
1459
    FOPTIONS   = -Mdalign -Minform,warn -Mnolist -Minfo=loop -Munixlogical -Kieee
 
1460
    ifeq ($(_CPU),i586)
 
1461
      FOPTIONS  += -tp p5  
 
1462
    endif
 
1463
    ifeq ($(_CPU),i686)
 
1464
      FOPTIONS  += -tp p6 -Mvect=prefetch
 
1465
    endif
 
1466
    ifeq ($(_CPU),i786)
 
1467
      FOPTIONS  += -tp piv  -Mcache_align  -Mvect=prefetch
 
1468
    endif
 
1469
    FOPTIMIZE  = -O2 -Mvect=assoc,cachesize:262144 -Munroll -Mnoframe
 
1470
  endif
 
1471
 _FC=g77
 
1472
 ifeq ($(FC),ifc)
 
1473
     _FC=ifc
 
1474
 endif
 
1475
 ifeq ($(FC),ifort)
 
1476
     _FC=ifc
 
1477
 endif
 
1478
  ifeq ($(FC),gfortran)
 
1479
       _FC=gfortran
 
1480
       DEFINES  += -DGFORTRAN
 
1481
  endif
 
1482
  ifeq ($(_FC),ifc)
 
1483
  FOPTIONS   =  -align    -mp1 -w -g -vec-report1
 
1484
  ifdef  USE_GPROF
 
1485
    FOPTIONS += -qp
 
1486
  endif
 
1487
    _IFCV7= $(shell ifort -v  2>&1|egrep "Version "|head -n 1|awk '/7./ {print "Y"; exit}')
 
1488
    _IFCV10= $(shell ifort -v  2>&1|egrep "Version "|head -n 1|awk '/10./ {print "Y"; exit}')
 
1489
    ifneq ($(_IFCV7),Y)
 
1490
      DEFINES+= -DIFCV8
 
1491
      ifeq ($(FC),ifc)
 
1492
          FOPTIONS += -quiet
 
1493
      endif
 
1494
    endif       
 
1495
    ifdef  USE_FPE
 
1496
      FOPTIONS += -fpe-all=0 -traceback #-fp-model  precise
 
1497
    endif
 
1498
 
 
1499
    FOPTIMIZE = -O3 -prefetch  -unroll 
 
1500
    ifeq ($(_CPU),i586)
 
1501
      FOPTIMIZE +=  -tpp5 -xi # this are for PentiumII
 
1502
    endif
 
1503
    ifeq ($(_CPU),k7)
 
1504
      FOPTIMIZE +=  -xM  # this are for Athlon
 
1505
    endif
 
1506
    ifeq ($(_CPU),i686)
 
1507
      FOPTIMIZE +=  -tpp6 -xK   # this are for PentiumIII
 
1508
    endif
 
1509
    ifeq ($(_CPU),i786)
 
1510
      FOPTIMIZE +=  -tpp7 -xW    # this are for PentiumIV
 
1511
    endif
 
1512
    DEFINES   += -DIFCLINUX
 
1513
    ifneq ($(_IFCV7),Y)
 
1514
      FOPTIMIZE += -ansi_alias-
 
1515
    endif
 
1516
  endif
 
1517
      ifeq ($(_FC),gfortran)
 
1518
#gcc version 4.1.0 20050525 (experimental)
 
1519
        LINK.f = gfortran  $(LDFLAGS) 
 
1520
        FOPTIONS   = -Wextra -ffast-math #-Wunused  
 
1521
        FOPTIMIZE  = -O2 -ffast-math -Wuninitialized
 
1522
        ifeq ($(_CPU),i786)
 
1523
          FOPTIONS += -march=pentium4 -mtune=pentium4
 
1524
          FVECTORIZE = $(FOPTIMIZE) -O3 -ftree-vectorize 
 
1525
          FVECTORIZE += -ftree-vectorizer-verbose=1
 
1526
#        FOPTIMIZE  += -fprefetch-loop-arrays -ftree-loop-linear
 
1527
        else
 
1528
          FOPTIONS +=  -ffloat-store
 
1529
        endif
 
1530
        ifdef USE_F2C
 
1531
#possible segv with use of zdotc (e.g. with GOTO BLAS)
 
1532
#http://gcc.gnu.org/bugzilla/show_bug.cgi?id=20178
 
1533
          FOPTIONS +=  -ff2c -fno-second-underscore
 
1534
        endif
 
1535
        FDEBUG = -g -O0
 
1536
        DEFINES  += -DCHKUNDFLW -DGCC4
 
1537
        GNUMAJOR=$(shell $(FC) -dumpversion | cut -f1 -d.)
 
1538
        GNUMAJOR=$(shell $(FC) -dM -E - < /dev/null | egrep __VERS | cut -c22)
 
1539
        ifdef GNUMAJOR
 
1540
        GNUMINOR=$(shell $(FC) -dM -E - < /dev/null | egrep __VERS | cut -c24)
 
1541
        GNU_GE_4_6 = $(shell [ $(GNUMAJOR) -gt 4 -o \( $(GNUMAJOR) -eq 4 -a $(GNUMINOR) -ge 6 \) ] && echo true)
 
1542
        ifeq ($(GNU_GE_4_6),true)
 
1543
          DEFINES  += -DGCC46
 
1544
        endif
 
1545
        endif
 
1546
      endif
 
1547
 
 
1548
  ifeq ($(CC),icc)
 
1549
    COPTIONS   =   -mp1 -w -g -vec-report1
 
1550
    COPTIMIZE = -O3   -unroll 
 
1551
    ifeq ($(_CPU),i586)
 
1552
      COPTIMIZE +=  -tpp5 -xi # this are for PentiumII
 
1553
    endif
 
1554
    ifeq ($(_CPU),i686)
 
1555
      COPTIMIZE +=  -tpp6 -xK   # this are for PentiumIII
 
1556
    endif
 
1557
    ifeq ($(_CPU),i786)
 
1558
      COPTIMIZE +=  -tpp7 -xW   # this are for PentiumIV
 
1559
    endif
 
1560
  endif
 
1561
endif
 
1562
 
 
1563
  ifeq ($(LINUXCPU),ppc)
 
1564
# this are for PowerPC
 
1565
# Tested on SLES 9
 
1566
# Feb 7th 2005
 
1567
# xlf v9.1
 
1568
# xlc v7.0 
 
1569
# gcc-3.2.3-42 
 
1570
    ifeq ($(FC),xlf)
 
1571
      _FC=xlf
 
1572
    endif
 
1573
    ifeq ($(FC),blrts_xlf)
 
1574
      _FC=xlf
 
1575
    endif
 
1576
    ifeq ($(_FC),xlf)
 
1577
      FOPTIONS  = -q32  -qextname -qfixed 
 
1578
      FOPTIONS +=  -NQ40000 -NT80000 -NS2048 -qmaxmem=8192 -qxlf77=leadzero
 
1579
      FOPTIMIZE= -O3 -qstrict -qfloat=fltint
 
1580
      ifeq ($(FC),blrts_xlf)
 
1581
        FOPTIMIZE+= -qarch=440 -qtune=440
 
1582
      else
 
1583
        FOPTIMIZE+= -qarch=auto -qtune=auto
 
1584
      endif
 
1585
      FDEBUG= -O2 -g
 
1586
      EXPLICITF = TRUE
 
1587
      DEFINES  +=   -DXLFLINUX
 
1588
      CPP=/usr/bin/cpp  -P -C -traditional
 
1589
      FCONVERT = $(CPP) $(CPPFLAGS) $< > $*.f
 
1590
    endif
 
1591
    ifeq ($(FC),g77)
 
1592
      FOPTIONS   = -fno-second-underscore -fno-globals -Wno-globals
 
1593
      FOPTIMIZE  = -g -O2
 
1594
    endif
 
1595
    ifeq ($(CC),xlc)
 
1596
      _CC=xlc
 
1597
    endif
 
1598
    ifeq ($(CC),blrts_xlc)
 
1599
      _CC=xlc  
 
1600
    endif
 
1601
    ifeq ($(_CC),xlc)
 
1602
      COPTIONS  +=  -q32 -qlanglvl=extended
 
1603
    else
 
1604
      COPTIONS   = -Wall
 
1605
      COPTIMIZE  = -g -O2
 
1606
    endif
 
1607
    LDOPTIONS += -Wl,--relax #-v
 
1608
  endif
 
1609
 
 
1610
      LINK.f = $(FC) $(FOPTIONS) $(LDFLAGS) 
 
1611
ifeq ($(LINUXCPU),x86)
 
1612
  ifeq ($(FC),pgf77)
 
1613
   LDOPTIONS = -g -Wl,--export-dynamic
 
1614
   EXTRA_LIBS += -lm
 
1615
  else
 
1616
    ifeq ($(_FC),ifc)
 
1617
    ifneq ($(_IFCV7),Y)
 
1618
      EXTRA_LIBS +=  
 
1619
    else
 
1620
      EXTRA_LIBS +=   -Vaxlib  
 
1621
    endif
 
1622
      ifeq ($(_CPU),i786)
 
1623
        EXTRA_LIBS +=  -lsvml
 
1624
      endif
 
1625
      EXTRA_LIBS += #-static
 
1626
   LDOPTIONS = -g -Wl,--export-dynamic
 
1627
    else
 
1628
  LDOPTIONS = -Xlinker --export-dynamic 
 
1629
#  LDOPTIONS = --Xlinker -O -Xlinker -static
 
1630
      EXTRA_LIBS += -lm
 
1631
    endif
 
1632
  endif
 
1633
endif
 
1634
#EXTRA_LIBS +=-lefence # link against Electricfence
 
1635
 
 
1636
CORE_LIBS += -llapack $(BLASOPT) -lblas
 
1637
 
 
1638
# end of Linux, Cygnus
 
1639
endif
 
1640
 
 
1641
ifneq ($(TARGET),LINUX)
 
1642
ifeq ($(TARGET),$(findstring $(TARGET),LINUX64 CATAMOUNT))
 
1643
#ifeq ($(NWCHEM_TARGET),LINUX64)
 
1644
   ifeq ($(FC),g77)
 
1645
      g7764:
 
1646
        @echo 
 
1647
        @echo g77 not supported on 64-bit Linux
 
1648
        @echo please use supported gompilers
 
1649
        @echo 
 
1650
        @exit 1
 
1651
   endif
 
1652
      ifeq ($(FC),ftn)
 
1653
          _FC=pgf90
 
1654
          ifeq ($(PE_ENV),PGI)
 
1655
          _FC=pgf90
 
1656
          _CC=pgcc
 
1657
          endif
 
1658
          ifeq ($(PE_ENV),INTEL)
 
1659
          _FC=ifort
 
1660
          _CC=icc
 
1661
          endif
 
1662
          ifeq ($(PE_ENV),GNU)
 
1663
          _FC=gfortran
 
1664
          _CC=gcc
 
1665
          endif
 
1666
          ifeq ($(PE_ENV),CRAY)
 
1667
          _FC=crayftn
 
1668
          _CC=craycc
 
1669
          endif
 
1670
          DEFINES  += -DCRAYXT -DEAFHACK -DNOFSCHECK
 
1671
      endif
 
1672
      ifeq ($(CC),pgcc)
 
1673
        _CC=pgcc
 
1674
      endif
 
1675
      ifeq ($(CC),icc)
 
1676
        _CC=icc
 
1677
      endif
 
1678
      ifeq ($(FC),pgf90)
 
1679
        _FC=pgf90
 
1680
      endif
 
1681
      ifeq ($(FC),pgf77)
 
1682
        _FC=pgf90
 
1683
      endif
 
1684
      ifeq ($(FC),ifc)
 
1685
       _FC=ifort
 
1686
      endif
 
1687
      ifeq ($(FC),ifort)
 
1688
       _FC=ifort
 
1689
      endif
 
1690
      ifndef _FC
 
1691
      FC=gfortran
 
1692
      _FC=gfortran
 
1693
      endif
 
1694
      FOPTIMIZE  = -O2 
 
1695
      ifeq ($(FC),gfortran)
 
1696
        FOPTIONS   = -m64
 
1697
        COPTIONS   = -m64
 
1698
        FOPTIONS   += -ffast-math #-Wunused  
 
1699
        FOPTIMIZE  += -ffast-math -Wuninitialized
 
1700
       _FC=gfortran
 
1701
       DEFINES  += -DGFORTRAN
 
1702
      endif
 
1703
       ifdef USE_I4FLAGS
 
1704
           ifeq ($(_FC),gfortran)
 
1705
#wrong             FOPTIONS += -fdefault-integer-8
 
1706
           else  ifeq ($(_FC),crayftn)
 
1707
             FOPTIONS += -s integer32
 
1708
           else   
 
1709
             FOPTIONS += -i4
 
1710
           endif
 
1711
       else
 
1712
         ifeq ($(_FC),gfortran)
 
1713
           FOPTIONS += -fdefault-integer-8
 
1714
         else  ifeq ($(_FC),crayftn)
 
1715
             FOPTIONS += -s integer64
 
1716
         else
 
1717
           FOPTIONS += -i8
 
1718
         endif
 
1719
       endif
 
1720
       DEFINES  += -DEXT_INT -DGCC4 -DGCC46
 
1721
  MAKEFLAGS = -j 1 --no-print-directory
 
1722
     _CPU_ = $(shell uname -m  )
 
1723
     ifeq ($(BLAS_LIB),)
 
1724
       CORE_SUBDIRS_EXTRA += blas
 
1725
     endif
 
1726
     ifeq ($(LAPACK_LIB),)
 
1727
       CORE_SUBDIRS_EXTRA += lapack
 
1728
     endif
 
1729
     RANLIB = echo
 
1730
     DEFINES   +=   -DLINUX -DLINUX64
 
1731
     ifeq ($(_CPU),alpha)
 
1732
# using COMPAQ/DEC compilers (EA 3/13/2000)
 
1733
       FC  = fort
 
1734
       CC  = ccc      
 
1735
       FOPTIONS   += -assume no2underscore -align dcommons -check nooverflow -assume accuracy_sensitive -check nopower -check nounderflow  -noautomatic
 
1736
       DEFINES   +=   -DLINUXALPHA
 
1737
       FOPTIMIZE =  -O4  -tune host -arch host  -math_library fast
 
1738
       FVECTORIZE = -fast -O5 -tune host -arch host
 
1739
 
 
1740
       ifdef USE_I4FLAGS
 
1741
         FOPTIONS +=  -fpe0
 
1742
# needed: binutils 2.11 for -taso option with some more hacking on bfd/elf.c
 
1743
       else
 
1744
         FOPTIONS += -fpe3
 
1745
       endif
 
1746
         LINK.f = fort $(LDFLAGS)  
 
1747
# this creates a static executable
 
1748
#  LINK.f = fort $(LDFLAGS)   -Wl,-Bstatic
 
1749
#         CORE_LIBS += -llapack $(BLASOPT) -lblas
 
1750
     endif
 
1751
 
 
1752
    ifeq ($(_CPU),ia64)
 
1753
# Itanium  
 
1754
# g77 not working 
 
1755
# i4 not working 
 
1756
#
 
1757
       
 
1758
      FC=ifort
 
1759
      CC=gcc
 
1760
      DEFINES   +=   -DLINUXIA64 
 
1761
      COPTIMIZE = -O1
 
1762
      ifdef USE_SHARED
 
1763
        FOPTIONS+= -fPIC
 
1764
      endif
 
1765
 
 
1766
      ifeq ($(FC),ifort)
 
1767
       _IFCV9= $(shell ifort -v  2>&1|egrep "Version "|head -n 1|awk '/9./ {print "Y"}; /10./ {print "Y"; exit}')
 
1768
       _IFCV81= $(shell ifort -v  2>&1|egrep "Version "|head -n 1|awk ' /8\.1/  {print "Y";exit}; /9./ {print "Y"; exit}; /10./ {print "Y"; exit}')
 
1769
       _IFCV8= $(shell ifort -v  2>&1|egrep "Version "|head -n 1|awk ' /8\./  {print "Y";exit}; /9./ {print "Y"; exit}; /10./ {print "Y"; exit}')
 
1770
       ifeq ($(_IFCV8),Y)
 
1771
         DEFINES+= -DIFCV8
 
1772
#         FOPTIONS += -quiet
 
1773
       endif    
 
1774
       ifeq ($(_IFCV81),Y)
 
1775
         DEFINES+= -DIFCV81
 
1776
       endif    
 
1777
        ITANIUMNO = $(shell   cat /proc/cpuinfo | egrep family | head -n 1  2>&1 | awk ' /Itanium 2/ { print "-tpp2"; exit };/Itanium/ { print "-tpp1"}')
 
1778
        FOPTIONS   += -auto -w -ftz $(ITANIUMNO)
 
1779
        ifdef  USE_GPROF
 
1780
          FOPTIONS += -qp
 
1781
        endif
 
1782
       ifeq ($(_IFCV8),Y)
 
1783
         FOPTIONS+= -check nobounds -align dcommons -fpe1
 
1784
         FOPTIONS+= -warn truncated_source
 
1785
       else
 
1786
         FOPTIONS+= -align
 
1787
       endif    
 
1788
        DEFINES  +=   -DIFCLINUX
 
1789
        FVECTORIZE =  -noalign -O3 -pad  -mP2OPT_hlo_level=2
 
1790
        FOPTIMIZE =  -O3 -pad -mP2OPT_hlo_level=2  #-mP2OPT_align_array_to_cache_line=TRUE 
 
1791
       ifeq ($(_IFCV81),Y)
 
1792
#         FOPTIMIZE+= -IPF_fp_relaxed # breaks nwdft/xc/xc_pw91lda
 
1793
       endif
 
1794
        ifeq ($(_IFCV8),Y)
 
1795
#         EXTRA_LIBS += -quiet
 
1796
         FDEBUG = -g -O2
 
1797
        else
 
1798
         EXTRA_LIBS += -Vaxlib 
 
1799
         FDEBUG = -g -O2
 
1800
        endif
 
1801
       ifeq ($(_IFCV9),Y)
 
1802
         FOPTIONS+=  -fltconsistency
 
1803
       endif    
 
1804
        ifdef  USE_GPROF
 
1805
          EXTRA_LIBS += -qp
 
1806
        endif
 
1807
        LDOPTIONS =   -Qoption,link,--relax # -Qoption,link,-Bstatic  
 
1808
        ifeq ($(BUILDING_PYTHON),python)
 
1809
          LDOPTIONS +=  -Qoption,link,--export-dynamic
 
1810
          EXTRA_LIBS += -lutil
 
1811
        endif
 
1812
        LDOPTIONS += $(FDEBUG)
 
1813
        LINK.f = ifort $(LDFLAGS)  
 
1814
      else
 
1815
  noefc:
 
1816
        @echo 
 
1817
        @echo Please do not set FC on linux/ia64
 
1818
        @echo the makefile will use the Intel compiler
 
1819
        @echo 
 
1820
        @exit 1
 
1821
      endif
 
1822
      ifdef USE_SHARED
 
1823
        COPTIONS += -fPIC
 
1824
      endif
 
1825
 
 
1826
#     CORE_LIBS +=  $(BLASOPT) -llapack -lblas
 
1827
endif # end of ia32 bit
 
1828
    ifeq ($(_CPU),x86_64)
 
1829
#
 
1830
      MAKEFLAGS = -j 2 --no-print-directory
 
1831
      COPTIMIZE = -O1
 
1832
ifeq ($(NWCHEM_TARGET),CATAMOUNT)
 
1833
      FC=pgf90
 
1834
      CC=gcc
 
1835
endif
 
1836
 
 
1837
      ifeq ($(_FC),ifort)
 
1838
     _GOTSSE3= $(shell cat /proc/cpuinfo | egrep sse3 | tail -n 1 | awk ' /sse3/  {print "Y"}')
 
1839
       _IFCE = $(shell ifort -V  2>&1 |head -1 |awk ' /64/ {print "Y";exit};')
 
1840
       _IFCV7= $(shell ifort -v  2>&1|egrep "Version "|head -n 1|awk ' /7./  {print "Y";exit}')
 
1841
       _IFCV10= $(shell ifort -v  2>&1|egrep "Version "|head -n 1|awk ' /10\.1/ {print "Y"; exit}')
 
1842
       _IFCV11= $(shell ifort -logo  2>&1|egrep "Version "|head -n 1|awk ' /n 1/ {print "Y"; exit}')
 
1843
# Intel EM64T is required
 
1844
      ifneq ($(_IFCE),Y)
 
1845
        defineFCE: 
 
1846
        @echo
 
1847
        @echo "   " ifort missing or not suitable x86_64 CPUs
 
1848
        @echo
 
1849
        @exit 1
 
1850
      endif
 
1851
       ifneq ($(_IFCV7),Y)
 
1852
# to get EM64T
 
1853
# Intel 8.1 is required
 
1854
       else
 
1855
           @echo ifort 8.1 is required for x86_64 CPUs
 
1856
           @exit 1
 
1857
       endif
 
1858
        ifdef USE_OPENMP
 
1859
           FOPTIONS += -openmp
 
1860
           DEFINES+= -DUSE_OPENMP
 
1861
        endif
 
1862
        FOPTIONS += -align -w -g -vec-report1
 
1863
        DEFINES+= -DIFCV8 -DIFCLINUX
 
1864
        ifeq ($(FC),ifc)
 
1865
          FOPTIONS += -quiet
 
1866
        endif
 
1867
        ifdef  USE_FPE
 
1868
          FOPTIONS += -fpe0 -traceback #-fp-model  precise
 
1869
        endif
 
1870
        FDEBUG= -O2 -g
 
1871
        FOPTIMIZE = -O3 -prefetch  -unroll 
 
1872
        FOPTIMIZE +=  -tpp7 -ip 
 
1873
         ifeq ($(_GOTSSE3),Y) 
 
1874
          FOPTIMIZE += -xP -no-prec-div
 
1875
         else
 
1876
          FOPTIMIZE += -xW
 
1877
         endif
 
1878
         ifeq ($(_IFCV11),Y) 
 
1879
         FOPTIMIZE += -xHost -no-prec-div
 
1880
        else
 
1881
        endif
 
1882
      endif     
 
1883
#      
 
1884
      ifeq ($(_FC),pgf90)
 
1885
        FOPTIONS   += -Mdalign -Mllalign -Kieee 
 
1886
#        FOPTIONS   += -tp k8-64  
 
1887
#        FOPTIONS   +=    -Ktrap=fp
 
1888
        FOPTIMIZE   = -O3 -fastsse -Mnounroll -Minfo=loop -Mipa=fast
 
1889
        FVECTORIZE   = -fast  -fastsse  -O3   -Mipa=fast
 
1890
        FDEBUG = -g -O2
 
1891
        DEFINES  += -DCHKUNDFLW -DPGLINUX
 
1892
       ifeq ($(FC),ftn)
 
1893
          LINK.f = ftn  $(LDFLAGS) $(FOPTIONS)
 
1894
       endif
 
1895
       ifeq ($(NWCHEM_TARGET),CATAMOUNT)
 
1896
          LINK.f = ftn  $(LDFLAGS) $(FOPTIONS)
 
1897
       endif
 
1898
      endif
 
1899
      ifeq ($(FC),pathf90)
 
1900
#pathscale 1.3 compiler
 
1901
# tested Sep 30 2004 on RH AW3
 
1902
        FOPTIONS   += -cpp -Wp,-P
 
1903
        FOPTIONS   += -fno-second-underscore -fixedform
 
1904
        FOPTIONS   += -align64
 
1905
#        FOPTIONS   += -LANG:heap_allocation_threshold=0
 
1906
        FOPTIMIZE   = -O3 -OPT:Ofast:IEEE_arith=1:IEEE_NaN_inf=ON:Olimit=12000:ro=1:fold_reassociate=ON#:div_split=OFF:fast_nint=OFF
 
1907
        FVECTORIZE  = -O3 -OPT:Ofast:ro=1 -fno-math-errno
 
1908
        DEFINES  += -DCHKUNDFLW -DPSCALE
 
1909
        FDEBUG = -g -O1
 
1910
        LDOPTIONS = -Wl,--warn-once   -Wl,--relax
 
1911
      endif
 
1912
      ifeq ($(_CC),pgcc)
 
1913
        COPTIONS   =   -O
 
1914
      endif
 
1915
      ifeq ($(_CC),icc)
 
1916
        COPTIONS   =   -ftz
 
1917
#old        COPTIMIZE =  -O3 -hlo   -mP2OPT_hlo_level=2  
 
1918
        COPTIMIZE =  -O2
 
1919
      endif
 
1920
      ifeq ($(CC),gcc)
 
1921
        COPTIONS   =   -O3 -funroll-loops -ffast-math
 
1922
      endif
 
1923
      ifdef USE_GCC34
 
1924
        COPTIONS  +=   -march=k8 -mtune=k8
 
1925
      endif
 
1926
#     CORE_LIBS +=  $(BLASOPT) -llapack -lblas
 
1927
     ifdef  USE_GPROF
 
1928
        ifeq ($(NWCHEM_TARGET),CATAMOUNT)
 
1929
          FOPTIONS   += -Mprof=func#,lines
 
1930
          LDOPTIONS   += -Mprof=func#,lines
 
1931
          COPTIONS   += -O2 -finstrument-functions
 
1932
        else
 
1933
          FOPTIONS += -pg
 
1934
          COPTIONS += -pg
 
1935
          LDOPTIONS += -pg
 
1936
          LDFLAGS += -pg
 
1937
        endif
 
1938
     endif
 
1939
 
 
1940
      ifeq ($(_FC),gfortran)
 
1941
     _GOT3DNOW= $(shell cat /proc/cpuinfo | egrep 3dnowext | tail -n 1 | awk ' /3dnowext/  {print "Y"}')
 
1942
#gcc version 4.1.0 20050525 (experimental)
 
1943
       ifdef  USE_GPROF
 
1944
          FOPTIONS += -pg
 
1945
          COPTIONS += -pg
 
1946
          LDOPTIONS += -pg
 
1947
          LDFLAGS += -pg
 
1948
        endif
 
1949
            LINK.f = $(FC)  $(LDFLAGS) 
 
1950
        FOPTIMIZE   = -O3 
 
1951
        FOPTIMIZE  += -mfpmath=sse -ffast-math
 
1952
        FOPTIMIZE  += -fprefetch-loop-arrays #-ftree-loop-linear
 
1953
        FDEBUG = -g -O 
 
1954
        ifdef USE_F2C
 
1955
#possible segv with use of zdotc (e.g. with GOTO BLAS)
 
1956
#http://gcc.gnu.org/bugzilla/show_bug.cgi?id=20178
 
1957
          FOPTIONS +=  -ff2c -fno-second-underscore
 
1958
        endif
 
1959
        DEFINES  += -DCHKUNDFLW -DGCC4
 
1960
        GNUMAJOR=$(shell $(FC) -dM -E - < /dev/null | egrep __VERS | cut -c22)
 
1961
        ifdef GNUMAJOR
 
1962
        GNUMINOR=$(shell $(FC) -dM -E - < /dev/null | egrep __VERS | cut -c24)
 
1963
        GNU_GE_4_6 = $(shell [ $(GNUMAJOR) -gt 4 -o \( $(GNUMAJOR) -eq 4 -a $(GNUMINOR) -ge 6 \) ] && echo true)
 
1964
        GNU_GE_4_8 = $(shell [ $(GNUMAJOR) -gt 4 -o \( $(GNUMAJOR) -eq 4 -a $(GNUMINOR) -ge 8 \) ] && echo true)
 
1965
        endif
 
1966
        ifeq ($(GNU_GE_4_6),true)
 
1967
          DEFINES  += -DGCC46
 
1968
        endif
 
1969
        ifeq ($(GNU_GE_4_8),true)
 
1970
          FDEBUG =-O2 -g -fno-aggressive-loop-optimizations
 
1971
          FOPTIMIZE +=-fno-aggressive-loop-optimizations
 
1972
          FOPTIONS += -Warray-bounds
 
1973
          else
 
1974
          FOPTIONS   += -Wextra -Wuninitialized #-Wunused
 
1975
        endif
 
1976
        ifeq ($(_GOT3DNOW),Y) 
 
1977
#we guess its an opteron
 
1978
          FOPTIMIZE += -march=opteron -mtune=opteron
 
1979
        else
 
1980
        ifeq ($(GNU_GE_4_6),true) 
 
1981
          FOPTIMIZE += -march=native -mtune=native
 
1982
        else
 
1983
#we guess its a nocona em64t
 
1984
          FOPTIMIZE += -march=nocona -mtune=nocona
 
1985
        endif
 
1986
        endif
 
1987
#        FVECTORIZE  += -ftree-vectorize -ftree-vectorizer-verbose=1
 
1988
      endif
 
1989
      ifeq ($(_FC),crayftn)
 
1990
        EXPLICITF = TRUE
 
1991
        CPP = /usr/bin/cpp  -P -C -traditional
 
1992
        FCONVERT = $(CPP) $(CPPFLAGS) $< > $*.f
 
1993
        FOPTIONS   +=  -Ktrap=fp 
 
1994
        FDEBUG   =    -g
 
1995
#       FOPTIMIZE = -O2 -O scalar3,thread0,vector1,ipa0
 
1996
        FOPTIMIZE = -O2 -O scalar3,thread0,vector2,ipa2 #-rdm
 
1997
      endif
 
1998
      ifeq ($(_FC),craycc)
 
1999
        COPTIONS   =   -O
 
2000
      endif
 
2001
endif
 
2002
 
 
2003
    ifeq ($(_CPU),ppc64)
 
2004
# Tested on Red Hat Enterprise Linux AS release 3 (Taroon Update 3)
 
2005
# Tested on SLES 9
 
2006
# Feb 5th 2005
 
2007
# xlf v9.1
 
2008
# xlc v7.0 
 
2009
# gcc-3.2.3-42 
 
2010
 
 
2011
#gfortran become default      FC=xlf
 
2012
         ifeq ($(FC),xlf)
 
2013
           _FC=xlf
 
2014
         endif
 
2015
      CC=gcc
 
2016
      ifeq ($(CC),xlc)
 
2017
        COPTIONS  +=  -q64 -qlanglvl=extended
 
2018
      else
 
2019
#this for gcc/cc
 
2020
        COPTIONS  +=  -m64  -O
 
2021
      endif
 
2022
      ifeq ($(_FC),xlf)
 
2023
#RSQRT=y breaks intchk QA
 
2024
        FOPTIONS  =  -q64 -qextname -qfixed #-qnosave  #-qalign=4k
 
2025
        FOPTIONS +=  -NQ40000 -NT80000 -qmaxmem=8192 -qxlf77=leadzero
 
2026
        ifdef  USE_GPROF
 
2027
          FOPTIONS += -pg
 
2028
          LDOPTIONS += -pg
 
2029
        endif
 
2030
        FOPTIMIZE= -O3 -qstrict -qarch=auto -qtune=auto -qcache=auto -qfloat=fltint 
 
2031
        FDEBUG= -O2 -g
 
2032
        EXPLICITF = TRUE
 
2033
        FCONVERT = $(CPP) $(CPPFLAGS) $< > $*.f
 
2034
        DEFINES  +=   -DXLFLINUX -DCHKUNDFLW
 
2035
        CPP=/usr/bin/cpp  -P -C -traditional
 
2036
        ifdef USE_I4FLAGS
 
2037
          FOPTIONS += -qintsize=4
 
2038
        else
 
2039
          FOPTIONS += -qintsize=8
 
2040
        endif
 
2041
      endif
 
2042
#     CORE_LIBS +=  $(BLASOPT) -llapack -lblas
 
2043
#     EXTRA_LIBS +=  -dynamic-linker /lib64/ld64.so.1 -melf64ppc -lxlf90_r -lxlopt -lxlomp_ser -lxl -lxlfmath -ldl -lm -lc -lgcc -lm
 
2044
    endif
 
2045
 
 
2046
     ifeq ($(BUILDING_PYTHON),python)
 
2047
#   EXTRA_LIBS += -ltk -ltcl -L/usr/X11R6/lib -lX11 -ldl
 
2048
     EXTRA_LIBS +=    -lnwcutil  -lpthread -lutil -ldl
 
2049
  LDOPTIONS = -Wl,--export-dynamic 
 
2050
     endif
 
2051
ifeq ($(NWCHEM_TARGET),CATAMOUNT)
 
2052
        DEFINES  += -DCATAMOUNT
 
2053
endif
 
2054
 
 
2055
endif
 
2056
endif
 
2057
#endof of LINUX64
 
2058
 
 
2059
ifeq ($(TARGET),FUJITSU_VPP)
 
2060
#
 
2061
# FUJITSU VPP5000 32-bit
 
2062
#
 
2063
 
 
2064
         FC = frt
 
2065
      CPP = /lib/cpp -P -C
 
2066
     RANLIB = echo
 
2067
  MAKEFLAGS = 
 
2068
    INSTALL = @echo $@ is built
 
2069
                        
 
2070
    DEFINES = -DFUJITSU_VPP
 
2071
    USE_MPI = TRUE
 
2072
 
 
2073
 #search include files for tools directories that are not built
 
2074
   LIB_INCLUDES += -I$(NWCHEM_TOP)/src/tools/include \
 
2075
                   -I$(NWCHEM_TOP)/src/tools/ma \
 
2076
                   -I$(NWCHEM_TOP)/src/tools/tcgmsg-mpi \
 
2077
                   -I$(NWCHEM_TOP)/src/tools/global/src \
 
2078
                   -I$(NWCHEM_TOP)/src/tools/pario/eaf \
 
2079
                   -I$(NWCHEM_TOP)/src/tools/pario/elio \
 
2080
                   -I$(NWCHEM_TOP)/src/tools/pario/sf \
 
2081
                   -I$(NWCHEM_TOP)/src/tools/pario/dra
 
2082
 
 
2083
 #change DEFINES and LIB_DEFINES so that frt understands them and add them
 
2084
 #to FOPTIONS
 
2085
     comma:= ,
 
2086
     end:=
 
2087
     space:= $(end) $(end)
 
2088
   FDEFINES_1:= $(DEFINES) $(LIB_DEFINES)
 
2089
   FDEFINES:= -Wp,$(subst $(space),$(comma),$(strip $(FDEFINES_1)))
 
2090
    FOPTIONS = -w -Sw -KA32 $(FDEFINES)
 
2091
    COPTIONS = -KA32
 
2092
     FDEBUG = -Ob -g
 
2093
  FOPTIMIZE = -Kfast
 
2094
  COPTIMIZE = -K4
 
2095
 
 
2096
# removed global, ma, tcgmsg-mpi, as they are part of the native GA
 
2097
 NW_CORE_SUBDIRS = include basis geom inp input  \
 
2098
       pstat rtdb task symmetry util peigs $(CORE_SUBDIRS_EXTRA)
 
2099
 
 
2100
ifdef OLD_GA
 
2101
        CORE_LIBS = -lnwcutil \
 
2102
                    -L$(GA_LIBDIR) -lglobal -lpario -lma -lpeigs \
 
2103
                    -ltcgmsg-mpi -L/usr/lang/mpi2/lib32 -lmpi -lmp
 
2104
else
 
2105
        CORE_LIBS = -lnwcutil \
 
2106
                    -L$(GA_LIBDIR) -lga -lpeigs \
 
2107
                    -L/usr/lang/mpi2/lib32 -lmpi -lmp
 
2108
endif
 
2109
       EXTRA_LIBS = -llapackvp -lblasvp -lsocket -Wl,-J,-P,-t,-dy
 
2110
#end of FUJITSU_VPP 
 
2111
endif
 
2112
 
 
2113
ifeq ($(TARGET),FUJITSU_VPP64)
 
2114
#
 
2115
# FUJITSU VX/VPP 64-bit
 
2116
#
 
2117
 
 
2118
         FC = frt
 
2119
      CPP = /lib/cpp -P -C
 
2120
     RANLIB = echo
 
2121
  MAKEFLAGS = 
 
2122
    INSTALL = @echo $@ is built
 
2123
                        
 
2124
    DEFINES = -DFUJITSU_VPP -DEXT_INT
 
2125
    USE_MPI = TRUE
 
2126
     CORE_SUBDIRS_EXTRA = blas lapack
 
2127
 
 
2128
 #search include files for tools directories that are not built
 
2129
   LIB_INCLUDES += -I$(NWCHEM_TOP)/src/tools/include \
 
2130
                   -I$(NWCHEM_TOP)/src/tools/ma \
 
2131
                   -I$(NWCHEM_TOP)/src/tools/tcgmsg-mpi \
 
2132
                   -I$(NWCHEM_TOP)/src/tools/global/src \
 
2133
                   -I$(NWCHEM_TOP)/src/tools/pario/eaf \
 
2134
                   -I$(NWCHEM_TOP)/src/tools/pario/elio \
 
2135
                   -I$(NWCHEM_TOP)/src/tools/pario/sf \
 
2136
                   -I$(NWCHEM_TOP)/src/tools/pario/dra
 
2137
 
 
2138
 #change DEFINES and LIB_DEFINES so that frt understands them and add them
 
2139
 #to FOPTIONS
 
2140
     comma:= ,
 
2141
     end:=
 
2142
     space:= $(end) $(end)
 
2143
   FDEFINES_1:= $(DEFINES) $(LIB_DEFINES)
 
2144
   FDEFINES:= -Wp,$(subst $(space),$(comma),$(strip $(FDEFINES_1)))
 
2145
    FOPTIONS = -w -Sw -KA64 -CcdII8 -CcdLL8 $(FDEFINES)
 
2146
    COPTIONS = -KA64
 
2147
     FDEBUG = -Ob -g
 
2148
  FOPTIMIZE = -Kfast
 
2149
  COPTIMIZE = -K4
 
2150
 
 
2151
# removed global, ma, tcgmsg-mpi, as they are part of the native GA
 
2152
 NW_CORE_SUBDIRS = include basis geom inp input  \
 
2153
       pstat rtdb task symmetry util peigs $(CORE_SUBDIRS_EXTRA)
 
2154
 
 
2155
ifdef OLD_GA
 
2156
        CORE_LIBS = -lnwcutil \
 
2157
                    -L$(GA_LIBDIR) -lglobal -lpeigs -lpario -lma \
 
2158
                    -ltcgmsg-mpi -L/usr/lang/mpi2/lib64 -lmpi -lmp
 
2159
else
 
2160
        CORE_LIBS = -lnwcutil \
 
2161
                    -L$(GA_LIBDIR) -lga -lpeigs \
 
2162
                    -L/usr/lang/mpi2/lib64 -lmpi -lmp
 
2163
endif
 
2164
       EXTRA_LIBS = -llapack -lblas -lsocket -Wl,-J,-P,-t,-dy
 
2165
#end of FUJITSU_VPP64
 
2166
endif
 
2167
 
 
2168
ifeq ($(TARGET),cray-sv2)
 
2169
#
 
2170
# Cray sv2 aka x1
 
2171
#
 
2172
 
 
2173
         FC = ftn
 
2174
     RANLIB = echo
 
2175
  MAKEFLAGS = 
 
2176
    INSTALL = @echo $@ is built
 
2177
    DEFINES =  -DEXT_INT  -DUSE_POSIXF  -DUSE_FFIO
 
2178
    USE_FFIO = y
 
2179
     CORE_SUBDIRS_EXTRA = blas lapack
 
2180
 
 
2181
   FOPTIONS =  -F -s integer64
 
2182
   ifdef USE_SSP
 
2183
      FOPTIONS += -O ssp
 
2184
      COPTIONS += -h ssp
 
2185
   endif
 
2186
   FOPTIMIZE = -O scalar3,aggress,unroll2,vector2
 
2187
      FDEBUG = -O scalar1,vector1
 
2188
   COPTIMIZE = -O -h inline2  -h aggress
 
2189
 
 
2190
 
 
2191
       EXTRA_LIBS = -lsci64 -llapack  -lblas  # need make dbl_to_sngl for this
 
2192
#       EXTRA_LIBS =  -llapack  -lblas 
 
2193
 
 
2194
#      EXPLICITF     = TRUE
 
2195
      FCONVERT      = $(CPP) $(CPPFLAGS)  $< | sed '/^\#/D'  > $*.f
 
2196
#end of sv2
 
2197
endif
 
2198
 
 
2199
ifeq ($(TARGET),$(findstring $(TARGET),BGL BGP BGQ))
 
2200
#
 
2201
   CORE_SUBDIRS_EXTRA = lapack blas
 
2202
   ARFLAGS = urs
 
2203
   INSTALL = @echo $@ is built
 
2204
   EXPLICITF = TRUE
 
2205
   CPP=/usr/bin/cpp  -P -C -traditional
 
2206
   FCONVERT = $(CPP) $(CPPFLAGS) $< > $*.f
 
2207
   LDOPTIONS =  -Wl,--relax
 
2208
 
 
2209
   DEFINES   = -DLINUX
 
2210
   FDEBUG    = -g
 
2211
   COPTIMIZE = -g
 
2212
   FOPTIMIZE = -g
 
2213
   FOPTIONS  = -g
 
2214
    DEFINES += -DCHKUNDFLW
 
2215
 
 
2216
#for BGL
 
2217
   ifeq ($(TARGET),BGL)
 
2218
    DEFINES   += -DBGML -DBGL
 
2219
    FC         = blrts_xlf
 
2220
    CC         = $(BGCOMPILERS)/powerpc-bgl-blrts-gnu-gcc
 
2221
    AR         = $(BGCOMPILERS)/powerpc-bgl-blrts-gnu-ar
 
2222
    AS         = $(BGCOMPILERS)/powerpc-bgl-blrts-gnu-as
 
2223
    RANLIB     = $(BGCOMPILERS)/powerpc-bgl-blrts-gnu-ranlib
 
2224
    DEFINES   += -DXLFLINUX -DBGL
 
2225
    FOPTIMIZE += -qarch=440 -qtune=440 -qfloat=rsqrt:fltint
 
2226
    FOPTIONS   = -qEXTNAME -qxlf77=leadzero -NQ40000 -NT80000 -NS2048 -qmaxmem=8192
 
2227
   endif
 
2228
 
 
2229
#for BGP
 
2230
   ifeq ($(TARGET),BGP)
 
2231
    DEFINES += -DDCMF -DBGP
 
2232
    FC     = mpixlf77_r
 
2233
    CC     = mpicc
 
2234
    AR     = powerpc-bgp-linux-ar
 
2235
    AS     = powerpc-bgp-linux-as
 
2236
    RANLIB = powerpc-bgp-linux-ranlib
 
2237
    DEFINES += -DXLFLINUX
 
2238
    FOPTIONS = -qEXTNAME -qxlf77=leadzero -NQ40000 -NT80000 -NS2048 -qmaxmem=8192
 
2239
    FOPTIONS += -O3 -qstrict -qthreaded -qnosave -qalign=4k
 
2240
    FOPTIMIZE += -O3 -qarch=450d -qtune=450 -qcache=auto -qunroll=auto -qfloat=rsqrt:fltint
 
2241
    XLF11 = $(shell bgxlf -qversion  2>&1|grep Version|head -1| awk ' / 11./ {print "Y"}')
 
2242
   endif
 
2243
 
 
2244
#for BGQ
 
2245
   ifeq ($(TARGET),BGQ)
 
2246
    DEFINES += -DPAMI -DBGQ 
 
2247
    DEFINES += -DEAFHACK -DNOFSCHECK
 
2248
    AR       = powerpc64-bgq-linux-ar
 
2249
    AS       = powerpc64-bgq-linux-as
 
2250
    RANLIB   = powerpc64-bgq-linux-ranlib
 
2251
 
 
2252
    #FC = mpif77
 
2253
    #CC = mpicc
 
2254
    ifeq ($(FC),mpif77)
 
2255
        DEFINES   += -DGFORTRAN -DGCC4
 
2256
 
 
2257
        FOPTIONS  += -g -funderscoring
 
2258
        FOPTIMIZE += -O3 -ffast-math -Wuninitialized 
 
2259
        FOPTIMIZE += -O0 -g
 
2260
 
 
2261
        # EXT_INT means 64-bit integers are used
 
2262
        DEFINES   += -DEXT_INT 
 
2263
ifndef USE_I4FLAGS
 
2264
        FOPTIONS  += -fdefault-integer-8
 
2265
endif
 
2266
 
 
2267
        # linking ESSL is painful with gfortran
 
2268
        CORE_LIBS +=  -llapack  -lblas 
 
2269
    endif
 
2270
 
 
2271
    FC = mpixlf77_r
 
2272
    CC = mpixlc_r
 
2273
    ifeq ($(FC),mpixlf77_r)
 
2274
        DEFINES   += -DXLFLINUX
 
2275
        XLF11      = $(shell bgxlf -qversion  2>&1|grep Version|head -1| awk ' / 11./ {print "Y"}')
 
2276
        XLF14      = $(shell bgxlf -qversion  2>&1|grep Version|head -1| awk ' / 14./ {print "Y"}')
 
2277
 
 
2278
        # EXT_INT means 64-bit integers are used
 
2279
        DEFINES   += -DEXT_INT 
 
2280
ifdef USE_I4FLAGS
 
2281
        FOPTIONS  = -qintsize=4
 
2282
else
 
2283
        FOPTIONS  = -qintsize=8 
 
2284
endif
 
2285
 
 
2286
        FOPTIONS  += -qEXTNAME -qxlf77=leadzero
 
2287
        FOPTIONS  +=    -qstrict -qthreaded -qnosave -g
 
2288
        FOPTIMIZE += -O2 -qarch=qp -qtune=qp -qcache=auto -qunroll=auto -qfloat=rsqrt
 
2289
#        FOPTIMIZE += -qhot=level=0 
 
2290
        FDEBUG    = -O0 
 
2291
 
 
2292
        # ESSL dependencies should be provided by XLF linker
 
2293
        CORE_LIBS +=  -llapack $(BLASOPT) -lblas
 
2294
    endif
 
2295
 
 
2296
   endif # end BGQ
 
2297
 
 
2298
 
 
2299
endif
 
2300
 
 
2301
 
 
2302
###################################################################
 
2303
#  All machine dependent sections should be above here, otherwise #
 
2304
#  some of the definitions below will be 'lost'                   #
 
2305
###################################################################
 
2306
ifeq ($(BUILDING_PYTHON),python)
 
2307
ifndef PYTHONHOME
 
2308
errorpython1:
 
2309
        @echo "For python you must define both PYTHONHOME and PYTHONVERSION"
 
2310
        @echo "E.g., setenv PYTHONHOME /msrc/home/d3g681/Python-1.5.1"
 
2311
        @echo "      setenv PYTHONVERSION 1.5"
 
2312
        @echo " building_python <$(BUILDING_PYTHON)>"
 
2313
        @echo " subdirs <$(NWSUBDIRS)>"
 
2314
        @exit 1
 
2315
endif
 
2316
ifndef PYTHONVERSION
 
2317
errorpython2:
 
2318
        @echo "For python you must define both PYTHONHOME and PYTHONVERSION"
 
2319
        @echo "E.g., setenv PYTHONHOME /msrc/home/d3g681/Python-1.5.1"
 
2320
        @echo "      setenv PYTHONVERSION 1.5"
 
2321
        @echo " building_python <$(BUILDING_PYTHON)>"
 
2322
        @echo " subdirs <$(NWSUBDIRS)>"
 
2323
        @exit 1
 
2324
endif
 
2325
#
 
2326
ifndef PYTHONLIBTYPE
 
2327
        PYTHONLIBTYPE=a
 
2328
endif
 
2329
ifdef USE_PYTHON64
 
2330
  CORE_LIBS += $(PYTHONHOME)/lib64/python$(PYTHONVERSION)/config/libpython$(PYTHONVERSION).$(PYTHONLIBTYPE)
 
2331
else
 
2332
  CORE_LIBS += $(PYTHONHOME)/lib/python$(PYTHONVERSION)/config/libpython$(PYTHONVERSION).$(PYTHONLIBTYPE)
 
2333
endif
 
2334
endif
 
2335
#
 
2336
######
 
2337
#PAPI#
 
2338
######
 
2339
   
 
2340
ifdef USE_PAPI 
 
2341
  DEFINES += -DUSE_PAPI
 
2342
  ifndef PAPI_LIB
 
2343
    papierror1:
 
2344
        echo You must define PAPI_LIB in your environment to be the path
 
2345
        @echo of your PAPI library installation ... something like
 
2346
        @echo     setenv PAPI_LIB ~/papi/lib
 
2347
        @exit 1
 
2348
  endif
 
2349
ifndef PAPI_INCLUDE
 
2350
papierror2:
 
2351
        @echo You must define PAPI_INCLUDE in your environment to be the path
 
2352
        @echo of your PAPI headers installation ... something like
 
2353
        @echo     setenv PAPI_INCLUDE ~/papi/include
 
2354
        @exit 1
 
2355
endif
 
2356
ifndef LIBPAPI 
 
2357
  LIBPAPI = -lpapi 
 
2358
endif 
 
2359
  CORE_LIBS += -L$(PAPI_LIB) $(LIBPAPI) 
 
2360
  INCPATH += -I$(PAPI_INCLUDE)
 
2361
endif
 
2362
 
 
2363
#
 
2364
ifdef USE_FDIST
 
2365
  DEFINES += -DFDIST
 
2366
endif
 
2367
 
 
2368
# either define USE_SCALAPACK (for i4) or USE_SCALAPACK_I8
 
2369
ifdef USE_SCALAPACK
 
2370
  _USE_SCALAPACK = y
 
2371
else
 
2372
 ifdef USE_SCALAPACK_I8
 
2373
 _USE_SCALAPACK = y
 
2374
 endif
 
2375
endif
 
2376
 
 
2377
ifeq ($(_USE_SCALAPACK),y)
 
2378
  DEFINES += -DSCALAPACK
 
2379
ifeq ($(XLFBREN),y) 
 
2380
  CORE_LIBS +=  -brename:.iceil_,.iceil \
 
2381
              -brename:.blacs_pinfo_,.blacs_pinfo \
 
2382
              -brename:.blacs_get_,.blacs_get \
 
2383
              -brename:.blacs_gridinit_,.blacs_gridinit \
 
2384
              -brename:.blacs_gridinfo_,.blacs_gridinfo \
 
2385
              -brename:.blacs_gridexit_,.blacs_gridexit \
 
2386
              -brename:.indxg2p_,.indxg2p \
 
2387
              -brename:.descinit_,.descinit \
 
2388
              -brename:.numroc_,.numroc \
 
2389
              -brename:.pdlamch_,.pdlamch \
 
2390
              -brename:.pdsyev_,.pdsyev \
 
2391
              -brename:.pdsyevd_,.pdsyevd \
 
2392
              -brename:.pdsyevx_,.pdsyevx \
 
2393
              -brename:.pdsygvx_,.pdsygvx \
 
2394
              -brename:.pdpotri_,.pdpotri \
 
2395
              -brename:.pdpotrf_,.pdpotrf \
 
2396
              -brename:.pdpotrs_,.pdpotrs \
 
2397
              -brename:.pdgetrf_,.pdgetrf \
 
2398
              -brename:.pdgetrs_,.pdgetrs 
 
2399
endif
 
2400
  CORE_LIBS += $(SCALAPACK) $(PBLAS) $(BLACS)
 
2401
endif
 
2402
 
 
2403
ifdef USE_64TO32
 
2404
      CORE_LIBS +=  -l64to32
 
2405
NWSUBDIRS += 64to32blas
 
2406
endif
 
2407
ifdef BLASOPT
 
2408
       CORE_LIBS +=  $(BLASOPT) 
 
2409
endif
 
2410
ifeq ($(LAPACK_LIB),)
 
2411
      CORE_LIBS +=  -llapack 
 
2412
endif
 
2413
ifeq ($(BLAS_LIB),)
 
2414
      CORE_LIBS +=  -lblas 
 
2415
endif
 
2416
 
 
2417
 
 
2418
ifdef USE_SUBGROUPS
 
2419
  DEFINES += -DGANXTVAL -DUSE_SUBGROUPS
 
2420
#turn off peigs for now
 
2421
else
 
2422
  DEFINES += -DPARALLEL_DIAG
 
2423
endif
 
2424
###################################################################
 
2425
#  All machine dependent sections should be above here, otherwise #
 
2426
#  some of the definitions below will be 'lost'                   #
 
2427
###################################################################
 
2428
#the new GA uses ARMCI library
 
2429
ifdef OLD_GA
 
2430
      CORE_LIBS += -larmci
 
2431
else
 
2432
      CORE_LIBS +=
 
2433
endif
 
2434
 
 
2435
# MPI version requires tcgmsg-mpi library
 
2436
 
 
2437
ifdef USE_MPI 
 
2438
ifndef LIBMPI 
 
2439
  LIBMPI = -lmpi 
 
2440
endif 
 
2441
SKIP_LIBMPI = mpifrt mpfort mpif77 mpxlf mpif90 ftn
 
2442
ifneq (,$(findstring $(notdir $(FC)), $(SKIP_LIBMPI)))
 
2443
  LIBMPI =
 
2444
endif
 
2445
ifdef MPI_LIB 
 
2446
      CORE_LIBS += $(patsubst -L-L%,-L%,-L$(MPI_LIB))
 
2447
endif 
 
2448
ifdef OLD_GA
 
2449
  CORE_LIBS += -ltcgmsg-mpi $(LIBMPI) 
 
2450
else
 
2451
  CORE_LIBS += $(LIBMPI) 
 
2452
endif
 
2453
else 
 
2454
ifdef OLD_GA
 
2455
  CORE_LIBS += -ltcgmsg 
 
2456
else
 
2457
  CORE_LIBS += 
 
2458
endif
 
2459
endif 
 
2460
 
 
2461
 
 
2462
# FFTW3 library inclusion
 
2463
ifdef USE_FFTW3
 
2464
ifndef LIBFFTW3
 
2465
  LIBFFTW3 = -lfftw3
 
2466
endif
 
2467
ifdef FFTW3_LIB
 
2468
      CORE_LIBS += -L$(FFTW3_LIB)
 
2469
endif
 
2470
CORE_LIBS += $(LIBFFTW3) 
 
2471
endif
 
2472
 
 
2473
 
 
2474
 
 
2475
# slurm libraries for remaining wall time under slurm resource manager
 
2476
 
 
2477
ifdef SLURM
 
2478
  EXTRA_LIBS += $(SLURMOPT)
 
2479
endif
 
2480
 
 
2481
# CUDA
 
2482
#ckbn gpu
 
2483
ifdef TCE_CUDA
 
2484
 CORE_LIBS += $(CUDA_LIBS)
 
2485
endif
 
2486
 
 
2487
# lower level libs used by communication libraries 
 
2488
 
 
2489
COMM_LIBS=  $(shell grep ARMCI_NETWORK_LIBS\ = ${NWCHEM_TOP}/src/tools/build/Makefile | cut -b 22-)
 
2490
ifdef COMM_LIBS 
 
2491
 CORE_LIBS += $(COMM_LIBS) 
 
2492
endif 
 
2493
 
 
2494
ifdef USE_LINUXAIO
 
2495
 CORE_LIBS += -lrt
 
2496
endif
 
2497
 
 
2498
EXTRA_LIBS += $(CONFIG_LIBS)
 
2499
CORE_LIBS += $(EXTRA_LIBS)
 
2500
 
 
2501
 
 
2502
ifdef OPTIMIZE
 
2503
    FFLAGS = $(FOPTIONS) $(FOPTIMIZE)
 
2504
    CFLAGS =  $(COPTIONS) $(COPTIMIZE)
 
2505
else
 
2506
# Need FDEBUG after FOPTIONS on SOLARIS to correctly override optimization
 
2507
    FFLAGS = $(FOPTIONS) $(FDEBUG) 
 
2508
    CFLAGS = $(COPTIONS) $(CDEBUG) 
 
2509
endif
 
2510
  INCLUDES = -I. $(LIB_INCLUDES) -I$(INCDIR) $(INCPATH)
 
2511
  CPPFLAGS = $(INCLUDES) $(DEFINES) $(LIB_DEFINES)
 
2512
   LDFLAGS = $(LDOPTIONS) -L$(LIBDIR) $(LIBPATH)
 
2513
      LIBS = $(NW_MODULE_LIBS) $(CORE_LIBS) 
 
2514
 
 
2515
# I think this will work everywhere, but it might have to become
 
2516
# machine-dependent 
 
2517
 
 
2518
MKDIR = mkdir
 
2519
 
 
2520
#
 
2521
# Define known suffixes mostly so that .p files don't cause pc to be invoked
 
2522
#
 
2523
 
 
2524
.SUFFIXES:      
 
2525
.SUFFIXES:      .o .s .F .f .c
 
2526
 
 
2527
ifndef FLINT
 
2528
 
 
2529
ifdef EXPLICITF
 
2530
#
 
2531
# Needed on machines where FC does not preprocess .F files
 
2532
# with CPP to get .f files
 
2533
#
 
2534
# These rules apply to make-ing of files in specfic directories
 
2535
.SUFFIXES:      
 
2536
.SUFFIXES:      .o .s .F .f .c
 
2537
 
 
2538
.F.o:   
 
2539
        @echo Converting $*.F '->' $*.f
 
2540
        @$(FCONVERT)
 
2541
        $(FC) -c $(FFLAGS) $*.f
 
2542
        @$(RM) $*.f
 
2543
 
 
2544
.F.f:
 
2545
        @echo Converting $*.F '->' $*.f
 
2546
        @$(FCONVERT)
 
2547
.f.o:
 
2548
        $(FC) -c $(FFLAGS) $<
 
2549
endif
 
2550
 
2551
# More explicit rules to avoid infinite recursion, to get dependencies, and
 
2552
# for efficiency.  CRAY does not like -o with -c.
 
2553
#
 
2554
# These rules apply to make-ing of files in with respect to library files
 
2555
# both these rules and the rules above are needed.
 
2556
(%.o):  %.F
 
2557
ifdef EXPLICITF
 
2558
        @echo Converting $< '->' $*.f
 
2559
        @$(FCONVERT)
 
2560
        $(FC) -c $(FFLAGS) $*.f
 
2561
ifndef NWCHEM_KEEPF
 
2562
        @/bin/rm -f $*.f
 
2563
endif
 
2564
else
 
2565
ifeq ($(XLFMAC),y)
 
2566
        $(FC) -c $(FFLAGS)     $<
 
2567
else
 
2568
        $(FC) -c $(FFLAGS) $(CPPFLAGS)  $<
 
2569
endif
 
2570
endif
 
2571
 
 
2572
(%.o):  %.f
 
2573
        $(FC) -c $(FFLAGS) $<
 
2574
 
 
2575
(%.o):  %.c
 
2576
        $(CC) -c $(CPPFLAGS) $(CFLAGS) -o $% $<
 
2577
 
 
2578
(%.o):  %.cu
 
2579
        $(CUDA) -c $(CUDA_FLAGS) -c $(CUDA_INCLUDE) $(CUDA_LIBS) -o $% $<
 
2580
 
 
2581
(%.o):  %.o
 
2582
 
 
2583
# Preceding line has a tab to make an empty rule
 
2584
 
 
2585
# a .F.f rule is needed for any system target where the default .F.f rule does not work
 
2586
# AND the EXPLICITF is not already true.  Right now this is only LINUX with g77
 
2587
      ifneq ($(_FC),xlf)
 
2588
ifeq ($(TARGET),LINUX)
 
2589
.F.f:
 
2590
        $(FC) -c $(FFLAGS) -E $(CPPFLAGS) $< -o $*.f
 
2591
endif
 
2592
      endif
 
2593
 
 
2594
# else for ifndef Flint
 
2595
else
 
2596
#        -------------
 
2597
 
 
2598
# First time thru you need the -L... option. Next time remove it
 
2599
# and move the library file name to the last but one argument and add -g
 
2600
ifeq ($(FLINT),1)
 
2601
.F.o:; flint $(CPPFLAGS) -L $(SRCDIR)/nwchem.lbt $<
 
2602
 
 
2603
.f.o:; flint $(CPPFLAGS) -L $(SRCDIR)/nwchem.lbt $<
 
2604
else
 
2605
.F.o:; flint $(CPPFLAGS) -g -f -u $(SRCDIR)/nwchem.lbt $<
 
2606
 
 
2607
.f.o:; flint $(CPPFLAGS) -g -f -u $(SRCDIR)/nwchem.lbt $<
 
2608
endif
 
2609
 
 
2610
endif
 
2611
 
 
2612