From: Daniel Drake Allow build flags to be pulled from the environment, and make this the default behaviour (but fall back on old defaults if environment is empty). Index: acgmake/bin/acgmake =================================================================== --- acgmake.orig/bin/acgmake +++ acgmake/bin/acgmake @@ -68,7 +68,7 @@ done # parse options -CODE_LEVEL=dbg +CODE_LEVEL=default LIB_TYPE=shared HIDE="@" JOBS="" @@ -79,6 +79,7 @@ for i in $OPTIONS ; do # compilation options + -env ) CODE_LEVEL=env ;; -dbg ) CODE_LEVEL=dbg ;; -prf ) CODE_LEVEL=prf ;; -opt ) CODE_LEVEL=opt ;; @@ -174,6 +175,13 @@ if [ $? != 0 ] ; then fi ARCH=`$ACGMAKE/bin/arch.sh` +# if no compiler options were specified, attempt to pull cflags out of +# environment, and fallback on dbg if none were specified +if [ "$CODE_LEVEL" == "default" -a -z "$CXXFLAGS" -a -z "$CXXDEFS" -a -z "$LDFLAGS" ]; then + CODE_LEVEL="dbg" +else + CODE_LEVEL="env" +fi # collect options Index: acgmake/modules/cxx_include =================================================================== --- acgmake.orig/modules/cxx_include +++ acgmake/modules/cxx_include @@ -153,9 +153,17 @@ ifneq ($(PACKAGES),) endif -CXX_DEFS += $(CXX_DEFS_$(call uppercase,$(CODE_LEVEL))) -CXX_CFLAGS += $(CXX_CFLAGS_$(call uppercase,$(CODE_LEVEL))) -CXX_LDFLAGS += $(CXX_LDFLAGS_$(call uppercase,$(CODE_LEVEL))) +ifeq ($(CODE_LEVEL),env) + # these come from the environment + CXX_DEFS += $(CXXDEFS) + CXX_CFLAGS += $(CXXFLAGS) + CXX_LDFLAGS += $(LDFLAGS) +else + CXX_DEFS += $(CXX_DEFS_$(call uppercase,$(CODE_LEVEL))) + CXX_CFLAGS += $(CXX_CFLAGS_$(call uppercase,$(CODE_LEVEL))) + CXX_LDFLAGS += $(CXX_LDFLAGS_$(call uppercase,$(CODE_LEVEL))) +endif + CXX_CFLAGS += $(CXX_DEFS) CXX_CFLAGS += $(cxx-cflags) CXX_CFLAGS += $(cxx-incpath)