Skip to content
Snippets Groups Projects
Makefile 1.58 KiB
Newer Older
#
#ifeq ($(KERNELRELEASE),)
#
#    # Assume the source tree is where the running kernel was built
#    # You should set KERNELDIR in the environment if it's elsewhere
#    
#    #BUILDSYSTEM_DIR ?= /lib/modules/$(shell uname -r)/build
#    # The current directory is passed to sub-makes as argument
#	#PWD := $(shell pwd)
#
#modules:
#	$(MAKE) -C $(BUILDSYSTEM_DIR) M=$(PWD) KBUILD_EXTRA_SYMBOLS=$(EXTRA_SYMBOLS) modules 
#
#modules_install:
#	$(MAKE) -C $(BUILDSYSTEM_DIR) M=$(PWD) modules_install
#
#clean:
#	rm -rf *.o *~ core .depend .*.cmd *.ko *.mod.c .tmp_versions *.o.d *.mod
#
#.PHONY: modules modules_install clean
#
#else
#    # called from kernel build system: just declare what our modules are
#    obj-m := flxnet_dev.o flxnet_target.o flxnet_pcie.o
#    flxnet_dev-y := flx_net_dev.o
#    flxnet_target-y := flx_net_target.o
#    flxnet_pcie-y := flx_net_pcie.o
#             
#endif
# If we are running by kernel building system
ifneq ($(KERNELRELEASE),)
	#$(TARGET_MODULE)-objs := main.o device_file.o
	obj-m := flxnet_dev.o flxnet_target.o
# If we running without kernel build system
Elena Zhivun's avatar
Elena Zhivun committed
else
	BUILDSYSTEM_DIR:=/lib/modules/$(shell uname -r)/build
	PWD:=$(shell pwd)
all :
# run kernel build system to make module
	$(MAKE) -C $(BUILDSYSTEM_DIR) M=$(PWD) modules
clean:
# run kernel build system to cleanup in current directory
	$(MAKE) -C $(BUILDSYSTEM_DIR) M=$(PWD) clean
load:
	insmod ./flxnet_dev.ko
	insmod ./flxnet_target.ko
unload:
	rmmod ./flxnet_dev.ko
	rmmod ./flxnet_target.ko
reload:
	rmmod ./flxnet_dev.ko
	rmmod ./flxnet_target.ko
	insmod ./flxnet_dev.ko
	insmod ./flxnet_target.ko
Elena Zhivun's avatar
Elena Zhivun committed
endif