
APP_NAME = coremark

OBJS= core_main.o \
      core_list_join.o \
      core_matrix.o \
      core_state.o \
      core_util.o \
      mach/core_portme.o

LIBS= -L../../build/libs -luser

INCLUDES = -I. -I./mach  -I../..  -I../../giet_libs  -I../../giet_xml  

DEFS := -DFLAGS_STR="\"${CFLAGS}\"" -DTOTAL_DATA_SIZE=2000

COREMARK ?= RUN1
ifeq (${COREMARK},RUN1)
  $(info Coremark Performance Run)
  DEFS := ${DEFS} -DPERFORMANCE_RUN=1
endif
ifeq (${COREMARK},RUN2)
  $(info Coremark Validation Run)
  DEFS := ${DEFS} -DVALIDATION_RUN=1
endif
ifeq (${COREMARK},RUN3)
  $(info Coremark Profile Run)
  DEFS := ${DEFS} -DPROFILE_RUN=1
endif

#DEFS := ${DEFS} -DCORE_DEBUG=1

LIB_DEPS = ../../build/libs/libuser.a

appli.elf: $(OBJS) $(APP_NAME).ld $(LIBS_DEPS) 
	$(LD) -o $@ -T $(APP_NAME).ld $(OBJS) $(LIBS)
	$(DU) -D $@ > $@.txt

check_coremark: coremark.md5
	md5sum -c $< 

%.o: %.c 
	$(CC)  $(INCLUDES) $(CFLAGS) ${DEFS} -c -o  $@ $<

clean:
	rm -f *.o *.elf appli.elf.txt *.pyc core *~
