1 ###############################################################################
4 # @brief Builds up Linux driver.
6 # @author Yury GEORGIEVSKIY, CERN.
9 # Don't use this makefile directly!
10 # It should be included through Makefile.drvr _ONLY_
12 # @date Created on 08/04/2009
13 ###############################################################################
15 include ../$(ROOTDIR)/makefiles/Makefile.base
17 # Include generic definitions
18 include ../$(ROOTDIR)/makefiles/Kbuild.include
21 MAKEFLAGS += --no-print-directory
23 # Driver source directory
24 #+ This name is defined _only_ if user in not alredy define it
27 # What will be finally created
28 DRIVER = $(OBJDIR)/$(DRIVER_NAME).ko
31 @echo -e "\nCompiling driver for $(KVER) Linux kernel:\n"
32 @$(MAKE) CPU=$(CPU) __build
35 __build: $(OBJDIR) $(FINAL_DEST)
36 # 1. compile the driver
37 $(MAKE) -C $(KSRC) M=$(shell pwd) CPU=$(CPU) \
38 ROOTDIR=$(shell cd ../$(ROOTDIR) && pwd && echo) modules
40 # 2. Remove .tmp_version subdir, if already exists
41 @if [ -d $(OBJDIR)/.tmp_versions ]; then \
42 rm -rf $(OBJDIR)/.tmp_versions; \
45 # 3. Move all the compiled stuff in the object directory. Suppress any errors.
46 @-mv -f .tmp_versions/ *.o .*.o.cmd .*.ko.cmd *.mod.c *.symvers \
47 Module.markers modules.order *.ko $(OBJDIR) 2>/dev/null; exit 0
50 @ln -sf ../$(DRVR_DIR)/$(DRIVER) ../$(FINAL_DEST)/$(DRIVER_NAME).$(KVER).ko
53 include ../$(ROOTDIR)/makefiles/deliver.mk
57 $(MAKE) -C $(KSRC) M=$(shell pwd) ROOTDIR=$(shell cd ../$(ROOTDIR) && pwd && echo) clean