# # # 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 gccfe # #---------------------------------------------------------------------- # 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) #---------------------------------------------------------------------- # Include the usual commondefs #---------------------------------------------------------------------- include $(COMMONDEFS) #---------------------------------------------------------------------- # Set environment variables #---------------------------------------------------------------------- ifeq ($(BUILD_COMPILER), SGI) CVERSION = -xansi else CVERSION = endif #---------------------------------------------------------------------- # Compiler Options #---------------------------------------------------------------------- # These are here because they are needed both in fecc and in common so just # putting them in fecc/defines.h is not enough: HOSTDEFS += -DIN_GCC -DHAVE_CONFIG_H ifeq ($(BUILD_TARGET), IA64) HOSTDEFS += -DTARGET_NAME=\"ia64-linux\" endif ifeq ($(BUILD_TARGET), IA32) HOSTDEFS += -DTARGET_NAME=\"i686-pc-linux-gnu\" endif ifeq ($(BUILD_TARGET), MIPS) HOSTDEFS += -DTARGET_NAME=\"mips-sgi-irix6\" endif HOSTDEFS += -DLONGLONG HOSTDEFS += -DFRONT_END HOSTDEFS += -DUSE_DECL_SRCPOS HOSTDEFS += -DFRONT_END_C HOSTDEFS += -DCFE -DCIL HOSTDEFS += -DDO_IL_LOWERING=0 HOSTDEFS += -DNO_USR_INCLUDE=TRUE HOSTDEFS += -DAUTOMATIC_TEMPLATE_INSTANTIATION=0 HOSTDEFS += -DINSTANTIATION_BY_IMPLICIT_INCLUSION=0 HOSTDEFS += -DBACK_END_IS_C_GEN_BE=0 HOSTDEFS += -DMONGOOSE_CIF HOSTDEFS += -DSGI_RAG_BACKEND HOSTDEFS += -DSGI_MONGOOSE HOSTDEFS += -DCOMPILE_UPC HOSTDEFS += -DHANDLE_PRAGMA_WEAK ifneq ($(BUILD_COMPILER), SGI) HOSTDEFS += -DMIPSEL endif ifeq ($(BUILD_VARIANT), DEBUG) HOSTDEFS += -DIs_True_On HOSTDEFS += -DInsist_On HOSTDEFS += -DDEBUG=1 HOSTDEFS += -DCHECKING=1 #HOSTDEFS += -DWFE_DEBUG else HOSTDEFS += -DNDEBUG HOSTDEFS += -DCHECKING=0 #HOSTDEFS += -DWFE_DEBUG endif ifeq ($(BUILD_OS), LINUX) TARGDEFS = -D__MIPS_AND_IA64_ELF_H endif #---------------------------------------------------------------------- # List of directories, and source files of interest #---------------------------------------------------------------------- FE_DIR = $(BUILD_BASE) COMMON_COM_DIR = $(BUILD_TOT)/common/com COMMON_COM_TARG_DIR = $(BUILD_TOT)/common/com/$(BUILD_TARGET_DIR) COMMON_TARG_INFO_ACCESS_DIR = $(BUILD_TOT)/common/targ_info/access COMMON_UTIL_DIR = $(BUILD_TOT)/common/util COMMON_UTIL_TARG_DIR = $(BUILD_TOT)/common/util/$(BUILD_TARGET_DIR) INCLUDE_DIR = $(BUILD_TOT)/include ifeq ($(BUILD_OS), LINUX) INCLUDE_DIR += $(BUILD_AREA)/include endif GNU_DIR = $(BUILD_BASE)/gnu GNU_CONFIG_DIR = $(BUILD_BASE)/gnu/config GNU_COMMON_DIR = $(BUILD_TOT)/gnu_common GNU_TARG_DIR = $(GNU_DIR)/$(BUILD_TARGET_DIR) GNU_CONFIG_TARG_DIR = $(GNU_CONFIG_DIR)/$(BUILD_TARGET_DIR) ifeq ($(BUILD_TARGET), IA32) GNU_CONFIG_TARG_DIR = $(GNU_CONFIG_DIR)/i386 endif ifeq ($(BUILD_TARGET), MIPS) GNU_CONFIG_TARG_DIR = $(GNU_CONFIG_DIR)/mips endif TARG_COMUTIL_DIR = $(TARGDIR)/libcomutil TARG_CMPLRS_DIR = $(TARGDIR)/libcmplrs TARG_LIBIBERTY_DIR = $(TARGDIR)/libiberty TARG_GNU_DIR = $(TARGDIR)/gccfe/gnu # These are the directories in which to look for source files. SRC_DIRS = \ $(FE_DIR) \ $(COMMON_COM_DIR) \ $(COMMON_COM_TARG_DIR)\ $(COMMON_UTIL_DIR) \ $(COMMON_UTIL_TARG_DIR)\ $(COMMON_TARG_INFO_ACCESS_DIR) INC_DIRS = \ $(INCLUDE_DIR) \ $(COMMON_COM_DIR) \ $(COMMON_COM_TARG_DIR)\ $(COMMON_UTIL_DIR) \ $(COMMON_UTIL_TARG_DIR)\ $(COMMON_TARG_INFO_ACCESS_DIR) \ $(FE_DIR) \ $(GNU_DIR) \ $(GNU_TARG_DIR) \ $(GNU_CONFIG_DIR) \ $(GNU_CONFIG_TARG_DIR) \ $(GNU_COMMON_DIR)/include #---------------------------------------------------------------------- # List of source files. Please keep them in alphabetical order. #---------------------------------------------------------------------- FE_C_SRCS = \ c_int_model.c \ main.c FE_CXX_SRCS = \ rt_symtab.cxx \ tree_symtab.cxx \ wfe_decl.cxx \ wfe_dst.cxx \ wfe_expr.cxx \ wfe_misc.cxx \ wfe_stmt.cxx \ shared-alloc.cxx COMMON_COM_CXX_SRCS = \ config.cxx \ const.cxx \ controls.cxx \ dwarf_DST.cxx \ dwarf_DST_dump.cxx \ dwarf_DST_mem.cxx \ dwarf_DST_producer.cxx \ err_host.cxx \ glob.cxx \ ir_bcom.cxx \ ir_bwrite.cxx \ ir_reader.cxx \ irbdata.cxx \ mtypes.cxx \ opcode.cxx \ opcode_core.cxx \ pu_info.cxx \ strtab.cxx \ symtab.cxx \ symtab_verify.cxx \ ttype.cxx \ upc_symtab_utils.cxx \ upc_mangle_name.cxx \ wn.cxx \ wn_map.cxx \ wn_pragmas.cxx \ wn_simp.cxx \ wn_util.cxx \ wutil.cxx \ xstats.cxx COMMON_COM_TARG_SRCS = \ config_host.c \ config_platform.c COMMON_COM_TARG_CXX_SRCS = \ config_targ.cxx \ config_elf_targ.cxx \ targ_const.cxx \ targ_sim.cxx FRONT_END_C_SRCS = \ $(COMMON_COM_SRCS) \ $(COMMON_COM_TARG_SRCS) \ $(FE_C_SRCS) FRONT_END_CXX_SRCS = \ $(COMMON_COM_CXX_SRCS) \ $(COMMON_COM_TARG_CXX_SRCS) \ $(FE_CXX_SRCS) FRONT_END_C_OBJS = $(FRONT_END_C_SRCS:T:.c=.o) FRONT_END_CXX_OBJS = $(FRONT_END_CXX_SRCS:T:.cxx=.o) FRONT_END_OBJS = $(FRONT_END_C_OBJS) $(FRONT_END_CXX_OBJS) CFILES = $(FRONT_END_C_SRCS) CXXFILES = $(FRONT_END_CXX_SRCS) VPATH = $(SRC_DIRS) LCOPTS = $(STD_COMPILE_OPTS) LCDEFS = $(HOSTDEFS) $(TARGDEFS) LCINCS = $(addprefix -I, $(INC_DIRS)) LC++OPTS = $(STD_COMPILE_OPTS) LC++DEFS = $(HOSTDEFS) $(TARGDEFS) LC++INCS = $(addprefix -I, $(INC_DIRS)) ifeq ($(BUILD_COMPILER), GNU) #LCOPTS += -fwritable-strings #LC++OPTS += -fwritable-strings endif # setup stuff to build shared or non-shared GLDOPTS = $(STD_LOAD_OPTS) LDIRT = #+---------------------------------------------------------------------- # Extra Rules #---------------------------------------------------------------------- .c.E: $(CCF) -MDupdate /dev/null -E ${<} | sed -e '/^ *$$/d' >${*F}.E #------------------------------------------------------------ # Define target #------------------------------------------------------------ TARGETS = gfec #---------------------------------------------------------------------- # Variables describing additional sources, objects, and libraries #---------------------------------------------------------------------- COMUTIL_OBJS = $(TARG_COMUTIL_DIR)/libcomutil.a CMPLRS_OBJS = $(TARG_CMPLRS_DIR)/libcmplrs.a LIBIBERTY_OBJS = $(TARG_LIBIBERTY_DIR)/libiberty.a GNU_OBJS = $(TARG_GNU_DIR)/libgfec.a LLDLIBS = $(GNU_OBJS) $(COMUTIL_OBJS) $(LIBIBERTY_OBJS) ifeq ($(BUILD_OS), IRIX) LLDLIBS += -lm -lcmplrs -Bstatic -lffio -Bdynamic else LLDLIBS += -lm $(CMPLRS_OBJS) ifeq ($(BUILD_OS), OSX) # bug 1362: required for acosf on XCode 1.5 LLDLIBS += -lmx endif ifeq ($(BUILD_HOST), IA64) ifeq ($(BUILD_COMPILER), SGI) LDFLAGS += -Wl,-relax endif endif endif default: first depends $(TARGETS) last #---------------------------------------------------------------------- # The commands in this section are done BEFORE any other target is # built. #---------------------------------------------------------------------- first: cd $(TARG_GNU_DIR) && $(MAKE) cd $(TARG_CMPLRS_DIR) && $(MAKE) cd $(TARG_COMUTIL_DIR) && $(MAKE) 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) -F $(STD_MONGOOSE_LOC) $(TARGETS) endif gfec : $(OBJECTS) $(GNU_OBJS) $(CXXF) -o gfec $(OBJECTS) $(LDFLAGS) #---------------------------------------------------------------------- # Include the usual commonrules #---------------------------------------------------------------------- BUILD_SUBDIRS = gnu include $(COMMONRULES) # 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) #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 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 \ -DCOMPILE_UPC $(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