# # # 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 whirl2c # #---------------------------------------------------------------------- # Information about Makefile # # This Makefile is used to build the 32 bit host/target version of # whirl2c # # * 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 #---------------------------------------------------------------------- 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 += -Dlonglong # need to define _LONGLONG and _SVR4_SOURCE to allow compilation with -ansi. HOSTDEFS += -D_LONGLONG -D_SVR4_SOURCE # need to define BUILD_WHIRL2C to get appropriate code from common sources HOSTDEFS += -DBACKEND -DMONGOOSE_BE -DBUILD_WHIRL2C -DCOMPILE_UPC ifeq ($(BUILD_OPTIMIZE), DEBUG) HOSTDEFS += -DIs_True_On HOSTDEFS += -DInsist_On endif HOSTDEFS += -DSIZEOF_INT=4 #---------------------------------------------------------------------- # List of directories, and source files of interest #---------------------------------------------------------------------- BE_DIR = $(BUILD_TOT)/be BE_MIPS_DIR = $(BE_DIR)/MIPS BE_BE_DIR = $(BE_DIR)/be BE_CG_DIR = $(BE_DIR)/cg BE_LNO_DIR = $(BE_DIR)/lno BE_COM_DIR = $(BE_DIR)/com BE_OPT_DIR = $(BE_DIR)/opt BE_REGION_DIR = $(BE_DIR)/region BE_WHIRL2C_DIR = $(BE_DIR)/whirl2c BE_WHIRL2F_DIR = $(BE_DIR)/whirl2f COMMON_DIR = $(BUILD_TOT)/common COMMON_COM_DIR = $(COMMON_DIR)/com #COMMON_LIB_DIR = $(COMMON_DIR)/lib COMMON_UTIL_DIR = $(COMMON_DIR)/util INCLUDE_DIR = $(ROOT)/usr/include IPA_COM_DIR = $(BUILD_TOT)/ipa/common/ LIBCOMUTIL_DIR = $(BUILD_TOT)/libcomutil TARG_BE_DIR = $(TARGDIR)/be COMMON_COM_TARGET_DIR = $(COMMON_COM_DIR)/$(BUILD_TARGET_DIR) COMMON_UTIL_TARGET_DIR = $(COMMON_UTIL_DIR)/$(BUILD_TARGET_DIR) TARG_COMUTIL_DIR = $(TARGDIR)/libcomutil # These are the directories in which to look for source files. SRC_DIRS = \ $(BE_COM_DIR) \ $(BE_REGION_DIR) \ $(BE_WHIRL2C_DIR) HEADER_DIRS = \ $(SRC_DIRS) \ $(COMMON_COM_DIR) \ $(COMMON_COM_TARGET_DIR)\ $(COMMON_LIB_DIR) \ $(COMMON_UTIL_DIR) \ $(COMMON_UTIL_TARGET_DIR)\ $(TARG_BE_DIR) \ $(BE_DIR) \ $(BE_BE_DIR) \ $(BE_CG_DIR) \ $(BE_OPT_DIR) \ $(BE_LNO_DIR) #---------------------------------------------------------------------- # List of source files. Please keep them in alphabetical order. #---------------------------------------------------------------------- WHIRL2C_CXX_SRCS = \ init2c.cxx \ PUinfo.cxx \ st2c.cxx \ stab_attr.cxx \ tcon2c.cxx \ token_buffer.cxx \ ty2c.cxx \ w2c_driver.cxx \ w2cf_parentize.cxx \ w2cf_symtab.cxx \ whirl2c_common.cxx \ wn_attr.cxx \ wn2c.cxx \ wn2c_pragma.cxx \ init.cxx \ WHIRL2C_DRIVER_SRCS = \ whirl2c.c \ WHIRL2C_MAIN_SRCS = \ whirl2c_main.cxx \ WHIRL2C_CXX_OBJS = $(WHIRL2C_CXX_SRCS:.cxx=.o) WHIRL2C_DRIVER_OBJS = $(WHIRL2C_DRIVER_SRCS:.c=.o) WHIRL2C_MAIN_OBJS = $(WHIRL2C_MAIN_SRCS:.cxx=.o) WHIRL2C_DSOS = be.so VPATH = $(SRC_DIRS) #LCOPTS = $(STD_COMPILE_OPTS) -fullwarn 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 LC++OPTS = $(STD_COMPILE_OPTS) LC++DEFS = $(HOSTDEFS) $(TARGDEFS) LC++INCS = $(LCINCS) LASDEFS = $(HOSTDEFS) $(TARGDEFS) LASINCS = $(LCINCS) LASOPTS = $(STD_COMPILE_OPTS) # setup stuff to build shared or non-shared GLDOPTS = $(STD_LOAD_OPTS) $(LD_QUICKSTART_INFO) #DSOSTARTOPT = -update_registry $(TARGDIR)/be/so_locations -no_unresolved #DSOSTARTOPT = -no_unresolved ifeq ($(BUILD_OS), IRIX) DSOSTARTOPT = -check_registry $(TARGDIR)/be/so_locations -no_unresolved else DSOSTARTOPT = endif DSOSTARTOPT_32 = -32 $(DSOSTARTOPT) DSOSTARTOPT_N32 = -n32 $(DSOSTARTOPT) ifeq ($(BUILD_OS), TRU64) #This fixes a linker error about missing gxx_personality LDFLAGS += -lstdc++ endif LD_QUICKSTART_INFO= # To ensure 32 bits linking of whirl2c.so: #LDFLAGS += -32 #---------------------------------------------------------------------- # File containing the list of symbols exported outside of whirl2c.so #---------------------------------------------------------------------- ifeq ($(BUILD_COMPILER), EDG) EXPORT_LIST = -exports_file $(BE_WHIRL2C_DIR)/Exported else EXPORT_LIST = endif #---------------------------------------------------------------------- # Define target #---------------------------------------------------------------------- TARGETS = whirl2c.so whirl2c_be whirl2c gen-include-list ifdef LOCAL_TARG_INFO_DIR TARG_TARG_INFO_DIR = $(TARGDIR)/$(LOCAL_TARG_INFO_DIR) else TARG_TARG_INFO_DIR = $(TARGDIR)/targ_info endif ifeq ($(BUILD_TARGET), MIPS) TARGET_SO = r10000.so endif ifeq ($(BUILD_TARGET), IA64) TARGET_SO = itanium.so endif ifeq ($(BUILD_TARGET), IA32) TARGET_SO = pentium.so endif #---------------------------------------------------------------------- # Variables describing additional sources, objects, and libraries #---------------------------------------------------------------------- ifeq ($(BUILD_COMPILER), EDG) LLDLIBS = -none -lc endif default: first depends $(TARGETS) last #---------------------------------------------------------------------- # The commands in this section are done BEFORE any other target is # built. #---------------------------------------------------------------------- first: cd $(TARGDIR)/be && $(MAKE) ifeq ($(BUILD_OS), LINUX) cd $(BUILD_AREA)/include && $(MAKE) if ! test -e $(TARGET_SO); then ln -sf $(TARG_TARG_INFO_DIR)/$(TARGET_SO) .; fi endif include $(BUILD_TOT)/Makeinclude #---------------------------------------------------------------------- # The commands in this section are done AFTER every other target is # built. #---------------------------------------------------------------------- last : make_deps #---------------------------------------------------------------------- # Build 'whirl2c.so', 'whirl2c_be' and 'whirl2c' # # These rules build the 'whirl2c.so" by default, and can install # it in the $(STD_MONGOOSE_LOC) directory. #---------------------------------------------------------------------- ifeq ($(BUILD_TYPE), SHARED) install:: default $(STD_INSTALL) $(STD_INSTALL_EXEC_MASK) -F $(STD_MONGOOSE_LOC) whirl2c.so whirl2c $(STD_INSTALL) -lns be -F $(STD_MONGOOSE_LOC) whirl2c_be else install:: default $(STD_INSTALL) $(STD_INSTALL_EXEC_MASK) -F $(STD_MONGOOSE_LOC) whirl2c.so whirl2c $(STD_INSTALL) -lns be -F $(STD_MONGOOSE_LOC) whirl2c_be endif # extra files to be removed with make clobber LDIRT += be be.so whirl2c_dbg $(TARGET_SO) ifeq ($(BUILD_OS), SOLARIS) ifeq ($(BUILD_COMPILER), VENDOR) STD_DSO_LOADOPTS += -G else STD_DSO_LOADOPTS += -shared endif else STD_DSO_LOADOPTS += -shared endif ifeq ($(BUILD_OS), OSX) whirl2c.so: $(WHIRL2C_CXX_OBJS) $(BE_WHIRL2C_DIR)/Exported \ $(WHIRL2C_DSOS) $(BE_BE_DIR)/so_locations $(CXX) -dynamiclib -flat_namespace -undefined suppress -single_module $(STD_DSO_LOADOPTS) -o $@ $(EXPORT_LIST) \ $(WHIRL2C_CXX_OBJS) $(WHIRL2C_DSOS) $(LLDLIBS) else whirl2c.so: $(WHIRL2C_CXX_OBJS) $(BE_WHIRL2C_DIR)/Exported \ $(WHIRL2C_DSOS) $(BE_BE_DIR)/so_locations $(CXX) $(STD_DSO_LOADOPTS) -o $@ $(EXPORT_LIST) \ $(WHIRL2C_CXX_OBJS) $(WHIRL2C_DSOS) $(LLDLIBS) endif # Make the back-end executable, then create a link to it named # "whirl2c_be". Make a driver "whirl2c" which MUST reside in the # same directory as whirl2c_be and whirl2c.so. Need to set # LD_LIBRARY_PATH to the location of the dso's to directly execute # "whirl2c_be". # whirl2c_be: whirl2c.so (cd $(TARGDIR)/be; \ $(MAKE) BE_OPT_DIR='$(BE_OPT_DIR)' \ LINK_DSO='$(LINK_DSO)' \ LINK_DSO_OPTS='$(LINK_DSO_OPTS) -L.' \ be) if test ! -r whirl2c_be; then ln -s $(TARGDIR)/be/be whirl2c_be ; fi #Use CXX to link, otherwise we get an error under gcc3.3, #for using the wrong library whirl2c: whirl2c.so whirl2c_be $(WHIRL2C_MAIN_OBJS) $(CXX) -o whirl2c $(WHIRL2C_MAIN_OBJS) $(LDFLAGS) be.so: if test ! -r be.so; then ln -s $(TARGDIR)/be/be.so .; fi be: if test ! -r be; then ln -s $(TARGDIR)/be/be .; fi # For debugging, set LD_LIBRARY_PATH manually and invoke whirl2c_dbg # directly. # whirl2c_dbg: whirl2c.so $(WHIRL2C_DRIVER_OBJS) $(WHIRL2C_DSOS) $(LD) -o $@ $(WHIRL2C_DRIVER_OBJS) $(LDFLAGS) \ whirl2c.so $(WHIRL2C_DSOS) gen-include-list: gen-include-list.c $(CC) -o gen-include-list ../../be/whirl2c/gen-include-list.c #---------------------------------------------------------------------- # Include the usual commonrules #---------------------------------------------------------------------- include $(COMMONRULES) #---------------------------------------------------------------------- # Special case rules for files that want to be individualistic #---------------------------------------------------------------------- #SKIP bedriver.o: bedriver.c #SKIP $(CCF) -xansi -c $< # 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 LD_QUICKSTART_INFO= 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 LD_QUICKSTART_INFO= endif