makedefs 6.21 KB
ifndef CPU
CPU = X86
endif

################################################################
# Tool definitions
################################################################

AR      = ar

# Change the "CC" variables as needed for your platform. We 
# currently choose "cc" if you are on an SGI machine and "gcc"
# otherwise.

CC      = gcc
ifeq ($(CPU),SGI)
CC      = cc
endif
ifeq ($(CPU),SGIN32)
CC      = cc
endif
ifeq ($(CPU),SGIM4)
CC      = cc
endif

INSTALL = install
LD      = $(CC)
SHELL   = /bin/sh
FORMAT  = echo
#FORMAT  = $(SIMTOOLS)/apps/scripts/format.prl
JOBS    = 4 
#MAKE    = gmake -j $(JOBS)

# Comment this out to get the normal make output
.SILENT:

################################################################
# Flags to be used by all
################################################################
#USE_FLASHLITE = Yes

# 
# Do we wish to use the Simos External Symbol Library, instead
# of Simos's internal symbols (is sometimes faster and supports 
# more targets, but adds 2-3Mb to the executable)
#USE_SESL = Yes

#
# Do we need only to support 32bit mips apps? 
# Currently is only the default on 64bit machines like ALPHA

ifdef SOLO
USE_FLASHLITE = Yes
NO_EMBRA = True
SOLOCFLAGS   = -DSOLO -DMIPSY_DEBUG -DDATA_HANDLING
SOLOCFLAGS  += -DDEBUG_SYSCALL -DANL_DEBUG -Xcpluscomm
#SOLOCFLAGS += -DDEBUG_DATA -DDEBUG_DATA_VERBOSE
#SOLOFLAGS  += -DDEBUG_DATA_CHECK -DDEBUG_SYSCALL
endif

ifdef FLASHPOINT
SOLOCFLAGS += -DFLASHPOINT
endif
# Compile time switches for simos. Currently we support:
#      CPUSIM = (mipsy|mxs)  - Compile time selection between mipsy and mxs.
#      USE_FLASHLITE = Yes   - Linked with the flashlite memsys simulator.
#      USE_TCL8 = TRUE    - Use tcl8.0 with bytecode compiler
#                              (default is tcl7.6, interpreted)

ifndef CPUSIM
# Default for CPUSIM is mipsy. Although it is possible to run in mipsy
# with (CPUSIM = mxs) it is slower. 
#CPUSIM = mxs
CPUSIM = mipsy
endif

#
# Use tcl8.0 instead of 7.6
#
#USE_TCL8 = TRUE

# NOTE: On the SGIs, profiling only works with non-shared versions
ifeq ($(CPU),SGI)
#PROFILING = TRUE
#NON_SHARED = -non_shared
else
NON_SHARED = 
endif

# on the SGIs, flashlite only works with nonshared compilation.
# on the SUNs, it works only with shared compilation.
# shared is the default, so we change to nonshared on SGIs.
ifdef USE_FLASHLITE
ifeq ($(CPU),SGI)
NON_SHARED = -non_shared
endif
endif

#################################################################
# Set up the directory where libraries will be linked from
#################################################################
ifndef LIBDIRBASE
#LIBDIRBASE = $(SIMOS_DIR)/build-files/lib
LIBDIRBASE = $(SIMOS_DIR)/BUILD
endif
ifdef NON_SHARED
DIRSUFFIX = non-shared
else
DIRSUFFIX = shared
endif
ifeq ($(CPU),SUN)
LIBDIR = $(LIBDIRBASE)/sparc-$(DIRSUFFIX)
endif
ifeq ($(CPU),SGI)
LIBDIR = $(LIBDIRBASE)/sgi-$(DIRSUFFIX)
endif
ifeq ($(CPU),SGIN32)
LIBDIR = $(LIBDIRBASE)/sgin32-$(DIRSUFFIX)
endif
ifeq ($(CPU),SGIM4)
# Note: use the same libraries as n32
LIBDIR = $(LIBDIRBASE)/sgin32-$(DIRSUFFIX)
endif
ifeq ($(CPU),ALPHA)
LIBDIR = $(LIBDIRBASE)/alpha-$(DIRSUFFIX)
endif 
ifeq ($(CPU),X86)
LIBDIR = $(LIBDIRBASE)/x86-$(DIRSUFFIX)
endif 

################################################################
# Defines 
################################################################
ifdef PROFILING
D1 = -DPROFILING -G 0
endif

ifeq ($(CPU),SUN)
NO_EMBRA = True
NO_DCG = True
endif
ifeq ($(CPU),ALPHA)
NO_EMBRA = True
endif
ifeq ($(CPU),X86)
NO_EMBRA = True
endif

ifeq ($(CPU),SGI)
#MISC_DEFINES += -DPRINT_INSTRUCTIONS
endif 
ifdef NO_EMBRA
MISC_DEFINES += -DNO_EMBRA
endif

ifdef TCLCOMPILER
MISC_DEFINES += -DTCLCOMPILER
endif

ifdef USE_FLASHLITE
MISC_DEFINES += -DDATA_HANDLING
endif

ifdef USE_VISTA_SDF
MISC_DEFINES += -DUSE_VISTA_SDF=1
endif

ifdef TRACING
MISC_DEFINES += -DTRACING=1
endif

#EJS for linux
#MISC_DEFINES += -DBOOT_LINUX

#BENW - and for NT
#MISC_DEFINES += -DBOOT_NT

ifdef DIGITAL_TRACE
MISC_DEFINES += -DDIGITAL_TRACE=1
endif



################################################################
# Figure out which architecture we want to simulate
################################################################
ifeq ($(SIM_ARCH),X86)
ARCH_DEFINE = -DSIM_X86
MISC_DEFINES += -DDATA_HANDLING
# Some linux platforms don't define this! 
MISC_DEFINES += -DLITTLE_ENDIAN
endif
ifeq ($(SIM_ARCH),MIPS32)
ARCH_DEFINE = -DSIM_MIPS32
endif
ifeq ($(SIM_ARCH),MIPS64)
ARCH_DEFINE = -DSIM_MIPS64
endif
ifeq ($(SIM_ARCH),ALPHA)
ARCH_DEFINE = -DSIM_ALPHA
endif

MISC_DEFINES   += $(ARCH_DEFINE)


ifeq ($(SIM_ARCH),MIPS64)
#MISC_DEFINES    += -DIRIX6_4
#MISC_DEFINES    += -DSIM_ORIGIN
endif

#MISC_DEFINES  += -DDEBUG_INTR 

GLOBAL_DEFS     = $(D1) $(D2) $(D3) $(D4) $(MISC_DEFINES)

GLOBAL_INCS     = -I$(SIMTOOLS)/common/misc -I$(SIMTOOLS)/common/stats \
		  -I$(SIMTOOLS)/common/machine \
                  -I$(SIMTOOLS)/common/tcl \
                  -I$(SIMTOOLS)/devices/controllers

ifdef DIGITAL_TRACE
GLOBAL_INCS += -I$(DIGITAL_TRACE_DIR)
endif

BINARY_TYPE     =  $(NON_SHARED)
OPTIMIZATION    = -g3 -O2  
GCC_OPTIMIZATION = -g3 -O2

GCC_WARNINGS = -Wall  
WARNINGS = -W -Wimplicit -Wreturn-type -Wunused -Wswitch -Wcomment      \
           -Wuninitialized -Wparentheses 

#DWARF2 = yes
ifdef DWARF2
GLOBAL_DEFS    += -DDWARF2
endif

ifeq ($(CPU),SGIN32)
# 1172="Parameter not used", 1209="while(1)"
CC_WARNINGS     = -fullwarn -woff 1174,1209,1048
#OPTIMIZATION    = -g3 -O2 
OPTIMIZATION    = -g
CC_FLAGS        = $(CC_WARNINGS) $(OPTIMIZATION) $(BINARY_TYPE) -n32 -mips3
GLOBAL_ASFLAGS  = $(OPTIMIZATION) $(BINARY_TYPE) -n32 -mips3
else
ifeq ($(CPU),SGIM4)
OPTIMIZATION    = -O3
#OPTIMIZATION    = -g
CC_WARNINGS     = -fullwarn -woff 1174,1209,1048
CC_FLAGS        = $(CC_WARNINGS) $(OPTIMIZATION) $(BINARY_TYPE) -n32 -mips4
GLOBAL_ASFLAGS  = $(OPTIMIZATION) $(BINARY_TYPE) -64 -mips4
else
CC_WARNINGS     = -wlint,-vf -woff 813,814,820,821,822,826,827,847
CC_FLAGS        = $(CC_WARNINGS) $(OPTIMIZATION) $(BINARY_TYPE) -mips2 
GLOBAL_ASFLAGS  = $(OPTIMIZATION) $(BINARY_TYPE) -acpp -mips2 
endif
endif

GCC_FLAGS       = $(GCC_WARNINGS) $(GCC_OPTIMIZATION) $(BINARY_TYPE)


ifeq ($(CC),cc)
GLOBAL_CFLAGS   = $(CC_FLAGS)
else
GLOBAL_CFLAGS   = $(GCC_FLAGS)
endif

GLOBAL_LDFLAGS  = $(NON_SHARED) 

ifdef PROFILING
GLOBAL_LDFLAGS += -p
endif