# ---------------------------------------------------------------------- # # zoom.build.mk - enforce FPCL compiler flags requirements # # Intended to be used as a postprocessing step after all others' # GNUmakefiles have been read and processed # # History: # 21-Oct-1997 WEB Initial draft # 25-Oct-1997 WEB Added FixedTypes' req's and debugging opt # 10-Nov-1997 WEB Revised approach to adding to CPPFLAGS # 11-Nov-1997 WEB Fixed syntax error # 13-Nov-1997 WEB Improved exception-processing logic and comments; # added new logic for compiler control options; resequenced # 14-Nov-1997 WEB Corrected NOTHROW symbol name; revised # optimization logic (including matching debugging option) # 17-Nov-1997 WEB Added __KAI_STRICT (per KAI's advice) # 18-Nov-1997 WEB Added debugging option and a bit of narrative # 18-Dec-1997 WEB Separated zoom.mk into this and zoom.symbols.mk, # and moved from SoftRelTools to ZMutility package # 21-Apr-1998 PGC Added NT Fortran flags # 03-Jun-1998 WEB Added NT CXX flags # 16-Jun-1998 WEB Added LDFLAGS debugging output # 17-Jul-1998 WEB Compensated for LDFLAGS deficiency # 16-Sep-1998 WEB Added ARFLAGS debugging output # 16-Apr-1999 WEB Comment out most of this, relying on the # increased maturity of SoftRelTools # # ---------------------------------------------------------------------- # ---------- # [1] Define the dialect the compiler is to accept: # ---------- #ifeq (KCC, $(CXX)) # KCC # ifeq (, $(filter --abstract_pointer, $(CXXFLAGS))) # override CXXFLAGS += --abstract_pointer # endif # ifeq (, $(filter --no_implicit_include, $(CXXFLAGS))) # override CXXFLAGS += --no_implicit_include # endif # ifeq (, $(filter --no_implicit_typename, $(CXXFLAGS))) # override CXXFLAGS += --no_implicit_typename # endif # # ifeq (, $(filter --strict, $(CXXFLAGS))) # ifeq (, $(filter -ansi, $(CXXFLAGS))) # synonymous w/ --strict # override CXXFLAGS += --strict # endif # endif # ifeq (, $(filter -D__KAI_STRICT, $(CPPFLAGS))) # recommended by KAI # override CPPFLAGS += -D__KAI_STRICT # endif #endif # KCC # ---------- # [2] Obtain best available debugging option: # ---------- #ifeq (g++, $(CXX)) # g++ uses -gxxx; we prefer -ggdb3 # ifeq (, $(filter -g%, $(CXXFLAGS))) # override CXXFLAGS += -ggdb3 # else # override CXXFLAGS := $(patsubst -g%, -ggdb3, $(CXXFLAGS)) # endif #endif # g++ # #ifeq (KCC, $(CXX)) # KCC uses -gx; we prefer -g3 (debug and optimize) # ifeq (, $(filter -g%, $(CXXFLAGS))) # override CXXFLAGS += -g --backend -g3 # else # override CXXFLAGS := $(patsubst -g%, -g --backend -g3, $(CXXFLAGS)) # endif #endif # KCC # ---------- # [3] Obtain best available code improvement (optimization) option: # ---------- #ifeq (g++, $(CXX)) # g++ uses -O flag with options; we prefer -O2 ## since -O[12] are currently broken, however, we use nothing # ifeq (-O, $(filter -O%, $(CXXFLAGS))) # override CXXFLAGS += # else # override CXXFLAGS := $(patsubst -O%, , $(CXXFLAGS)) # endif #endif # g++ # #ifeq (KCC, $(CXX)) # KCC uses +Kx -Oy; we prefer +K3 -O2 # ifeq (, $(filter +K%, $(CXXFLAGS))) # override CXXFLAGS += +K3 # else # override CXXFLAGS := $(patsubst +K%, +K3, $(CXXFLAGS)) # endif # ifeq (, $(filter -O%, $(CXXFLAGS))) # override CXXFLAGS += -O2 # else # override CXXFLAGS := $(patsubst -O%, -O2, $(CXXFLAGS)) # endif #endif # KCC # ---------- # [4] Provide other compiler control options: # ---------- ifeq (g++, $(CXX)) #ifeq (, $(filter -Wall, $(CXXFLAGS))) # turn on all g++'s warnings # override CXXFLAGS += -Wall #endif ifneq (, $(filter -mips%, $(CXXFLAGS))) # take out any -mips? flags override CXXFLAGS := $(patsubst -mips%, , $(CXXFLAGS)) endif endif # g++ #ifeq (KCC, $(CXX)) #ifeq (, $(filter +K, $(CXXFLAGS))) # we prefer +K3 #override CXXFLAGS := $(patsubst +K%, +K3, $(CXXFLAGS)) #endif #endif # KCC ifeq (srt_ntcc, $(CXX)) # MSVC++ compiler seems to need extra heap space override CXXFLAGS += -NTZm400 endif # srt_ntcc # ---------- # [7] Prepare any needed loader flags # ---------- #ifeq (KCC, $(CXX)) # KCC uses +K flag with options; we prefer +K3 # ifeq (--exceptions, $(filter --exceptions, $(CXXFLAGS))) # override LDFLAGS += --exceptions # endif #endif # KCC # ---------- # [8] Permit debugging this GNUmakefile # ---------- ifdef ZM_VERBOSE COMMAND := $(shell echo "zoom.build.mk:" >& 2) COMMAND := $(shell echo " CXX = $(CXX)" >& 2) COMMAND := $(shell echo " CPPFLAGS = $(CPPFLAGS)" >& 2) COMMAND := $(shell echo " CXXFLAGS = $(CXXFLAGS)" >& 2) COMMAND := $(shell echo " LDFLAGS = $(LDFLAGS)" >& 2) COMMAND := $(shell echo " ARFLAGS = $(ARFLAGS)" >& 2) COMMAND := $(shell echo " cwd = $(shell /bin/pwd)" >& 2) endif # ---------- # [9] Make sure that HepTuple's Fortran is compiled with the proper # calling conventions # ---------- ifeq (-MSVC50,$(findstring -MSVC50,$(BFARCH))) override FCFLAGS := $(patsubst -NTiface:nomixed_str_len_arg, , $(FCFLAGS)) override FCFLAGS := $(patsubst -NTassume:underscore, , $(FCFLAGS)) override FCFLAGS := $(patsubst -NTnames:lowercase, , $(FCFLAGS)) endif