
# -DUSE_CLOCK to use the clock() command.  Otherwise, use the Intel
# cycle-counter based timer in intel_timer.h.  To use intel_timer,
# you'll need to specify the clock rate, by including -DCPU_MHZ=1500
# in the CFLAGS, for example, for a 1.5GHz machine.  More info on
# the two timing options is included at the top of membench.c.

PROG := membench

#
# Sample flag configuration for the Sun Ultra-10 workstation.
#
#CC := cc
#CFLAGS := -dalign -xtarget=native -xO5 -xarch=v9a -xrestrict=%all 
#LIBS= -lposix4

# -- Using the clock() for timing
CC = gcc
CFLAGS = -DUSE_CLOCK \
         -march=pentiumpro -mcpu=pentiumpro -O4 

# -- Using the intel_timer routines for timing
#CFLAGS = -DCPU_MHZ=550 \
#         -march=pentiumpro -mcpu=pentiumpro -O4 
#LIBS= intel_timer.c intel_cyctr_read_time.s


.PHONY: default clean

default: $(PROG).ps

$(PROG).ps: $(PROG).gp $(PROG).out
	gnuplot < $(PROG).gp > $(PROG).ps

$(PROG).out: $(PROG)
	./$(PROG) | tee $(PROG).out

$(PROG): $(PROG).c
	$(CC) $(CFLAGS) -o $(PROG) $(PROG).c $(LIBS)

clean:
	rm -f $(PROG) $(PROG).ps $(PROG).out

