# # # Copyright (C) 2000, 2001 Silicon Graphics, Inc. All Rights Reserved. # # This program is free software; you can redistribute it and/or modify it # under the terms of version 2 of the GNU General Public License as # published by the Free Software Foundation. # # This program is distributed in the hope that it would be useful, but # WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. # # Further, this software is distributed without any warranty that it is # free of the rightful claim of any third person regarding infringement # or the like. Any license provided herein, whether implied or # otherwise, applies only to this software file. Patent licenses, if # any, provided herein do not apply to combinations of this program with # other software, or any other product whatsoever. # # You should have received a copy of the GNU General Public License along # with this program; if not, write the Free Software Foundation, Inc., 59 # Temple Place - Suite 330, Boston MA 02111-1307, USA. # # Contact information: Silicon Graphics, Inc., 1600 Amphitheatre Pky, # Mountain View, CA 94043, or: # # http://www.sgi.com # # For further information regarding this notice, see: # # http://oss.sgi.com/projects/GenInfo/NoticeExplan # # # # Makefile.base for wopt # #---------------------------------------------------------------------- # Information about Makefile # # This Makefile is used to build the 32 bit host/target version of the # back-end # # * This Makefile does not require that targ_info has already been built. # # * Because the Makefile removes temporary files that are in the # current directory (at startup and on interrupts) you can't # run two or more makes in the same directory at the same time. # (Perhaps, If I could force the temp files out to a temp directory, # this could be changed?) # #---------------------------------------------------------------------- #---------------------------------------------------------------------- # Set environment variables # # TARGDIR : is the targ specific directory in which we do build. # e.q. /d1/cmplrs.src/v4.00/host32 # #---------------------------------------------------------------------- TARGDIR = $(BUILD_AREA) CURDIR = . #---------------------------------------------------------------------- # Include the usual commondefs #---------------------------------------------------------------------- include $(COMMONDEFS) #---------------------------------------------------------------------- # Set environment variables # # TARG_BE_DIR: is the be directory in which we do build... this can # be retargeted (e.g., for building be with different options) # by setting LOCAL_BE_DIR in localdefs #---------------------------------------------------------------------- ifdef LOCAL_BE_DIR CVERSION = -xansi TARG_BE_DIR = $(TARGDIR)/$(LOCAL_BE_DIR) else CVERSION = TARG_BE_DIR = $(TARGDIR)/be endif #---------------------------------------------------------------------- # Compiler Options #---------------------------------------------------------------------- HOSTDEFS += -Dsgi HOSTDEFS += -DBACK_END HOSTDEFS += -Dlonglong # need to define _LONGLONG and _SVR4_SOURCE to allow compilation with -ansi. HOSTDEFS += -D_LONGLONG -D_SVR4_SOURCE HOSTDEFS += -DMONGOOSE_BE -DCOMPILE_UPC ifeq ($(BUILD_OPTIMIZE), DEBUG) #HOSTDEFS += -DIs_True_On HOSTDEFS += -DInsist_On endif ifeq ($(BUILD_PCH), USE_PCH) HOSTDEFS += -DUSE_PCH endif INSTALL_LOC = $(STD_MONGOOSE_LOC) WOFF = -fullwarn #---------------------------------------------------------------------- # List of directories, and source files of interest #---------------------------------------------------------------------- BE_DIR = $(BUILD_TOT)/be BE_BE_DIR = $(BE_DIR)/be BE_CG_DIR = $(BE_DIR)/cg BE_COM_DIR = $(BE_DIR)/com BE_OPT_DIR = $(BE_DIR)/opt BE_VHO_DIR = $(BE_DIR)/vho BE_REGION_DIR = $(BE_DIR)/region COMMON_DIR = $(BUILD_TOT)/common COMMON_COM_DIR = $(COMMON_DIR)/com COMMON_STL_DIR = $(COMMON_DIR)/stl COMMON_COM_TARG_DIR = $(COMMON_COM_DIR)/ia64 COMMON_LIB_DIR = $(COMMON_DIR)/lib COMMON_TARG_INFO_ACCESS = $(COMMON_DIR)/targ_info/access COMMON_UTIL_DIR = $(COMMON_DIR)/util COMMON_UTIL_TARG_DIR = $(COMMON_UTIL_DIR)/ia64 INCLUDE_DIR = $(ROOT)/usr/include LIBCOMUTIL_DIR = $(BUILD_TOT)/libcomutil # These are the directories in which to look for source files. WOPT_DIRS = \ $(BE_COM_DIR) \ $(BE_OPT_DIR) \ $(COMMON_UTIL_DIR) \ WOPT_HEADER_DIRS = \ $(WOPT_DIRS) \ $(COMMON_COM_DIR) \ $(COMMON_STL_DIR) \ $(COMMON_TARG_INFO_ACCESS) \ $(COMMON_UTIL_DIR) \ $(BE_COM_DIR) \ $(BE_VHO_DIR) \ $(BE_REGION_DIR) \ $(COMMON_COM_TARG_DIR) \ $(TARGDIR)/targ_info \ $(TARGDIR)/include \ $(TARG_BE_DIR) #---------------------------------------------------------------------- # List of source files. Please keep them in alphabetical order. #---------------------------------------------------------------------- BE_COM_CXX_SRCS = \ cxx_template.cxx \ BE_OPT_SRCS = \ BE_OPT_CXX_SRCS = \ opt_alias_class.cxx \ opt_base.cxx \ opt_bb.cxx \ opt_bdce.cxx \ opt_bool.cxx \ opt_canon.cxx \ opt_cfg.cxx \ opt_cfg_trans.cxx \ opt_combine.cxx \ opt_cond_const.cxx \ opt_count.cxx \ opt_cse.cxx \ opt_daVinci.cxx \ opt_dbg.cxx \ opt_dce.cxx \ opt_dom.cxx \ opt_dse.cxx \ opt_du.cxx \ opt_eant.cxx \ opt_eavail.cxx \ opt_efinalize.cxx \ opt_ehoist.cxx \ opt_emit.cxx \ opt_eocc.cxx \ opt_etable.cxx \ opt_essa.cxx \ opt_estr.cxx \ opt_exc.cxx \ opt_expr.cxx \ opt_fb.cxx \ opt_find.cxx \ opt_fold.cxx \ opt_htable.cxx \ opt_htable_emit.cxx \ opt_ivr.cxx \ opt_leaf_iter.cxx \ opt_lftr2.cxx \ opt_loop.cxx \ opt_loop_trans.cxx \ opt_ltable.cxx \ opt_main.cxx \ opt_min_essa.cxx \ opt_mu_chi.cxx \ opt_spre_finalize.cxx \ opt_project.cxx \ opt_prop.cxx \ opt_region_emit.cxx \ opt_rename.cxx \ opt_rvi.cxx \ opt_rvilr.cxx \ opt_rvitab.cxx \ opt_rviwn.cxx \ opt_rvi_emit.cxx \ opt_ssa.cxx \ opt_ssu.cxx \ opt_speculate.cxx \ opt_stable.cxx \ opt_sym.cxx \ opt_tail.cxx \ opt_util.cxx \ opt_vn.cxx \ opt_vn_expr.cxx \ opt_vnfre.cxx \ opt_verify.cxx \ opt_whirlview.cxx \ opt_wn.cxx \ opt_alias_analysis.cxx\ opt_u64_lower.cxx \ opt_mtype_b.cxx \ opt_revise_ssa.cxx \ wodriver.cxx \ init.cxx \ opt_upc_cse.cxx \ opt_upc_locality.cxx \ race.cxx ifeq ($(BUILD_PCH), USE_PCH) BACK_END_PCH_OBJS = $(BE_OPT_CXX_SRCS:.cxx=.o) BACK_END_CXX_SRCS = $(BE_COM_CXX_SRCS) else BACK_END_CXX_SRCS = $(BE_COM_CXX_SRCS) $(BE_OPT_CXX_SRCS) endif COMMON_UTIL_SRCS = \ bitset.c \ BACK_END_SRCS = \ $(BE_OPT_SRCS) \ $(COMMON_UTIL_SRCS) \ BACK_END_OBJS = $(BACK_END_SRCS:.c=.o) BACK_END_CXX_OBJS = $(BACK_END_CXX_SRCS:.cxx=.o) # extra files to be removed with make clobber LDIRT = *.pch VPATH = $(WOPT_DIRS) LCOPTS += $(STD_COMPILE_OPTS) ifneq ($(BUILD_COMPILER), EDG) #LCOPTS += -fwritable-strings endif LCDEFS = $(HOSTDEFS) $(TARGDEFS) LCINCS = $(addprefix -I, $(WOPT_HEADER_DIRS)) ifeq ($(BUILD_OS), LINUX) LCINCS += -I$(BUILD_AREA)/include endif ifeq ($(BUILD_COMPILER), EDG) WOFF = -fullwarn -woff 1172,1174,1201,1202,1209,1356,1375 else WOFF = endif LC++OPTS = $(STD_COMPILE_OPTS) $(STD_C++_OPTS) $(WOFF) $(PCH_OPTS) ifneq ($(BUILD_COMPILER), EDG) #LC++OPTS += -fwritable-strings endif LC++DEFS = $(HOSTDEFS) $(TARGDEFS) LC++INCS = $(addprefix -I, $(WOPT_HEADER_DIRS)) LASOPTS = $(STD_COMPILE_OPTS) LASDEFS = $(HOSTDEFS) $(TARGDEFS) LASINCS = $(addprefix -I, $(WOPT_HEADER_DIRS)) ifneq ($(STL_EXT_PATH),) LC++INCS += -I$(STL_EXT_PATH) endif ifeq ($(BUILD_OS), LINUX) LC++INCS += -I$(BUILD_AREA)/include else #on linux we use the include/ in the build directory for common headers (legacy stuff?), #while on other platforms we use include/ in the toplevel directory #This is also done for Makefile.gbase in lno LC++INCS += -I$(BUILD_TOT)/include endif #ifeq ($(BUILD_OS), LINUX) #LC++INCS += -D__STL_USE_NAMESPACES -D__STL_FUNCTION_TMPL_PARTIAL_ORDER #endif # allows unused parameters ifeq ($(BUILD_COMPILER), EDG) OPTIMIZER += -woff 3201 endif # setup stuff to build shared or non-shared GLDOPTS = $(STD_LOAD_OPTS) #DSOSTARTOPT = -update_registry $(TARG_BE_DIR)/so_locations -Wl,-no_unresolved #DSOSTARTOPT = -Wl,-no_unresolved ifeq ($(BUILD_COMPILER), EDG) DSOSTARTOPT = -check_registry $(TARG_BE_DIR)/so_locations -Wl,-no_unresolved else DSOSTARTOPT = endif DSOSTARTOPT_32 = $(DSOSTARTOPT) DSOSTARTOPT_N32 = $(DSOSTARTOPT) ifeq ($(BUILD_VARIANT), MEM_STATS) LLDLIBS += -lmalloc LDFLAGS += -lmalloc endif ifeq ($(BUILD_OS), OSX) # bug 1362: required for acosf on XCode 1.5 LLDLIBS += -lmx endif #---------------------------------------------------------------------- # File containing the list of symbols exported outside of cg.so #---------------------------------------------------------------------- ifeq ($(BUILD_COMPILER), EDG) EXPORT_LIST = -exports_file $(BE_OPT_DIR)/Exported else EXPORT_LIST = endif #---------------------------------------------------------------------- # Define target #---------------------------------------------------------------------- ifdef LINK_DSO TARGETS = debug-wopt else TARGETS = wopt.so endif #---------------------------------------------------------------------- # Variables describing additional sources, objects, and libraries #---------------------------------------------------------------------- ifeq ($(BUILD_COMPILER), EDG) LLDLIBS += -none -lm endif #wei: need this to for make depend CXXFILES = $(BE_OPT_CXX_SRCS) default: first depends $(TARGETS) last #---------------------------------------------------------------------- # The commands in this section are done BEFORE any other target is # built. #---------------------------------------------------------------------- first: ## verify that be.so is up to date cd $(TARG_BE_DIR) && $(MAKE) ifeq ($(filter LINUX AIX SUNOS FREEBSD OSX,$(BUILD_OS)), $(BUILD_OS)) if [ ! -f be.so ]; then rm -f be.so; ln -s $(TARG_BE_DIR)/be.so .; fi endif ifeq ($(BUILD_PCH), USE_PCH) ## build pch files first so that we can use precompiled headers ( $(MAKE) $(.MAKEFLAGS) BUILD_PCH=USE_PCH PCH_OPTS="-LANG:create_pch=opt_pch.pch" opt_pch.pch opt_pch.o ) ( $(MAKE) $(.MAKEFLAGS) BUILD_PCH=USE_PCH BUILD_OPTIMIZE="$(BUILD_OPTIMIZE)" PCH_OPTS="-LANG:use_pch=opt_pch.pch" opt_pch_files ) endif include $(BUILD_TOT)/Makeinclude #---------------------------------------------------------------------- # The commands in this section are done AFTER every other target is # built. #---------------------------------------------------------------------- #last: make_deps #---------------------------------------------------------------------- # Build 'wopt' # # These rules build the 'wopt' executable by default, and can install # it in the $(BUILD_INSTALL)/usr/lib directory. # #---------------------------------------------------------------------- install:: default ifeq ($(BUILD_OS), LINUX) $(STD_INSTALL) $(STD_INSTALL_EXEC_MASK) -D $(TARGETS) $(STD_MONGOOSE_LINUX_LOC)/$(TARGETS) else $(STD_INSTALL) $(STD_INSTALL_EXEC_MASK) -F $(INSTALL_LOC) wopt.so ifeq ($(BUILD_TYPE), SHARED) ifndef NOSYSGEN $(STD_INSTALL) $(STD_INSTALL_EXEC_MASK) -F /usr/cpu/sysgen/root$(INSTALL_LOC) wopt.so endif endif endif ifeq ($(BUILD_PCH), USE_PCH) opt_pch_files: $(BACK_END_PCH_OBJS) opt_pch.pch wopt.so: $(BACK_END_OBJS) $(BACK_END_CXX_OBJS) $(BACK_END_PCH_OBJS) \ $(TARG_BE_DIR)/be.so $(BE_OPT_DIR)/Exported $(BE_BE_DIR)/so_locations $(C++F) -o wopt.so $(STD_DSO_LOADOPTS) $(EXPORT_LIST) \ $(BACK_END_OBJS) $(BACK_END_CXX_OBJS) $(BACK_END_PCH_OBJS) \ $(TARG_BE_DIR)/be.so $(LLDLIBS) -show if [ ! -l be.so ]; then ln -sf $(TARG_BE_DIR)/be.so .; fi if [ ! -l be ]; then ln -sf $(TARG_BE_DIR)/be .; fi if [ ! -l wopt ]; then ln -sf $(TARG_BE_DIR)/be wopt; fi else ifeq ($(filter LINUX SUNOS FREEBSD,$(BUILD_OS)), $(BUILD_OS)) # dso's must be in same directory LINK_DSOS = be.so ifeq ($(BUILD_HOST), IA64) ifeq ($(BUILD_COMPILER), SGI) STD_DSO_LOADOPTS += -Wl,-relax endif endif else ifeq ($(BUILD_OS), AIX) # dso's must be in same directory # DaVinci.o is workaround for link failures on gcc 3.3 LINK_DSOS = be.so $(TARG_BE_DIR)/DaVinci.o else LINK_DSOS = $(TARG_BE_DIR)/be.so endif endif ifeq ($(BUILD_COMPILER), GNU) STD_DSO_LOADOPTS += -shared endif ifeq ($(BUILD_OS), OSX) STD_DSO_LOADOPTS += -dynamiclib endif wopt.so: $(BACK_END_OBJS) $(BACK_END_CXX_OBJS) $(BE_OPT_DIR)/Exported \ $(TARG_BE_DIR)/be.so $(BE_BE_DIR)/so_locations $(C++F) -o wopt.so $(STD_DSO_LOADOPTS) $(EXPORT_LIST) \ $(BACK_END_OBJS) $(BACK_END_CXX_OBJS) \ $(LINK_DSOS) $(LLDLIBS) ifeq ($(BUILD_OS), IRIX) if [ ! -l be.so ]; then ln -sf $(TARG_BE_DIR)/be.so .; fi if [ ! -l be ]; then ln -sf $(TARG_BE_DIR)/be .; fi if [ ! -l wopt ]; then ln -sf $(TARG_BE_DIR)/be wopt; fi endif endif LDIRT += be.so bedriver be wopt ifdef LINK_DSO debug-wopt: wopt.so (cd $(TARG_BE_DIR); $(MAKE) LINK_DSO='$(LINK_DSO)' \ LINK_DSO_OPTS='$(LINK_DSO_OPTS) -L.' be) endif #---------------------------------------------------------------------- # Include the usual commonrules #---------------------------------------------------------------------- include $(COMMONRULES) #---------------------------------------------------------------------- # Special case rules for files that want to be individualistic #---------------------------------------------------------------------- ifeq ($(BUILD_COMPILER), EDG) DSONAMEOPT = -soname wopt.so else DSONAMEOPT = endif # FIXME: copied from Ji's ../be/Makefile.gbase, not sure if needed. ifeq ($(BUILD_OS), IRIX) CFLAGS += -D_SGI_SGI CXXFLAGS += -D_SGI_SGI ifeq ($(BUILD_COMPILER), VENDOR) CFLAGS += -woff 1174,1209,3201 CXXFLAGS += -woff 1174,1209,3201 else CFLAGS += -D_GCC_NO_PRAGMAWEAK -D__GNU_BUG_WORKAROUND CXXFLAGS += -D_GCC_NO_PRAGMAWEAK -D__GNU_BUG_WORKAROUND endif endif ifeq ($(BUILD_OS), LINUX) CFLAGS += -D_LINUX_LINUX CXXFLAGS += -D_LINUX_LINUX endif ifeq ($(BUILD_COMPILER), GNU) CXXFLAGS += -Wno-deprecated endif ifeq ($(BUILD_OS), SOLARIS) CFLAGS = -D_SOLARIS_SOLARIS -D_SOLARIS -D_LEGO_CLONER -DBACK_END -DMONGOOSE_BE \ -D_LONGLONG -Dlonglong -D_SVR4_SOURCE -D_NEW_SYMTAB -DTARG_SOLARIS \ $(LCINCS) $(OPTIMIZER) ifeq ($(BUILD_COMPILER), VENDOR) CFLAGS += -KPIC ifeq ($(BUILD_SB), YES) CFLAGS += -xsb endif endif ifeq ($(BUILD_COMPILER), GNU) CFLAGS += -D__GNU_BUG_WORKAROUND -fPIC endif CXXFLAGS = $(CFLAGS) -w endif