File: Makefile

package info (click to toggle)
kmod 34.2-2
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 2,864 kB
  • sloc: ansic: 16,990; makefile: 498; sh: 382; xml: 61; perl: 12
file content (28 lines) | stat: -rw-r--r-- 973 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
# When KDIR is not manually set, use the MODULE_DIRECTORY for the pre-existent
# kmod, not the one being built, to figure out how to get to the kernel
# sources/headers for building our own dummy kernel modules.  The final
# location of the modules may change later by scripts/setup-rootfs.sh that
# assembles a per-test-rootfs.
ifndef KDIR
  MODULE_DIRECTORY := $(shell pkg-config --variable module_directory kmod)
  ifeq ($(MODULE_DIRECTORY),)
    MODULE_DIRECTORY := /lib/modules
  endif
  KDIR := $(MODULE_DIRECTORY)/$$(uname -r)/build
endif

ARCH_SPECIFIC_MODULES := mod-simple-x86_64.ko mod-simple-i386.ko mod-simple-sparc64.ko

default: modules

mod-simple-%.ko: mod-simple-%.c Makefile.arch
	$(eval arch=$(patsubst mod-simple-%.ko,%,$@))
	$(MAKE) KDIR=$(KDIR_$(arch)) ARCH=$(arch) CROSS_COMPILE=$(CROSS_COMPILE_$(arch)) -f Makefile.arch

modules:
	$(MAKE) -C $(KDIR) M=$$PWD modules

arch-modules: $(ARCH_SPECIFIC_MODULES)

clean:
	$(MAKE) -C $(KDIR) M=$$PWD clean