Makefile.ALL 2.69 KB
#!gmake 

ifndef SIMTOOLS
SIMTOOLS = ../../..
endif

include $(SIMTOOLS)/makedefs

TARGET = mipsylib.a

VPATH = ..

#################################################################
# INCLUDE DIRECTORIES 
#################################################################
ID1 = -I$(SIMTOOLS)/cpus/simos
ID2 = -I$(SIMTOOLS)/cpus/shared

# REMOVE THIS 
ID3 = -I$(SIMTOOLS)/caches -I$(SIMTOOLS)/caches/2Level

ifdef USE_FLASHLITE
ID4 = -I$(SIMDIR) -I$(SIMTOOLS)/memsystems/flashlite
endif
ifdef SOLO
ID5    = -I$(SIMTOOLS)/cpus/solo
endif
ifeq ($(CPUSIM),mxs)
ID6 = -I$(SIMTOOLS)/cpus/mxs
endif

INCS  = $(ID1) $(ID2) $(ID3) $(ID4) $(ID5) $(ID6) $(GLOBAL_INCS)

ifdef FLASHPOINT
INCS += -I$(MEMSPY_DIR) -I$(SIMDIR)
endif

#################################################################
# DEFINES
#################################################################

DEF1 = # -DNO_CACHES
#DEF2  = -DPRINT_INSTRUCTIONS
ifdef TRACING
DEF3  = -DTRACING
endif
DEF4 = 
ifdef USE_FLASHLITE
DEF4  = -DUSE_FLASHLITE
endif
ifdef SOLO
DEF5  = $(SOLOCFLAGS)
endif

ifeq ($(CPUSIM),mxs)
DEF6 = -DMIPSY_MXS
endif
 
DEFS = $(DEF1) $(DEF2) $(DEF3) $(DEF4) $(DEF5) $(DEF6) $(GLOBAL_DEFS)

ifdef FLASHPOINT
DEFS += -DFLASHPOINT
endif
#################################################################
# C and ASM FLAGS
#################################################################

CFLAGS       = $(GLOBAL_CFLAGS) 
CC_OPTS      = $(CFLAGS) $(INCS) $(DEFS)
ifeq ($(CPU),SGI)
CC_OPTS += -Olimit 2200
endif
ifeq ($(CPU),SGIN32)
CC_OPTS += -OPT:Olimit=4000
endif
ifeq ($(CPU),SGIM4)
CC_OPTS += -OPT:Olimit=4000
endif

#################################################################
# TARGETS
#################################################################
C_TARGETS       = cpu.o debug.o fpu.o stats.o dash_prefetch.o\
                cpu_interface.o smash_insts.o print_insts.o\
                opcodes.o mdmx.o
ifdef TRACING
C_TARGETS      += trace.o
endif

ifndef SOLO
C_TARGETS 	+= simos_interface.o r4k_cp0.o 
endif

TARGETS = $(C_TARGETS)

.PHONY:	warn deps

default: warn
ifdef SOLO
	@$(MAKE) -f ../Makefile.ALL SOLO=1 deps
	@$(MAKE) -f ../Makefile.ALL SOLO=1 INCLUDE_DEPS=1 $(TARGET)
else
	@$(MAKE) -f ../Makefile.ALL deps
	@$(MAKE) -f ../Makefile.ALL INCLUDE_DEPS=1  $(TARGET)

endif

$(TARGET): $(TARGETS) 
	@echo "-> Updating library $(TARGET)"
	$(AR) cru $(TARGET) $(TARGETS)

warn:
	@echo ""
	@echo "Making MIPSY"
	@echo "************"
	@echo "  DEFS :   `$(FORMAT) $(DEFS)`"
	@echo "  CFLAGS : `$(FORMAT) $(CFLAGS)`"
	@echo "  INCS:    `$(FORMAT) $(INCS)`"
	@echo ""


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

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

%.d: %.c
	@$(CC) -M $(CC_OPTS) $< > $@

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