Updated `README.md` with instructions for building/using the kernel module.
[xeon-phi-kernel-module] / Kbuild
CommitLineData
800f879a
AT
1not-y := n
2not-n := y
3m-not-y := n
4m-not-n := m
5
6ifeq ($(CONFIG_X86_MICPCI),)
7CONFIG_X86_MICPCI := n
8endif
9ifeq ($(CONFIG_X86_MICPCI)$(MIC_CARD_ARCH),n)
10$(error building for host, but $$(MIC_CARD_ARCH) is unset)
11endif
12ifneq ($(MIC_CARD_ARCH),$(firstword $(filter l1om k1om,$(MIC_CARD_ARCH))))
13$(error $$(MIC_CARD_ARCH) must be l1om or k1om)
14endif
15
16# Force optimization to -O2 in case the kernel was configured to use
17# -Os. The main reason is pretty dumb -- -Os has a warning -O2 doesn't,
18# and we compile with -Werror internally. Another reason is that -O2 is
19# what we're used to in terms of validation and performance analysis. We
20# should probably get rid of this, though.
21subdir-ccflags-y += -O2
22
23# Makes it easy to inject "-Werror" from the environment
24subdir-ccflags-y += $(KERNWARNFLAGS)
25
26# Bake some information about who built the module(s), and what version
27# of the source code they started with. Possibly useful during debug.
28subdir-ccflags-y += -DBUILD_NUMBER=\"'$(MPSS_BUILDNO)'\"
29subdir-ccflags-y += -DBUILD_BYWHOM=\"'$(MPSS_BUILTBY)'\"
30subdir-ccflags-y += -DBUILD_ONDATE=\"'$(MPSS_BUILTON)'\"
31subdir-ccflags-y += -DBUILD_SCMVER=\"'$(MPSS_COMMIT)'\"
32subdir-ccflags-y += -DBUILD_VERSION=\"'$(or $(MPSS_VERSION),0.0) ($(MPSS_BUILTBY))'\"
33
34# Code common with the host mustn't use CONFIG_M[LK]1OM directly.
35# But of course it does anyway. Arrgh.
36subdir-ccflags-$(CONFIG_ML1OM) += -DMIC_IS_L1OM
37subdir-ccflags-$(CONFIG_MK1OM) += -DMIC_IS_K1OM
38ifeq ($(MIC_CARD_ARCH),l1om)
39subdir-ccflags-y += -DMIC_IS_L1OM -DCONFIG_ML1OM
40endif
41ifeq ($(MIC_CARD_ARCH),k1om)
42subdir-ccflags-y += -DMIC_IS_K1OM -DCONFIG_MK1OM
43endif
44
45# a shorthand for "runs on the card"?
46subdir-ccflags-$(CONFIG_X86_MICPCI) += -D_MIC_SCIF_
47
48# "runs on the host"
49subdir-ccflags-$(not-$(CONFIG_X86_MICPCI)) += -DHOST -DUSE_VCONSOLE
50
51# always set? what's this thing's purpose?
52subdir-ccflags-y += -D__LINUX_GPL__ -D_MODULE_SCIF_
53
54subdir-ccflags-y += -I$(M)/include
55
56obj-$(CONFIG_X86_MICPCI) += dma/ micscif/ pm_scif/ ras/
57obj-$(CONFIG_X86_MICPCI) += vcons/ vnet/ mpssboot/ ramoops/ virtio/
58
59obj-$(m-not-$(CONFIG_X86_MICPCI)) += mic.o
60
61mic-objs :=
62mic-objs += dma/mic_dma_lib.o
63mic-objs += dma/mic_dma_md.o
64mic-objs += host/acptboot.o
65mic-objs += host/ioctl.o
66mic-objs += host/linpm.o
67mic-objs += host/linpsmi.o
68mic-objs += host/linscif_host.o
69mic-objs += host/linsysfs.o
70mic-objs += host/linux.o
71mic-objs += host/linvcons.o
72mic-objs += host/linvnet.o
73mic-objs += host/micpsmi.o
74mic-objs += host/micscif_pm.o
75mic-objs += host/pm_ioctl.o
76mic-objs += host/pm_pcstate.o
77mic-objs += host/tools_support.o
78mic-objs += host/uos_download.o
79mic-objs += host/vhost/mic_vhost.o
80mic-objs += host/vhost/mic_blk.o
81mic-objs += host/vmcore.o
82mic-objs += micscif/micscif_api.o
83mic-objs += micscif/micscif_debug.o
84mic-objs += micscif/micscif_fd.o
85mic-objs += micscif/micscif_intr.o
86mic-objs += micscif/micscif_nm.o
87mic-objs += micscif/micscif_nodeqp.o
88mic-objs += micscif/micscif_ports.o
89mic-objs += micscif/micscif_rb.o
90mic-objs += micscif/micscif_rma_dma.o
91mic-objs += micscif/micscif_rma_list.o
92mic-objs += micscif/micscif_rma.o
93mic-objs += micscif/micscif_select.o
94mic-objs += micscif/micscif_smpt.o
95mic-objs += micscif/micscif_sysfs.o
96mic-objs += micscif/micscif_va_gen.o
97mic-objs += micscif/micscif_va_node.o
98mic-objs += vnet/micveth_dma.o
99mic-objs += vnet/micveth_param.o
100
101version-le = $(shell printf '%s\n' $(1) | sort -t. -k 1,1n -k 2,2n -k 3,3n -k 4,4n -c >/dev/null 2>&1 && echo t)
102ifeq ($(call version-le, 2.6.23 $(KERNELRELEASE)),t)
103ccflags-y += $(mic-cflags)
104else
105$(error building against kernels <= 2.6.23 is broken)
106endif