
obj-m := rapi.o
rapi-objs := rapi_driver.o rapi_com.o rapi_if_pcie.o


SRC := $(shell pwd)
#CFLAGS := -DRAPI_RETRY_TEST
GIT_COMMIT_ID := $(shell git log -1 --format='%H')

all:
	echo "all rapi"
	echo $(KERNEL_SRC) 
#	$(MAKE) -C $(KERNEL_SRC) M=$(SRC)
#	$(MAKE) -C $(KERNEL_SRC) M=$(SRC) EXTRA_CFLAGS="-DGIT_COMMIT_ID="$(GIT_COMMIT_ID)" -DRAPI_TXFULL_TEST"
	$(MAKE) -C $(KERNEL_SRC) M=$(SRC) EXTRA_CFLAGS="-DGIT_COMMIT_ID="$(GIT_COMMIT_ID)""
#	$(MAKE) -C $(KERNEL_SRC) M=$(SRC) EXTRA_CFLAGS="-DRAPI_RETRY_TEST"

modules_install:
	echo "install rapi"
	echo $(KERNEL_SRC) 
	$(MAKE) -C $(KERNEL_SRC) M=$(SRC) modules_install

ext:
	$(MAKE) -f makefile-external


indent: rapidev.h rapi_com.c rapi_com.h rapi_driver.c rapi_if_pcie.c rapivar.h
	indent -nbad -bap -nbc -bbo -hnl -br -brs -c33 -cd33 -ncdb -ce -ci4 -cli0 -d0 -di1 -nfc1 -i8 -ip0 -l80 -lp -npcs -nprs -npsl -sai -saf -saw -ncs -nsc -sob -nfca -cp33 -ss -ts8 -il1 rapidev.h 
	indent -nbad -bap -nbc -bbo -hnl -br -brs -c33 -cd33 -ncdb -ce -ci4 -cli0 -d0 -di1 -nfc1 -i8 -ip0 -l80 -lp -npcs -nprs -npsl -sai -saf -saw -ncs -nsc -sob -nfca -cp33 -ss -ts8 -il1 rapi_com.c 
	indent -nbad -bap -nbc -bbo -hnl -br -brs -c33 -cd33 -ncdb -ce -ci4 -cli0 -d0 -di1 -nfc1 -i8 -ip0 -l80 -lp -npcs -nprs -npsl -sai -saf -saw -ncs -nsc -sob -nfca -cp33 -ss -ts8 -il1 rapi_com.h 
	indent -nbad -bap -nbc -bbo -hnl -br -brs -c33 -cd33 -ncdb -ce -ci4 -cli0 -d0 -di1 -nfc1 -i8 -ip0 -l80 -lp -npcs -nprs -npsl -sai -saf -saw -ncs -nsc -sob -nfca -cp33 -ss -ts8 -il1 rapi_driver.c 
	indent -nbad -bap -nbc -bbo -hnl -br -brs -c33 -cd33 -ncdb -ce -ci4 -cli0 -d0 -di1 -nfc1 -i8 -ip0 -l80 -lp -npcs -nprs -npsl -sai -saf -saw -ncs -nsc -sob -nfca -cp33 -ss -ts8 -il1 rapi_if_pcie.c 
	indent -nbad -bap -nbc -bbo -hnl -br -brs -c33 -cd33 -ncdb -ce -ci4 -cli0 -d0 -di1 -nfc1 -i8 -ip0 -l80 -lp -npcs -nprs -npsl -sai -saf -saw -ncs -nsc -sob -nfca -cp33 -ss -ts8 -il1 rapivar.h  

clean:
	rm -f *.o *~ core .depend .*.cmd *.ko *.mod.c
	rm -f Module.markers Module.symvers modules.order
	rm -rf .tmp_versions Modules.symvers

