Merge commit 'b31320a79e2054c6739b5229259dbf98f3afc547' into merges
[unleashed.git] / share / mk / kmod.mk
blob5f88992408a33549c73c0a62e071d631b5eb4f12
2 # Build and install a kernel module helper.
4 # See kernel/mk/kmod-build.mk for description of inputs used during the
5 # build. This makefile is responsible for making and cleaning up object
6 # subdirectories. All other tasks are handled by secondary makefile -
7 # kmod-build.mk.
9 # The config system tells us:
11 # (1) whether to build this module at all
12 # (2) if we're supposed to build it, should we build 32-bit or 64-bit?
14 # The following config variable addresses #2 above:
16 # CONFIG_KERNEL_BITS = 64
18 # and the following config var tells us whether to bother with this
19 # particular module:
21 # CONFIG_FOOBAR = y
23 # If we are not supposed to care about this module, we do not even recurse
24 # into the module's build directory.
26 # This way, we separate the concerns of defining a module and how it is
27 # (generically) built, from which platforms/ISA/whatever we're supposed to
28 # build the module for.
30 # To avoid recursively including kmod-build.mk, this makefile turns into a
31 # giant no-op if _KMOD_BUILD is set.
34 .if empty(_KMOD_BUILD)
36 .include <unleashed.mk>
37 .include <${SRCTOP}/cfgparam.mk>
39 all:
40 @mkdir -p obj${CONFIG_KERNEL_BITS}
41 @${MAKE} -f ${SRCTOP}/kernel/mk/kmod-build.mk all \
42 BITS=${CONFIG_KERNEL_BITS} SRCTOP=${SRCTOP}
44 clean cleandir:
45 @${MAKE} -f ${SRCTOP}/kernel/mk/kmod-build.mk clean \
46 SRCTOP=${SRCTOP}
47 @rm -rf obj${CONFIG_KERNEL_BITS}
49 install:
50 @${MAKE} -f ${SRCTOP}/kernel/mk/kmod-build.mk install-misc \
51 SRCTOP=${SRCTOP}
52 @${MAKE} -f ${SRCTOP}/kernel/mk/kmod-build.mk install \
53 BITS=${CONFIG_KERNEL_BITS} SRCTOP=${SRCTOP}
55 .PHONY: all clean cleandir install
57 .endif