diff options
-rw-r--r-- | Makefile | 8 | ||||
-rw-r--r-- | configure.ac | 6 | ||||
-rw-r--r-- | perl/Makefile | 7 | ||||
-rw-r--r-- | perl/configure.ac | 6 |
4 files changed, 19 insertions, 8 deletions
@@ -17,6 +17,14 @@ makefiles = \ -include Makefile.config +OPTIMIZE = 1 + +ifeq ($(OPTIMIZE), 1) + GLOBAL_CXXFLAGS += -O3 +else + GLOBAL_CXXFLAGS += -O0 +endif + include mk/lib.mk GLOBAL_CXXFLAGS += -g -Wall -include config.h -std=c++17 diff --git a/configure.ac b/configure.ac index c67f1e739..26f16b846 100644 --- a/configure.ac +++ b/configure.ac @@ -50,10 +50,8 @@ AC_DEFINE_UNQUOTED(SYSTEM, ["$system"], [platform identifier ('cpu-os')]) test "$localstatedir" = '${prefix}/var' && localstatedir=/nix/var -# Set default flags for nix (as per AC_PROG_CC/CXX docs), -# while still allowing the user to override them from the command line. -: ${CFLAGS="-O3"} -: ${CXXFLAGS="-O3"} +CFLAGS= +CXXFLAGS= AC_PROG_CC AC_PROG_CXX AC_PROG_CPP diff --git a/perl/Makefile b/perl/Makefile index f36f5d0e9..284c75022 100644 --- a/perl/Makefile +++ b/perl/Makefile @@ -4,4 +4,11 @@ GLOBAL_CXXFLAGS += -g -Wall -include Makefile.config +OPTIMIZE = 1 + +ifeq ($(OPTIMIZE), 1) + GLOBAL_CFLAGS += -O3 + GLOBAL_CXXFLAGS += -O3 +endif + include mk/lib.mk diff --git a/perl/configure.ac b/perl/configure.ac index e8e3610a8..966700695 100644 --- a/perl/configure.ac +++ b/perl/configure.ac @@ -2,10 +2,8 @@ AC_INIT(nix-perl, m4_esyscmd([bash -c "echo -n $(cat ../.version)$VERSION_SUFFIX AC_CONFIG_SRCDIR(MANIFEST) AC_CONFIG_AUX_DIR(../config) -# Set default flags for nix (as per AC_PROG_CC/CXX docs), -# while still allowing the user to override them from the command line. -: ${CFLAGS="-O3"} -: ${CXXFLAGS="-O3"} +CFLAGS= +CXXFLAGS= AC_PROG_CC AC_PROG_CXX AX_CXX_COMPILE_STDCXX_11 |