Makefile.ALL 3.61 KB
#!gmake
# Makefile for embra libraries

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

include $(SIMTOOLS)/makedefs

VPATH = ..

################################################################
# INCLUDES
################################################################


# for private vcode includes: -I $(HOME)/vcode/vcode-src

INCS =  -I$(SIMTOOLS)/cpus/shared \
	-I$(SIMTOOLS)/cpus/simos \
	-I$(SIMTOOLS)/cpus/mipsy $(GLOBAL_INCS) \
	-I$(SIMTOOLS)/common/dcg_support

# always use VCODE now ;-)

SIMOS = 1
VCODE = 1

ifdef VCODE
VC_DIR = $(SIMOS_DIR)/build-files/include/sgi
INCS +=	-I$(VC_DIR)
endif

################################################################
# DEFINES
################################################################
DEFS  = -DSIMOS $(GLOBAL_DEFS)
ifdef SIMOSTRANSDEBUG
DEFS += -DDEBUG_TRANSLATOR
endif

ifdef VCODE
DEFS += -DVCODE=1
endif

ifdef OLDCODE
TRANSLATOR = translator.old.c
DEFS += -DOLDCODE=1
else
TRANSLATOR = translator.c
endif

#################################################################
# C and ASM FLAGS
#################################################################
ifdef SIMOSDEBUG
CFLAGS = -g
ASFLAGS = -g
endif

ifdef SIMOSTRANSDEBUG
CFLAGS = -g
ASFLAGS = -g
endif

ifdef SIMOS
CFLAGS += $(GLOBAL_CFLAGS)
ASFLAGS += $(GLOBAL_ASFLAGS)
endif

# if we want to allow optimization of large routines
# CFLAGS += -Olimit 3000

# CFLAGS += -g3

#################################################################
# Source files for various makes
#################################################################
C1SRCS          = $(TRANSLATOR) decoder.c 

TRANSDEBUGCSRCS = $(C1SRCS) debug_trans.c

CSRCS           = driver.c qc.c qc64.c cache.c 

ifdef VCODE
 CSRCS += main_run.c
endif

# was: main_run.s callout.s
SSRCS		= 


SIMOSCSRCS      = $(CSRCS) $(C1SRCS) mem_control.c clock.c \
		stats.c debug.c directory.c simos_interface.c r4k_cp0.c

SIMOSSSRCS   = $(SSRCS) directory_asm.s

SOLOCSRCS    = $(CSRCS) mem_tlb_solo.c mem_driver.c solo_nops.c

SOLOSSRCS    = $(SSRCS) solo_switch.s

ifdef SIMOSTRANSDEBUG
C_TARGETS = $(TRANSDEBUGCSRCS:.c=.o)
else
C_TARGETS  = $(SIMOSCSRCS:.c=.o) 
ASM_TARGETS = $(SIMOSSSRCS:.s=.o)
endif

ifdef SIMOSTRANSDEBUG
TARGETS = $(TRANSDEBUGOBJS)
ASFLAGS = $(SIMOSDEBUGSFLAGS)
CFLAGS = $(SIMOSTRANSDEBUGCFLAGS)
else

ifdef SIMOS
TARGET  = embralib.a
VC_TARGETS = $(LIBDIR)/vcode.lib.a $(VC_DIR)/vcode.h
TARGETS = $(C_TARGETS) $(ASM_TARGETS) 
endif

ifdef SIMOSDEBUG
TARGET  = embradebuglib
TARGETS = $(C_TARGETS) $(ASM_TARGETS)
endif
endif


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

.PHONY: warn deps

default: warn
ifdef SIMOS
	@$(MAKE) -f ../Makefile.ALL SIMOS=1 deps
	@$(MAKE) -f ../Makefile.ALL SIMOS=1 INCLUDE_DEPS=1  $(TARGET)
else
	@echo "Embra currently is only set up to be made into SIMOS"
endif

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

debugtrans: warn $(TRANSDEBUGOBJS)
	$(CC) -o ../debug_trans $(TARGETS) ../../shared/SOLO/shared.a -lmld

solocpu: warn $(SOLOOBJS) 
	$(AR) cru libsoloMshade.a $(SOLOOBJS) 

warn: 
	@echo ""
	@echo "Making EMBRA"
	@echo "************"
	@echo "  DEFS :   `$(FORMAT) $(DEFS)`"
	@echo "  CFLAGS : `$(FORMAT) $(CFLAGS)`"
	@echo "  ASFLAGS : `$(FORMAT) $(ASFLAGS)`"
	@echo ""


clean::
	echo "ha ha!"

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

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

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

%.e: %.c
	$(CC) -E $(CC_OPTS) $< > ../$@

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

%.d: %.s
	@$(AS) -M $(AS_OPTS) $< > $@

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