# # # 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 ipl # #---------------------------------------------------------------------- # 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 with which we do build... this can # be retargeted (e.g., for building be with different options) # by setting LOCAL_BE_DIR in localdefs # TARG_OPT_DIR: is the opt directory with which we do build... this can # be retargeted (e.g., for building opt with different options) # by setting LOCAL_OPT_DIR in localdefs #---------------------------------------------------------------------- ifeq ($(BUILD_COMPILER), EDG) CVERSION = -xansi endif ifdef LOCAL_BE_DIR TARG_BE_DIR = $(TARGDIR)/$(LOCAL_BE_DIR) else TARG_BE_DIR = $(TARGDIR)/be endif ifdef LOCAL_OPT_DIR TARG_OPT_DIR = $(TARGDIR)/$(LOCAL_OPT_DIR) else TARG_OPT_DIR = $(TARGDIR)/wopt endif #---------------------------------------------------------------------- # Compiler Options #---------------------------------------------------------------------- HOSTDEFS += -Dsgi -DMONGOOSE_BE HOSTDEFS += -Dlonglong -DIPA_SUMMARY # need to define _LONGLONG and _SVR4_SOURCE to allow compilation with -ansi. HOSTDEFS += -D_LONGLONG -D_SVR4_SOURCE ifeq ($(BUILD_OPTIMIZE), DEBUG) HOSTDEFS += -DIs_True_On HOSTDEFS += -DInsist_On endif ifeq ($(BUILD_TARGET), IA64) HOSTDEFS += -D__MIPS_AND_IA64_ELF_H endif ifeq ($(BUILD_TARGET), IA32) HOSTDEFS += -D__MIPS_AND_IA64_ELF_H endif #---------------------------------------------------------------------- # List of directories, and source files of interest #---------------------------------------------------------------------- IPA_DIR = $(BUILD_TOT)/ipa IPA_COMMON_DIR = $(IPA_DIR)/common IPA_LOCAL_DIR = $(IPA_DIR)/local IPA_MAIN_DIR = $(IPA_DIR)/main IPA_OPTIMIZE_DIR = $(IPA_MAIN_DIR)/optimize IPA_ANALYZE_DIR = $(IPA_MAIN_DIR)/analyze BE_DIR = $(BUILD_TOT)/be BE_BE_DIR = $(BE_DIR)/be BE_TARG_DIR = $(BE_DIR)/$(BUILD_TARGET_DIR) BE_CG_DIR = $(BE_DIR)/cg BE_COM_DIR = $(BE_DIR)/com BE_OPT_DIR = $(BE_DIR)/opt BE_LNOPT_DIR = $(BE_DIR)/lno BE_VHO_DIR = $(BE_DIR)/vho BE_REGION_DIR = $(BE_DIR)/region COMMON_DIR = $(BUILD_TOT)/common COMMON_COM_DIR = $(COMMON_DIR)/com COMMON_COM_TARG_DIR = $(COMMON_COM_DIR)/$(BUILD_TARGET_DIR) COMMON_UTIL_DIR = $(COMMON_DIR)/util COMMON_UTIL_TARG_DIR = $(COMMON_UTIL_DIR)/$(BUILD_TARGET_DIR) INCLUDE_DIR = $(ROOT)/usr/include # These are the directories in which to look for source files. SRC_DIRS = \ $(IPA_COMMON_DIR) \ $(IPA_LOCAL_DIR) \ $(IPA_ANALYZE_DIR) \ $(BE_COM_DIR) \ $(BE_LNOPT_DIR) \ HEADER_DIRS = \ $(SRC_DIRS) \ $(COMMON_COM_DIR) \ $(COMMON_COM_TARG_DIR)\ $(COMMON_UTIL_DIR) \ $(COMMON_TDT_DIR) \ $(BE_COM_DIR) \ $(BE_OPT_DIR) \ $(BE_CG_DIR) \ $(BE_LNOPT_DIR) \ $(BE_VHO_DIR) \ $(BE_REGION_DIR) \ $(TARGDIR)/be \ IPA_LOCAL_CXX_SRCS = \ loop_info.cxx \ ipl_main.cxx \ ipl_bread_write.cxx \ ipl_summary_print.cxx \ ipl_summarize_util.cxx \ ipl_linex.cxx \ ipl_array_bread_write.cxx \ ipl_tlog.cxx \ ipl_outline.cxx \ init.cxx \ ipl_elfsym.cxx IPA_ANALYZE_SRCS = \ IPA_COMMON_SRCS = \ BE_COM_CXX_SRCS = \ ipa_section.cxx \ ipa_section_main.cxx \ ipa_section_print.cxx \ ipl_lno_util.cxx \ reshape.cxx \ wb_summary.cxx \ wb_ipl_summary.cxx \ ipa_cost_util.cxx \ BE_LNO_CXX_SRCS = \ lwn_util.cxx \ access_vector.cxx \ if_info.cxx \ lno_bv.cxx IPA_SRCS = \ $(IPA_COMMON_SRCS) \ $(IPA_ANALYZE_SRCS) \ IPA_CXX_SRCS = \ $(IPA_LOCAL_CXX_SRCS) \ $(BE_LNO_CXX_SRCS) \ $(BE_COM_CXX_SRCS) \ IPA_OBJS = $(IPA_SRCS:.c=.o) IPA_CXX_OBJS = $(IPA_CXX_SRCS:.cxx=.o) VPATH = $(SRC_DIRS) LCOPTS = $(STD_COMPILE_OPTS) LCDEFS = $(HOSTDEFS) $(TARGDEFS) LCINCS = $(addprefix -I, $(HEADER_DIRS)) ifeq ($(BUILD_OS), LINUX) LCINCS += -I$(BUILD_AREA)/include else LCINCS += -I$(BUILD_TOT)/include endif ifeq ($(BUILD_COMPILER), EDG) LC++OPTS = $(STD_COMPILE_OPTS) $(STD_C++_OPTS) -fullwarn -woff 1171,1172,1174,1201,1209,1375 else LC++OPTS = $(STD_COMPILE_OPTS) $(STD_C++_OPTS) endif ifeq ($(BUILD_COMPILER), GNU) #Most of the files are using old C++ headers, and we do not warn about them for now #In the future we may want to change them to the new standard c++ headers #This is applied to all makefiles in the backend CXXFLAGS += -Wno-deprecated endif LC++DEFS = $(HOSTDEFS) $(TARGDEFS) LC++INCS = $(LCINCS) LASOPTS = $(STD_COMPILE_OPTS) LASDEFS = $(HOSTDEFS) $(TARGDEFS) LASINCS = $(LCINCS) ifneq ($(STL_EXT_PATH),) LC++INCS += -I$(STL_EXT_PATH) endif ifeq ($(BUILD_OS), LINUX) LC++INCS += -D__STL_USE_NAMESPACES endif ifeq ($(BUILD_COMPILER), EDG) WOFF = -fullwarn endif GLDOPTS = $(STD_LOAD_OPTS) $(LD_QUICKSTART_INFO) 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) LCDEFS += -DMEM_STATS LC++DEFS += -DMEM_STATS LLDLIBS += -lmalloc LDFLAGS += -lmalloc endif #---------------------------------------------------------------------- # File containing the list of symbols exported outside of ipl.so #---------------------------------------------------------------------- ifeq ($(BUILD_COMPILER), EDG) EXPORT_LIST = -exports_file $(IPA_LOCAL_DIR)/Exported endif TARGETS = ipl.so LDIRT = be.so wopt.so be ipl ifeq ($(BUILD_COMPILER), EDG) LLDLIBS = -none endif default: first depends $(TARGETS) last #---------------------------------------------------------------------- # The commands in this section are done BEFORE any other target is # built. #---------------------------------------------------------------------- first: ## verify that wopt.so is up to date cd $(TARG_OPT_DIR) && $(MAKE) ifeq ($(filter LINUX AIX SUNOS FREEBSD,$(BUILD_OS)), $(BUILD_OS)) if [ ! -f be.so ]; then rm -f be.so; ln -s $(TARG_BE_DIR)/be.so .; fi if [ ! -f wopt.so ]; then rm -f wopt.so; ln -s $(TARG_OPT_DIR)/wopt.so .; fi endif include $(BUILD_TOT)/Makeinclude #---------------------------------------------------------------------- # The commands in this section are done AFTER every other target is # built. #---------------------------------------------------------------------- last: make_deps 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 $(STD_MONGOOSE_LOC) ipl.so $(STD_INSTALL) -lns be -F $(STD_MONGOOSE_LOC) ipl ifeq ($(BUILD_TYPE), SHARED) ifndef NOSYSGEN $(STD_INSTALL) $(STD_INSTALL_EXEC_MASK) -F /usr/cpu/sysgen/root$(STD_MONGOOSE_LOC) ipl.so $(STD_INSTALL) -lns be -F /usr/cpu/sysgen/root$(STD_MONGOOSE_LOC) ipl endif endif endif ipl: $(IPA_OBJS) $(IPA_CXX_OBJS) $(IPA_DSOS) $(C++F) -o $@ $(IPA_OBJS) $(IPA_CXX_OBJS) $(IPA_DSOS) $(LDFLAGS) if [ ! -l wopt.so ]; then ln -sf $(TARG_OPT_DIR)/wopt.so .; fi if [ ! -l be.so ]; then ln -sf $(TARG_BE_DIR)/be.so .; fi ifeq ($(BUILD_OS), LINUX) # dso's must be in same directory LINK_DSOS = be.so else ifeq ($(filter AIX SUNOS FREEBSD,$(BUILD_OS)), $(BUILD_OS)) # dso's must be in same directory LINK_DSOS = wopt.so be.so else ifeq ($(BUILD_OS), OSX) LINK_DSOS = $(TARG_OPT_DIR)/wopt.so endif 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 -weak_reference_mismatches weak endif ipl.so: $(IPA_OBJS) $(IPA_CXX_OBJS) $(LINK_DSOS) \ $(BE_BE_DIR)/so_locations $(IPA_LOCAL_DIR)/Exported $(C++F) -o $@ $(STD_DSO_LOADOPTS) $(EXPORT_LIST) \ $(IPA_OBJS) $(IPA_CXX_OBJS) \ $(LINK_DSOS) $(LLDLIBS) if [ ! -f be.so ]; then rm -f be.so; ln -s $(TARG_BE_DIR)/be.so .; fi if [ ! -f wopt.so ]; then rm -f wopt.so; ln -s $(TARG_OPT_DIR)/wopt.so .; fi if [ ! -f ipl ] ; then rm -f ipl; ln -s ../be_driver/be ipl; fi #---------------------------------------------------------------------- # Include the usual commonrules #---------------------------------------------------------------------- include $(COMMONRULES) #---------------------------------------------------------------------- # Special case rules for files that want to be individualistic #---------------------------------------------------------------------- # 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_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