Makefile.ALL 1.29 KB
#!gmake

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

include $(SIMTOOLS)/makedefs

TARGET = memsyschal2.a

VPATH = ..

################################################################
# Include Files
################################################################
INCS   = -I$(SIMTOOLS)/cpus/simos \
	 -I$(SIMTOOLS)/memsystems -I$(SIMTOOLS)/cpus/shared $(GLOBAL_INCS)

DEFS = -DSIMOS $(GLOBAL_DEFS)

CFLAGS	 += $(GLOBAL_CFLAGS) 

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

C_TARGETS = simos_interface.o
TARGETS   = $(C_TARGETS)

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

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


warn:
	@echo ""
	@echo "Making Chal2 Interface"
	@echo "**********************"
	@echo "  DEFS :   `$(FORMAT) $(DEFS)`"
	@echo "  CFLAGS : `$(FORMAT) $(CFLAGS)`"
	@echo ""

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

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

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

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