summaryrefslogtreecommitdiff
path: root/lib/make
diff options
context:
space:
mode:
Diffstat (limited to 'lib/make')
-rwxr-xr-xlib/make/configure149
-rw-r--r--lib/make/configure.in140
-rwxr-xr-xlib/make/extras/DEBUG/setup.sh37
-rw-r--r--lib/make/known-architectures/linux37
-rw-r--r--lib/make/make.config.defn.in35
5 files changed, 351 insertions, 47 deletions
diff --git a/lib/make/configure b/lib/make/configure
index 8635c0dd..64d10bc5 100755
--- a/lib/make/configure
+++ b/lib/make/configure
@@ -3030,20 +3030,150 @@ F_FILE_PROCESSOR='$(CCTK_HOME)/lib/sbin/f_file_processor.pl'
C_FILE_PROCESSOR='$(CCTK_HOME)/lib/sbin/c_file_processor.pl'
-
-
-
-
-
# Put the libraries from the known-architectures onto the LIB variable.
LIBS="$KNOWN_LIBS $LIBS"
LDFLAGS="$KNOWN_LDFLAGS $LDFLAGS"
#Set the compileonly flags if they've not been set by now
+
+
+
: ${CCOMPILEONLY="-c -o"}
: ${FCOMPILEONLY="-c -o"}
+# Set the debug flags if they've not been set by now
+
+
+
+if test -n "$DEBUG" ; then
+ DEBUG_MODE=$DEBUG
+else
+ DEBUG_MODE="no"
+fi
+
+
+
+
+if test -z "$C_DEBUG_FLAGS" ; then
+ case "$CC" in
+ gcc)
+ C_DEBUG_FLAGS="-g"
+ ;;
+ pgcc)
+ C_DEBUG_FLAGS="-g"
+ ;;
+ *)
+# This should be a reasonable default.
+ C_DEBUG_FLAGS="-g"
+ ;;
+ esac
+fi
+
+
+
+if test -z "CXX_DEBUG_FLAGS" ; then
+ case "$CXX" in
+ g++)
+ CXX_DEBUG_FLAGS="-g"
+ ;;
+ pgCC)
+ CXX_DEBUG_FLAGS="-g"
+ ;;
+ *)
+# This should be a reasonable default.
+ CXX_DEBUG_FLAGS="-g"
+ ;;
+ esac
+fi
+
+
+
+if test -z "F77_DEBUG_FLAGS" ; then
+ case "$F77" in
+ g77)
+ F77_DEBUG_FLAGS="-g"
+ ;;
+ pgf77)
+ F77_DEBUG_FLAGS="-g"
+ ;;
+ *)
+# This should be a reasonable default.
+ F77_DEBUG_FLAGS="-g"
+ ;;
+ esac
+fi
+
+
+
+if test -z "F90_DEBUG_FLAGS" ; then
+ case "$F90" in
+ pgf77)
+ F90_DEBUG_FLAGS="-g"
+ ;;
+ *)
+# This should be a reasonable default.
+ F90_DEBUG_FLAGS="-g"
+ ;;
+ esac
+fi
+
+# Set the warning flags if they've not been set by now
+
+
+
+if test -z "C_WARN_FLAGS" ; then
+ case "$CC" in
+ gcc)
+ C_WARN_FLAGS="-Wall"
+ ;;
+ *)
+# Not sure what should be a reasonable default.
+ C_WARN_FLAGS=""
+ ;;
+ esac
+fi
+
+
+
+if test -z "CXX_WARN_FLAGS" ; then
+ case "$CXX" in
+ g++)
+ CXX_WARN_FLAGS="-Wall"
+ ;;
+ *)
+# Not sure what should be a reasonable default.
+ CXX_WARN_FLAGS=""
+ ;;
+ esac
+fi
+
+
+
+if test -z "F77_WARN_FLAGS" ; then
+ case "$F77" in
+ g77)
+ F77_WARN_FLAGS="-Wall"
+ ;;
+ *)
+# Not sure what should be a reasonable default.
+ F77_WARN_FLAGS=""
+ ;;
+ esac
+fi
+
+
+
+if test -z "F90_WARN_FLAGS" ; then
+ case "$F90" in
+ *)
+# Not sure what should be a reasonable default.
+ F90_WARN_FLAGS=""
+ ;;
+ esac
+fi
+
+
#Set the createexe flag if it's not been set by now
@@ -3301,6 +3431,15 @@ s%@F_FILE_PROCESSOR@%$F_FILE_PROCESSOR%g
s%@C_FILE_PROCESSOR@%$C_FILE_PROCESSOR%g
s%@CCOMPILEONLY@%$CCOMPILEONLY%g
s%@FCOMPILEONLY@%$FCOMPILEONLY%g
+s%@DEBUG_MODE@%$DEBUG_MODE%g
+s%@C_DEBUG_FLAGS@%$C_DEBUG_FLAGS%g
+s%@CXX_DEBUG_FLAGS@%$CXX_DEBUG_FLAGS%g
+s%@F77_DEBUG_FLAGS@%$F77_DEBUG_FLAGS%g
+s%@F90_DEBUG_FLAGS@%$F90_DEBUG_FLAGS%g
+s%@C_WARN_FLAGS@%$C_WARN_FLAGS%g
+s%@CXX_WARN_FLAGS@%$CXX_WARN_FLAGS%g
+s%@F77_WARN_FLAGS@%$F77_WARN_FLAGS%g
+s%@F90_WARN_FLAGS@%$F90_WARN_FLAGS%g
s%@CREATEEXE@%$CREATEEXE%g
s%@DIRSEP@%$DIRSEP%g
s%@OPTIONSEP@%$OPTIONSEP%g
diff --git a/lib/make/configure.in b/lib/make/configure.in
index aa623283..87c0637b 100644
--- a/lib/make/configure.in
+++ b/lib/make/configure.in
@@ -394,20 +394,150 @@ F_FILE_PROCESSOR='$(CCTK_HOME)/lib/sbin/f_file_processor.pl'
AC_SUBST(C_FILE_PROCESSOR)
C_FILE_PROCESSOR='$(CCTK_HOME)/lib/sbin/c_file_processor.pl'
-
-
-AC_SUBST(CCOMPILEONLY)
-AC_SUBST(FCOMPILEONLY)
-
# Put the libraries from the known-architectures onto the LIB variable.
LIBS="$KNOWN_LIBS $LIBS"
LDFLAGS="$KNOWN_LDFLAGS $LDFLAGS"
#Set the compileonly flags if they've not been set by now
+AC_SUBST(CCOMPILEONLY)
+AC_SUBST(FCOMPILEONLY)
+
: ${CCOMPILEONLY="-c -o"}
: ${FCOMPILEONLY="-c -o"}
+# Set the debug flags if they've not been set by now
+
+AC_SUBST(DEBUG_MODE)
+
+if test -n "$DEBUG" ; then
+ DEBUG_MODE=$DEBUG
+else
+ DEBUG_MODE="no"
+fi
+
+
+AC_SUBST(C_DEBUG_FLAGS)
+
+if test -z "$C_DEBUG_FLAGS" ; then
+ case "$CC" in
+ gcc)
+ C_DEBUG_FLAGS="-g"
+ ;;
+ pgcc)
+ C_DEBUG_FLAGS="-g"
+ ;;
+ *)
+# This should be a reasonable default.
+ C_DEBUG_FLAGS="-g"
+ ;;
+ esac
+fi
+
+AC_SUBST(CXX_DEBUG_FLAGS)
+
+if test -z "CXX_DEBUG_FLAGS" ; then
+ case "$CXX" in
+ g++)
+ CXX_DEBUG_FLAGS="-g"
+ ;;
+ pgCC)
+ CXX_DEBUG_FLAGS="-g"
+ ;;
+ *)
+# This should be a reasonable default.
+ CXX_DEBUG_FLAGS="-g"
+ ;;
+ esac
+fi
+
+AC_SUBST(F77_DEBUG_FLAGS)
+
+if test -z "F77_DEBUG_FLAGS" ; then
+ case "$F77" in
+ g77)
+ F77_DEBUG_FLAGS="-g"
+ ;;
+ pgf77)
+ F77_DEBUG_FLAGS="-g"
+ ;;
+ *)
+# This should be a reasonable default.
+ F77_DEBUG_FLAGS="-g"
+ ;;
+ esac
+fi
+
+AC_SUBST(F90_DEBUG_FLAGS)
+
+if test -z "F90_DEBUG_FLAGS" ; then
+ case "$F90" in
+ pgf77)
+ F90_DEBUG_FLAGS="-g"
+ ;;
+ *)
+# This should be a reasonable default.
+ F90_DEBUG_FLAGS="-g"
+ ;;
+ esac
+fi
+
+# Set the warning flags if they've not been set by now
+
+AC_SUBST(C_WARN_FLAGS)
+
+if test -z "C_WARN_FLAGS" ; then
+ case "$CC" in
+ gcc)
+ C_WARN_FLAGS="-Wall"
+ ;;
+ *)
+# Not sure what should be a reasonable default.
+ C_WARN_FLAGS=""
+ ;;
+ esac
+fi
+
+AC_SUBST(CXX_WARN_FLAGS)
+
+if test -z "CXX_WARN_FLAGS" ; then
+ case "$CXX" in
+ g++)
+ CXX_WARN_FLAGS="-Wall"
+ ;;
+ *)
+# Not sure what should be a reasonable default.
+ CXX_WARN_FLAGS=""
+ ;;
+ esac
+fi
+
+AC_SUBST(F77_WARN_FLAGS)
+
+if test -z "F77_WARN_FLAGS" ; then
+ case "$F77" in
+ g77)
+ F77_WARN_FLAGS="-Wall"
+ ;;
+ *)
+# Not sure what should be a reasonable default.
+ F77_WARN_FLAGS=""
+ ;;
+ esac
+fi
+
+AC_SUBST(F90_WARN_FLAGS)
+
+if test -z "F90_WARN_FLAGS" ; then
+ case "$F90" in
+ *)
+# Not sure what should be a reasonable default.
+ F90_WARN_FLAGS=""
+ ;;
+ esac
+fi
+
+
#Set the createexe flag if it's not been set by now
AC_SUBST(CREATEEXE)
diff --git a/lib/make/extras/DEBUG/setup.sh b/lib/make/extras/DEBUG/setup.sh
deleted file mode 100755
index 4ed07c2c..00000000
--- a/lib/make/extras/DEBUG/setup.sh
+++ /dev/null
@@ -1,37 +0,0 @@
-#! /bin/sh
-# /*@@
-# @file setup.sh
-# @date Wed Jul 21 11:18:40 1999
-# @author Joan Masso
-# @desc
-# Setup MPI
-# @enddesc
-# @@*/
-
-if test -n "$DEBUG" ; then
-
-echo "Configuring with DEBUG. Blocks with #ifdef CCTK_DEBUG will be activated"
-
-CCTK_WriteLine cctk_Extradefs.h "#define CCTK_DEBUG"
-
-# Work out which variation of DEBUG
-
-if test -r $srcdir/extras/DEBUG/$DEBUG ; then
- . $srcdir/extras/DEBUG/$DEBUG
-else
- echo "DEBUG Selected. Assuming -g flag for all compilers"
- : ${DEBUG_C_FLAG="-g"}
- : ${DEBUG_CXX_FLAG="-g"}
- : ${DEBUG_F77_FLAG="-g"}
- : ${DEBUG_F90_FLAG="-g"}
- : ${DEBUG_LD_FLAG="-g"}
-fi
-
-CCTK_WriteLine make.extra.defn "DEBUG_C = $DEBUG_C_FLAG"
-CCTK_WriteLine make.extra.defn "DEBUG_CXX = $DEBUG_CXX_FLAG"
-CCTK_WriteLine make.extra.defn "DEBUG_F77 = $DEBUG_F77_FLAG"
-CCTK_WriteLine make.extra.defn "DEBUG_F90 = $DEBUG_F90_FLAG"
-CCTK_WriteLine make.extra.defn "DEBUG_LD = $DEBUG_LD_FLAG"
-
-fi
-
diff --git a/lib/make/known-architectures/linux b/lib/make/known-architectures/linux
index cd15cde5..b55944ee 100644
--- a/lib/make/known-architectures/linux
+++ b/lib/make/known-architectures/linux
@@ -62,6 +62,10 @@ else
if test "$LINUX_F77" = "noegcs" ; then
: ${LIBS="vast90 f2c m"}
fi
+ : ${F77_DEBUG_FLAGS="-g"}
+ : ${F90_DEBUG_FLAGS="-g"}
+ : ${F77_WARN_FLAGS="-Wall"}
+ : ${F90_WARN_FLAGS="-Wall"}
;;
absoft)
: ${LIBS="f90math fio f77math m"}
@@ -70,6 +74,10 @@ else
if test -n "$ABSOFT" ; then
: ${LIBDIRS='$(ABSOFT)/lib'}
fi
+ : ${F77_DEBUG_FLAGS="-g"}
+ : ${F90_DEBUG_FLAGS="-g"}
+ : ${F77_WARN_FLAGS="-m0"}
+ : ${F90_WARN_FLAGS="-m0"}
;;
absoft77)
: ${LIBS="fio f77math m"}
@@ -78,6 +86,10 @@ else
if test -n "$ABSOFT" ; then
: ${LIBDIRS='$(ABSOFT)/lib'}
fi
+ : ${F77_DEBUG_FLAGS="-g"}
+ : ${F90_DEBUG_FLAGS="-g"}
+ : ${F77_WARN_FLAGS="-m0"}
+ : ${F90_WARN_FLAGS="-m0"}
;;
nag)
: ${LIBS="f90 nagfl90 nag m"}
@@ -86,6 +98,8 @@ else
portland)
: ${LIBS="pgf90 pgf90_rpm1 pghpf2 pgf90rtl pgc m"}
: ${LIBDIRS='$(PGI)/linux86/lib'}
+ : ${F77_DEBUG_FLAGS="-g"}
+ : ${F90_DEBUG_FLAGS="-g"}
;;
fujitsu)
: ${LIBS="fj9i6 fj9e6 fj9f6"}
@@ -102,6 +116,29 @@ else
;;
esac
+#Set the appropriate warning and debugging flags
+ case "$CC" in
+ gcc)
+ : ${C_DEBUG_FLAGS="-g"}
+ : ${C_WARN_FLAGS="-Wall"}
+ ;;
+ *)
+ : ${C_DEBUG_FLAGS="-g"}
+# : ${C_WARN_FLAGS="-Wall"}
+ ;;
+ esac
+
+ case "$CXX" in
+ [cg]++)
+ : ${CXX_DEBUG_FLAGS="-g"}
+ : ${CXX_WARN_FLAGS="-Wall"}
+ ;;
+ *)
+ : ${CXX_DEBUG_FLAGS="-g"}
+# : ${C_WARN_FLAGS="-Wall"}
+ ;;
+ esac
+
# Cache stuff
if test -z "$L2_CACHELINE_BYTES" ; then
L2_CACHELINE_BYTES=32
diff --git a/lib/make/make.config.defn.in b/lib/make/make.config.defn.in
index afb5f1a9..eee8c88a 100644
--- a/lib/make/make.config.defn.in
+++ b/lib/make/make.config.defn.in
@@ -41,6 +41,20 @@ LDFLAGS = @LDFLAGS@
ARFLAGS = @ARFLAGS@
+# Debug flags
+
+C_DEBUG_FLAGS = @C_DEBUG_FLAGS@
+CXX_DEBUG_FLAGS = @CXX_DEBUG_FLAGS@
+F90_DEBUG_FLAGS = @F90_DEBUG_FLAGS@
+F77_DEBUG_FLAGS = @F77_DEBUG_FLAGS@
+
+# Warning flags
+
+C_WARN_FLAGS = @C_WARN_FLAGS@
+CXX_WARN_FLAGS = @CXX_WARN_FLAGS@
+F90_WARN_FLAGS = @F90_WARN_FLAGS@
+F77_WARN_FLAGS = @F77_WARN_FLAGS@
+
# Most compilers use -c -o to compile only, some do something different
CCOMPILEONLY = @CCOMPILEONLY@
FCOMPILEONLY = @FCOMPILEONLY@
@@ -123,3 +137,24 @@ EXEDIR = @EXEDIR@
# The name of the executable
EXE = @EXE@
+
+# Is this a debug configuration ?
+
+CCTK_DEBUG_MODE = @DEBUG_MODE@
+
+ifeq ($(strip $(CCTK_DEBUG_MODE)),yes)
+ CFLAGS += $(C_DEBUG_FLAGS)
+ CXXFLAGS += $(CXX_DEBUG_FLAGS)
+ F77FLAGS += $(F77_DEBUG_FLAGS)
+ F90FLAGS += $(F90_DEBUG_FLAGS)
+endif
+
+# Are we building with all warnings switched on ?
+
+ifeq ($(strip $(CCTK_WARN_MODE)),yes)
+ CFLAGS += $(C_WARN_FLAGS)
+ CXXFLAGS += $(CXX_WARN_FLAGS)
+ F77FLAGS += $(F77_WARN_FLAGS)
+ F90FLAGS += $(F90_WARN_FLAGS)
+endif
+