CC=sparc-rtems-gcc
CPP=sparc-rtems-c++
CC_NOCFLAGS=sparc-rtems-gcc
LD=sparc-rtems-ld

CCOPT = -O2
CFLAGS= -I.. -I. -O2 -g3 -Wall
OUTDIR=

CONFIG_DEPS=config*.c

all: test test_ngmp

# build options for different systems

#CFLAGS+=-msoft-float -qleon2

clean:
	rm -f *.o core test test_ngmp > /dev/null

mmu_setup.o: mmu_setup.c
	$(CC) $(CFLAGS) -c  mmu_setup.c -o mmu_setup.o

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

spwrouter_custom_config.o: spwrouter_custom_config.c
	$(CC) $(CFLAGS) -c spwrouter_custom_config.c -o spwrouter_custom_config.o

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

spwlib.o: spwlib.c spwlib.h
	$(CC) $(CFLAGS) -c spwlib.c -o spwlib.o

test: $(CONFIG_DEPS) test.c spwlib.o spwrouter_custom_config.o grspw_router_lib.o grspw_pkt_lib.o
	$(CC) $(CFLAGS) test.c -o test spwlib.o spwrouter_custom_config.o grspw_router_lib.o grspw_pkt_lib.o

test_ngmp: $(CONFIG_DEPS) test.c spwlib.o spwrouter_custom_config.o grspw_router_lib.o mmu_setup.o grspw_pkt_lib.o
	$(CC) $(CFLAGS) -qngmp -DTEST_NGMP test.c -o test_ngmp spwlib.o spwrouter_custom_config.o grspw_router_lib.o mmu_setup.o grspw_pkt_lib.o

test_pci: $(CONFIG_DEPS) test_pci.c spwlib.o spwrouter_custom_config.o grspw_router_lib.o grspw_pkt_lib.o
	$(CC) $(CFLAGS) test_pci.c -o test_pci spwlib.o spwrouter_custom_config.o grspw_router_lib.o grspw_pkt_lib.o

test_pci_ngmp: $(CONFIG_DEPS) test_pci.c spwlib.o spwrouter_custom_config.o grspw_router_lib.o mmu_setup.o grspw_pkt_lib.o
	$(CC) $(CFLAGS) -qngmp -DTEST_NGMP test_pci.c -o test_pci_ngmp spwlib.o spwrouter_custom_config.o grspw_router_lib.o mmu_setup.o grspw_pkt_lib.o

test_pci_rtr_ngmp: $(CONFIG_DEPS) test_pci_rtr.c spwlib.o spwrouter_custom_config.o grspw_router_lib.o mmu_setup.o grspw_pkt_lib.o
	$(CC) $(CFLAGS) -qngmp -DTEST_NGMP test_pci_rtr.c -o test_pci_rtr_ngmp spwlib.o spwrouter_custom_config.o grspw_router_lib.o mmu_setup.o grspw_pkt_lib.o
