Makefile.ALL 2.28 KB
#!gmake

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

include $(SIMTOOLS)/makedefs

TARGET = flashlitelib.a

VPATH = ..

################################################################
# Include files
################################################################
ifdef SIMDIR
FLASHLITEDIR = -I$(SIMDIR)
else
FLASHLITEDIR = 
endif

ifdef FLASHPOINT
INCS = -I.. -I$(SIMTOOLS)/cpus/mipsy -I$(SIMTOOLS)/cpus/simos \
        -I$(SIMTOOLS)/caches/2Level -I$(SIMTOOLS)/memsystems $(FLASHLITEDIR) \
        -I$(SIMTOOLS)/cpus/solo -I$(SIMTOOLS)/cpus/shared -I$(MEMSPY_DIR) \
	$(GLOBAL_INCS)
else
INCS = -I.. -I$(SIMTOOLS)/cpus/mipsy -I$(SIMTOOLS)/cpus/simos \
        -I$(SIMTOOLS)/caches/2Level -I$(SIMTOOLS)/memsystems $(FLASHLITEDIR) \
        -I$(SIMTOOLS)/cpus/solo -I$(SIMTOOLS)/cpus/shared $(GLOBAL_INCS)
endif

################################################################
# DEFINES
################################################################
ifdef SOLO
DEF1 = -DSOLO
endif
ifdef USE_FLASHLITE
DEF3 = -DUSE_FLASHLITE -DFIREWALL_HACK
endif

DEFS = $(DEF1) $(DEF2) $(DEF3) $(GLOBAL_DEFS)

################################################################
# Compilation flags and targets
################################################################
CFLAGS = $(GLOBAL_CFLAGS)
ifdef SOLO
CFLAGS += $(SOLOCFLAGS)
endif

ifeq ($(CPU),SGI)
CFLAGS += -Xcpluscomm 
endif
CC_OPTS = $(CFLAGS) $(DEFS) $(INCS)

C_TARGETS  = flash_interface.o flash_faults.o
ifdef USE_FLASHLITE
ifndef SOLO
C_TARGETS += firewallhack.o
endif
endif

TARGETS = $(C_TARGETS)

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 flashlite"
	@echo "****************"
	@echo "  DEFS :   `$(FORMAT) $(DEFS)`"
	@echo "  CFLAGS : `$(FORMAT) $(CFLAGS)`"
	@echo ""

$(C_TARGETS): %.o: $(SIMTOOLS)/memsystems/flashlite/%.c
	@echo "Compiling  $(<F)"
	$(CC) $(CC_OPTS) -c $(SIMTOOLS)/memsystems/flashlite/$*.c 

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

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

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