# Make for Linux

ifeq ($(COMP),KCC)
  CXX      = KCC
  CXXOPTF += -O1 +K1
  CXXDEBF += +K0
  FULLWARN := --strict_warnings
else
ifeq ($(COMP),PGI)
  CXX = pgCC
  CXXOPTF +=
  CXXDEBF += -g
else
endif
endif

FORT_CPP := gcc -E -traditional

ifeq ($(FCOMP),Lahey)
  FC    := lf95 --ml cdecl
  fC    := $(FC)
  # FDEBF += -H aesu
  # FOPTF += -K fast
  # fDEBF += -H aesu
  # fOPTF += -K fast
  LIBRARY_LOCATIONS += /usr/local/lf9561/lib
  override XTRALIBS += -lfj9f6 -lfj9i6 -lfj9e6
else
ifeq ($(FCOMP),Absoft)
  FC  := f90 -B108 -YEXT_NAMES=LCS
  fC  := $(FC)
  LIBRARY_LOCATIONS += /usr/absoft/lib
  override XTRALIBS += -lfio -lf77math
  #override FORTLINK := LOWERCASE
else
ifeq ($(FCOMP),PGI)
  FC := pgf90
  fC := $(FC)
  FOPTF += -fast
  fOPTF += -fast
  FDEBF += -g
  fDEBF += -g
  LIBRARY_LOCATIONS += /usr/pgi/linux86/lib
  override XTRALIBS += -lpgf90 -lpgf90_rpm1 -lpgf902 -lpgf90rtl -lpgftnrtl -lpgc
else
ifeq ($(FCOMP),Intel)
  # mostly in Make.defs
  FDEBF += $(INTEL_EXTRA_DEBUG_FLAGS)
  FOPTF += $(INTEL_EXTRA_OPT_FLAGS)
  fDEBF += $(INTEL_EXTRA_DEBUG_FLAGS)
  fOPTF += $(INTEL_EXTRA_OPT_FLAGS)
else
ifeq ($(FCOMP),f77)
  FC       := g77 -fno-second-underscore
  fC       := $(FC)
  # default g77/f77 version
  FOPTF += -O
  fOPTF += -O
  FDEBF += -g
  fDEBF += -g
  #DEFINES += -DBL_FORT_USE_UNDERSCORE
  #override XTRALIBS +=  -lf2c
# LIBRARY_LOCATIONS += /usr/lib/gcc-lib/i386-redhat-linux/2.96
  override XTRALIBS += -lg2c
  FDEBF +=   -ffortran-bounds-check 
  FDEBF += -Wimplicit
  fDEBF += -Wimplicit
  fDEBF +=   -ffortran-bounds-check
endif
endif
endif
endif
endif

CXXPRFF += -pg
FPRF    += -pg

override XTRALIBS +=   -lm

ifeq ($(WHICHLINUX), PCCLUSTER)
  LIBRARY_LOCATIONS += /usr/local/pkg/gcc/lib/gcc-lib/i686-pc-linux-gnu/2.95.1
             #  this should be made into a link to the current version  ^^^^^^
endif

ifeq ($(WHICHLINUX), ALPHACLUSTER)
  FC  := fort -assume nounderscore
#  FC  := fort
  fC  := $(FC)
  override FORTLINK := LOWERCASE
  #FOPTF += -O5 -fast -transform_loops -speculate all -automatic
  FOPTF = -O5 -fast
  FOPTF = -O2
  fOPTF = -O5 -fast
  fOPTF = -O2
  LIBRARY_LOCATIONS += /usr/local/pkg/gcc-2.95.1-generic/lib/gcc-lib/alpha-redhat-linux/2.95.1
             #  this should be made into a link to the current version  ^^^^^^
  LIBRARIES += -lfor
endif
