Makefile.ALL 2.15 KB
#!gmake 

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

include $(SIMTOOLS)/makedefs

TARGET = 2levellib.a

VPATH = ..

#################################################################
# INCLUDE DIRECTORIES 
#################################################################
ID1 = 
ID2 =
ifdef USE_FLASHLITE
ID3 = -I$(SIMDIR) -I$(SIMTOOLS)/memsystems/flashlite
endif

# This is bad... caches shouldn't depend on mipsy. I'll fix this
# when Ed and I merge tracing stuff
ID4 = -I$(SIMTOOLS)/cpus/mipsy

ifeq ($(CPUSIM),mxs)
ID5 = -I$(SIMTOOLS)/cpus/mxs
endif
ID6    = 
ID7    = -I$(SIMTOOLS)/memsystems
INCS  = $(ID1) $(ID2) $(ID3) $(ID4) $(ID5) $(ID6) $(ID7) $(GLOBAL_INCS)

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

DEF1 = # -DNO_CACHES
ifdef USE_FLASHLITE
DEF2  = -DUSE_FLASHLITE
endif
ifdef SOLO
DEF3  = $(SOLOCFLAGS)
endif

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

#################################################################
# C and ASM FLAGS
#################################################################

CFLAGS       = $(GLOBAL_CFLAGS) 
CC_OPTS      = $(CFLAGS) $(INCS) $(DEFS)

#################################################################
# TARGETS
#################################################################
C_TARGETS       = pcache.o scache.o

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 2Level"
	@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