
# Configure this oath to point to the base of your linux source tree
LINUXPATH=../../kernel
COMMONPATH=../common

CFLAGS=-Wall -O2 -g3
# The include paths are appended to any CFLAGS given on the command line.
override CFLAGS += -I$(LINUXPATH)/drivers/grlib/include/uapi -I$(COMMONPATH)
LDFLAGS=-static
# The atomic counters need the CASA instruction of LEON3 and later, plain
# SPARC V8 would need libatomic
CC=sparc-linux-gcc -mcpu=leon3

.PHONY:all

all: grspfi_user

grspfi_user: grspfi_user.c dmaheap.o
	$(CC) $(CFLAGS) $(LDFLAGS) -o grspfi_user grspfi_user.c dmaheap.o -lpthread

dmaheap.o: $(COMMONPATH)/dmaheap.c $(COMMONPATH)/dmaheap.h
	$(CC) $(CFLAGS) -c -o dmaheap.o $(COMMONPATH)/dmaheap.c

clean:
	-rm -f *.o grspfi_user

leon: export CC=sparc-linux-gcc -mcpu=leon3
leon: all

noel32: export CC=riscv32-linux-gcc
noel32: all

noel64: export CC=riscv64-linux-gcc
noel64: all
