ALL = monitor periodic_test.o oneshot_test.o bulk_module.o bulk_app

ifdef CONFIG_PSC
ALL += psc_periodic
endif

all : $(ALL)

ifneq ($(wildcard ../rtl.mk),)
include ../rtl.mk
endif

clean: dummy
	rm -f *.o monitor gnuplot.out modules.dep bulk_app

psc_periodic: psc_periodic.c
	$(CC) -g -o psc_periodic psc_periodic.c -I../include/ -lrtlinux -L../psc

periodic_test: monitor periodic_test.o
	depmod *.o ../modules/*.o > modules.dep
	-rmmod rtl_sched
	insmod periodic_test.o
	./monitor
	rmmod periodic_test

periodic_view: gnuplot.out
	gnuplot < periodic.plot

monitor: monitor.c
	$(CC) ${INCLUDE} ${USER_CFLAGS} -o monitor monitor.c

periodic_test.o: periodic_test.c
	$(CC) ${INCLUDE} ${CFLAGS} -c periodic_test.c

oneshot_test: monitor oneshot_test.o
	depmod *.o ../modules/*.o > modules.dep
	-rmmod rtl_sched
	insmod oneshot_test.o
	./monitor
	rmmod oneshot_test

oneshot_view: gnuplot.out
	gnuplot < oneshot.plot

oneshot_test.o: oneshot_test.c
	$(CC) ${INCLUDE} ${CFLAGS} -c oneshot_test.c

bulk_test: bulk_module.o bulk_app
	depmod *.o ../modules/*.o > modules.dep
	insmod bulk_module.o
	./bulk_app
	rmmod bulk_module

bulk_module.o: bulk_module.c
	$(CC) ${INCLUDE} ${CFLAGS} -c bulk_module.c

bulk_app: bulk_app.c
	$(CC) ${INCLUDE} ${USER_CFLAGS} -o bulk_app bulk_app.c

.PHONY: dummy

include $(RTL_DIR)/Rules.make
