Makefile 4.86 KB
#!gmake 

#
# DO NOT "make solo", or it will not update the dependency info!
#


ifndef SIMTOOLS
SIMTOOLS = ../..
endif

SOLO       = yes
NON_SHARED = -non_shared

include $(SIMTOOLS)/makedefs

################################################################
# Include Files
################################################################
ifdef FLASHPOINT
INCS  = -I$(SIMTOOLS)/cpus/simos -I$(SIMTOOLS)/cpus/mipsy \
        -I$(SIMTOOLS)/cpus/shared -I$(SIMTOOLS)/caches/2Level -I$(SIMDIR) \
        -I$(SIMTOOLS)/memsystems/flashlite -I$(MEMSPY_DIR) $(GLOBAL_INCS) 
else
INCS  = -I$(SIMTOOLS)/cpus/simos -I$(SIMTOOLS)/cpus/mipsy \
        -I$(SIMTOOLS)/cpus/shared -I$(SIMTOOLS)/caches/2Level -I$(SIMDIR) \
        -I$(SIMTOOLS)/memsystems/flashlite $(GLOBAL_INCS) 
endif

################################################################
# Defines
################################################################

# These start points work fine, but don't allow enough space for big runs
#TEXT_START  = 50004000
#DATA_START  = 51000000

# These start points leave an additional 256MB of space for address-hungry
# flashlite runs of 64 procs and up..
TEXT_START  = 40004000
DATA_START  = 41000000

DEFS        = -DSOLO -DSOLO_TEXT_START=0x$(TEXT_START) 
ifdef FLASHPOINT
DEFS	   += -DFLASHPOINT
INCS	   += -I$(MEMSPY_DIR)
endif

GLOBAL_DEFS += -DSIM_MIPS32
ASFLAGS	    = $(GLOBAL_ASFLAGS) $(GLOBAL_DEFS) 
CFLAGS      = $(GLOBAL_CFLAGS) $(GLOBAL_DEFS) $(SOLOCFLAGS) -Xcpluscomm 
ifdef USE_FLASHLITE
CFLAGS   += -DUSE_FLASHLITE 
endif

CC_OPTS      = $(CFLAGS) $(INCS) $(DEFS)
AS_OPTS      = $(ASFLAGS) $(INCS) $(DEFS)

################################################################
# Source files needed during compilation
################################################################
C_TARGETS    = solo_main.o solo_anl.o solo_cp0.o solo_extras.o \
        syscall.o page.o solo_stubs.o
ASM_TARGETS  = sqrt.o solo_asms.o
TARGETS      = $(C_TARGETS) $(ASM_TARGETS)

################################################################
# Things that must be linked with solo mipsy
################################################################
MIPSYLIB    = $(SIMTOOLS)/cpus/mipsy/SOLO/mipsylib.a
CACHELIBS   = $(SIMTOOLS)/caches/2Level/SOLO/2levellib.a
MEMSYSLIBS  = $(SIMTOOLS)/memsystems/flashlite/SOLO/flashlitelib.a
MEMSYSLIBS += $(SIMTOOLS)/memsystems/misc/SOLO/memsysmisc.a
SHAREDLIBS  = $(SIMTOOLS)/common/misc/SOLO/misc.a
SHAREDLIBS += $(SIMTOOLS)/common/tcl/SOLO/tcl.a
SHAREDLIBS += $(SIMTOOLS)/common/symbols/SOLO/symbols.a
SHAREDLIBS += $(SIMTOOLS)/common/stats/SOLO/stats.a
ifdef FLASHPOINT
FPLIBS      = $(MEMSPY_DIR)/memspy_simulator.a
endif

ifdef NON_SHARED
LIB_DIR       = /sim/s4/SimOS/build-files/lib/sgi-non-shared
else
LIB_DIR       = /sim/s4/SimOS/build-files/lib/sgi-shared
endif
LIBTCL        = $(LIB_DIR)/libtcl7.6.a 

#ifdef USE_FLASHLITE
MEMSYSLIBS +=  $(SIMDIR)/SGI/flashlite.a
MEMSYSLIBS += $(SIMDIR)/protocols/dyn_ptr/SGI/protocolLib.a
LIBGCC   = /morse/m1/simos/lib/libgcc2.7.2.a
#endif

LDFLAGS = $(GLOBAL_LDFLAGS) -T $(TEXT_START)  -D $(DATA_START)
LIBS    = $(MIPSYLIB) $(CACHELIBS) $(MEMSYSLIBS) $(SHAREDLIBS) $(LIBTCL) $(LIBGCC) $(FPLIBS)
ifdef PROFILING
LIBS += -lprof
endif


.PHONY: warn deps

default: warn
	@$(MAKE) deps
	@$(MAKE) INCLUDE_DEPS=1 all

all: solo solo.a supportlib.a 

# DO NOT "make solo", or it will not spew the neat debug output

solo: $(TARGETS) $(LIBS) solo.a supportlib.a
	@echo "Linking solo..."
	 $(LD) $(LDFLAGS) -o $@ $(TARGETS) $(LIBS) -lmld -lm
	@echo "done."

solo.a: $(TARGETS)
	@echo "Building solo library (solo.a) for golden copies..."
	@$(AR) cru solo.a $(TARGETS)

warn: 
	@echo ""
	@echo "Making SOLO"
	@echo "***********"
	@echo "NONSHARED : $(NON_SHARED)"
	@echo "  DEFS :   `$(FORMAT) $(DEFS)`"
	@echo "  CFLAGS : `$(FORMAT) $(CFLAGS)`"
	@echo "  LDFLAGS : `$(FORMAT) $(LDFLAGS)`"
	@echo "  LIBS : `$(FORMAT) $(LIBS)`"
	@echo ""

$(C_TARGETS): %.o: %.c %.d
	@echo "Compiling  $(<F)"
	$(CC) $(CC_OPTS) -c $*.c 

$(ASM_TARGETS): %.o: %.s
	echo "Assembling $(<F)"
	$(AS) $(AS_OPTS) -c $< -o $@

# NOTE: Supportlib MUST be created with asm_support.o last, so that
#       the libcStart symbol is the last thing in the library!
supportlib.a: asm_support.s c_support.c c.m4.mipsy solo_interface.h
	@echo "Making application supportlib.a..."
	$(AS) -O2 -non_shared -mips2 -32 -o asm_support.o asm_support.s
	$(CC) -O2 -non_shared $(DEFS) -c c_support.c
	@\rm -f supportlib.a
	ld -r -o supportlib.a c_support.o asm_support.o 

clean:
	@echo "Making solo clean..."
	rm -rf core $(TARGETS) solo solo.a *.d asm_support.o c_support.o supportlib.a 

clobber:
	@echo "Making solo clobbered..."
	rm -rf core $(TARGETS) solo solo.a *.d asm_support.o c_support.o supportlib.a 

deps: ${TARGETS:.o=.d}

%.d: %.c
	@echo "Finding dependencies of $(<F)"
	@$(CC) -M $(CC_OPTS) $< > $@

%.d: %.s
	@echo "Finding dependencies of $(<F)"
	@$(CC) -M $(CC_OPTS) $< > $@

ifdef INCLUDE_DEPS
include ${TARGETS:.o=.d}
endif