ifeq ($(KERNELRELEASE),)
CUR_REL_PATH := "rda/kernelmod"
include ../../config.mk
endif

all: submake

install: all $(IRIS_BIN) $(IRIS_CONFIG_TMPL_RCD) $(SYS_INIT_D)
	install -m 0664 -o $(IRIS_USER) -g $(IRIS_GROUP) rdasys.rc $(IRIS_CONFIG_TMPL_RCD)/rdasys
	install -m 0755 -o root         -g root          rdasys.rc $(SYS_INIT_D)/rdasys

test:

uninstall:
	if [ -d $(IRIS_BIN) ]; then \
		cd $(IRIS_BIN) && rm -f rda-*.ko; fi
	if [ -d $(IRIS_CONFIG_TMPL_RCD) ]; then \
		cd $(IRIS_CONFIG_TMPL_RCD) && rm -f rdasys; fi
	if [ -d $(SYS_INIT_D) ]; then \
		cd $(SYS_INIT_D) && rm -f rdasys; fi

clean:
	rm -f *.o *.ko *~ core *.d *.d.bak Module.symvers modules.order

# Handle reinvocation of the Makefile for 2.6 kernel builds, as well
# as specific sub-make commands in general.
#
EXTRA_CFLAGS += $(RDAINCREL) $(RDAINCABS)
MAKEKERNEL = make-kernel-$(shell uname -r | cut -d. -f -2).mk

ifneq ($(KERNELRELEASE),)
    rda-objs := rdamain.o ioserial.o rvpio.o boards.o
    obj-m := rda.o
endif

submake:
	+make -f $(MAKEKERNEL) $(MAKECMDGOALS)
