From 1df75787e41236c1cc0760b7a5c043d9ba1fbee3 Mon Sep 17 00:00:00 2001 From: "Peter W. Draper" <p.w.draper@durham.ac.uk> Date: Fri, 22 Sep 2023 11:26:08 +0100 Subject: [PATCH] Use OPT_CFLAGS as optimizations are no longer in CFLAGS --- Makefile.am | 2 +- argparse/Makefile.am | 2 +- configure.ac | 5 +++-- examples/Cooling/CoolingRates/Makefile.am | 2 +- src/Makefile.am | 6 +++--- tests/Makefile.am | 2 +- 6 files changed, 10 insertions(+), 9 deletions(-) diff --git a/Makefile.am b/Makefile.am index 3ca9fd5e74..d475bc3525 100644 --- a/Makefile.am +++ b/Makefile.am @@ -38,7 +38,7 @@ MYFLAGS = # Add the source directory and the non-standard paths to the included library headers to CFLAGS AM_CFLAGS = -I$(top_srcdir)/src -I$(top_srcdir)/argparse $(HDF5_CPPFLAGS) \ $(GSL_INCS) $(FFTW_INCS) $(NUMA_INCS) $(GRACKLE_INCS) $(OPENMP_CFLAGS) \ - $(CHEALPIX_CFLAGS) + $(CHEALPIX_CFLAGS) $(OPT_CFLAGS) AM_LDFLAGS = $(HDF5_LDFLAGS) diff --git a/argparse/Makefile.am b/argparse/Makefile.am index 2fa6fb9e9e..2aa6f135c1 100644 --- a/argparse/Makefile.am +++ b/argparse/Makefile.am @@ -22,7 +22,7 @@ AM_SOURCES = argparse.c # Sources and flags for regular library libargparse_la_SOURCES = $(AM_SOURCES) -libargparse_la_CFLAGS = $(AM_CFLAGS) +libargparse_la_CFLAGS = $(AM_CFLAGS) $(OPT_CFLAGS) libargparse_la_LDFLAGS = $(AM_LDFLAGS) EXTRA_DIST = LICENSE README.md diff --git a/configure.ac b/configure.ac index bc63e5143b..82c754afc2 100644 --- a/configure.ac +++ b/configure.ac @@ -576,8 +576,9 @@ if test "$enable_opt" = "yes" ; then # Choose the best flags for this compiler and architecture ac_test_CFLAGS="no" - AX_CC_MAXOPT + AX_CC_MAXOPT_SWIFT ac_test_CFLAGS="yes" + AC_ARG_VAR([OPT_CFLAGS], [C compiler flags added to the basic CFLAGS for good optimization]) # Choose the best flags for the gravity sub-library on this compiler and architecture if test "$ax_cv_c_compiler_vendor" = "intel"; then @@ -3003,7 +3004,7 @@ AC_MSG_RESULT([ Compiler : $CC - vendor : $ax_cv_c_compiler_vendor - version : $ax_cv_c_compiler_version - - flags : $CFLAGS $OPENMP_CFLAGS + - flags : $OPT_CFLAGS $CFLAGS $OPENMP_CFLAGS MPI enabled : $enable_mpi HDF5 enabled : $with_hdf5 - parallel : $have_parallel_hdf5 diff --git a/examples/Cooling/CoolingRates/Makefile.am b/examples/Cooling/CoolingRates/Makefile.am index 604a4691a4..0d62607ba2 100644 --- a/examples/Cooling/CoolingRates/Makefile.am +++ b/examples/Cooling/CoolingRates/Makefile.am @@ -15,7 +15,7 @@ # along with this program. If not, see <http://www.gnu.org/licenses/>. # Add the source directory and the non-standard paths to the included library headers to CFLAGS -AM_CFLAGS = -I$(top_srcdir)/src -I$(top_builddir)/examples $(HDF5_CPPFLAGS) $(GSL_INCS) $(FFTW_INCS) $(NUMA_INCS) $(OPENMP_CFLAGS) $(CHEALPIX_CFLAGS) +AM_CFLAGS = -I$(top_srcdir)/src -I$(top_builddir)/examples $(HDF5_CPPFLAGS) $(GSL_INCS) $(FFTW_INCS) $(NUMA_INCS) $(OPENMP_CFLAGS) $(CHEALPIX_CFLAGS) $(OPT_CFLAGS) AM_LDFLAGS = $(HDF5_LDFLAGS) $(HDF5_LIBS) $(FFTW_LIBS) $(NUMA_LIBS) $(TCMALLOC_LIBS) $(JEMALLOC_LIBS) $(TBBMALLOC_LIBS) $(GRACKLE_LIBS) $(GSL_LIBS) $(PROFILER_LIBS) diff --git a/src/Makefile.am b/src/Makefile.am index b0ad938f55..e4912051fa 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -16,7 +16,7 @@ # along with this program. If not, see <http://www.gnu.org/licenses/>. # Add the non-standard paths to the included library headers -AM_CFLAGS = $(HDF5_CPPFLAGS) $(GSL_INCS) $(FFTW_INCS) $(NUMA_INCS) $(GRACKLE_INCS) $(SUNDIALS_INCS) $(OPENMP_CFLAGS) $(CHEALPIX_CFLAGS) +AM_CFLAGS = $(HDF5_CPPFLAGS) $(GSL_INCS) $(FFTW_INCS) $(NUMA_INCS) $(GRACKLE_INCS) $(SUNDIALS_INCS) $(OPENMP_CFLAGS) $(CHEALPIX_CFLAGS) $(OPT_CFLAGS) # Assign a "safe" version number AM_LDFLAGS = $(HDF5_LDFLAGS) $(FFTW_LIBS) @@ -528,14 +528,14 @@ version_string.h: version_string.h.in Makefile $(AM_SOURCES) $(include_HEADERS) -e "s,@GIT_REVISION\@,$${GIT_REVISION}," \ -e "s|@GIT_BRANCH\@|$${GIT_BRANCH}|" \ -e "s|@GIT_DATE\@|$${GIT_DATE}|" \ - -e "s|@SWIFT_CFLAGS\@|$(CFLAGS)|" $< > version_string.h; \ + -e "s|@SWIFT_CFLAGS\@|$(OPT_CFLAGS) $(CFLAGS)|" $< > version_string.h; \ else \ if test ! -f version_string.h; then \ sed -e "s,@PACKAGE_VERSION\@,$(PACKAGE_VERSION)," \ -e "s,@GIT_REVISION\@,unknown," \ -e "s,@GIT_BRANCH\@,unknown," \ -e "s,@GIT_DATE\@,unknown," \ - -e "s|@SWIFT_CFLAGS\@|$(CFLAGS)|" $< > version_string.h; \ + -e "s|@SWIFT_CFLAGS\@|$(OPT_CFLAGS) $(CFLAGS)|" $< > version_string.h; \ fi; \ fi diff --git a/tests/Makefile.am b/tests/Makefile.am index 53fce13c93..6f50aec047 100644 --- a/tests/Makefile.am +++ b/tests/Makefile.am @@ -15,7 +15,7 @@ # along with this program. If not, see <http://www.gnu.org/licenses/>. # Add the source directory and the non-standard paths to the included library headers to CFLAGS -AM_CFLAGS = -I$(top_srcdir)/src $(HDF5_CPPFLAGS) $(GSL_INCS) $(FFTW_INCS) $(NUMA_INCS) $(OPENMP_CFLAGS) $(CHEALPIX_CFLAGS) +AM_CFLAGS = -I$(top_srcdir)/src $(HDF5_CPPFLAGS) $(GSL_INCS) $(FFTW_INCS) $(NUMA_INCS) $(OPENMP_CFLAGS) $(CHEALPIX_CFLAGS) $(OPT_CFLAGS) AM_LDFLAGS = ../src/.libs/libswiftsim.a $(HDF5_LDFLAGS) $(HDF5_LIBS) $(FFTW_LIBS) $(NUMA_LIBS) $(TCMALLOC_LIBS) $(JEMALLOC_LIBS) $(TBBMALLOC_LIBS) $(GRACKLE_LIBS) $(GSL_LIBS) $(PROFILER_LIBS) $(CHEALPIX_LIBS) -- GitLab