| 1 | # Copyright 2010-2017 Intel Corporation. |
| 2 | # |
| 3 | # This program is free software; you can redistribute it and/or modify |
| 4 | # it under the terms of the GNU General Public License, version 2, |
| 5 | # as published by the Free Software Foundation. |
| 6 | # |
| 7 | # This program is distributed in the hope that it will be useful, |
| 8 | # but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 9 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
| 10 | # General Public License for more details. |
| 11 | # |
| 12 | # Disclaimer: The codes contained in these modules may be specific to |
| 13 | # the Intel Software Development Platform codenamed Knights Ferry, |
| 14 | # and the Intel product codenamed Knights Corner, and are not backward |
| 15 | # compatible with other Intel products. Additionally, Intel will NOT |
| 16 | # support the codes or instruction set in future products. |
| 17 | # |
| 18 | # Intel offers no warranty of any kind regarding the code. This code is |
| 19 | # licensed on an "AS IS" basis and Intel is not obligated to provide |
| 20 | # any support, assistance, installation, training, or other services |
| 21 | # of any kind. Intel is also not obligated to provide any updates, |
| 22 | # enhancements or extensions. Intel specifically disclaims any warranty |
| 23 | # of merchantability, non-infringement, fitness for any particular |
| 24 | # purpose, and any other warranty. |
| 25 | # |
| 26 | # Further, Intel disclaims all liability of any kind, including but |
| 27 | # not limited to liability for infringement of any proprietary rights, |
| 28 | # relating to the use of the code, even if Intel is notified of the |
| 29 | # possibility of such liability. Except as expressly stated in an Intel |
| 30 | # license agreement provided with this code and agreed upon with Intel, |
| 31 | # no license, express or implied, by estoppel or otherwise, to any |
| 32 | # intellectual property rights is granted herein. |
| 33 | |
| 34 | MPSS_COMMIT ?= $(or $(shell sed -ne '2 p' .mpss-metadata 2>/dev/null), \ |
| 35 | $(error .mpss-metadata file is missing or incorrect)) |
| 36 | MPSS_VERSION ?= $(or $(shell sed -ne '1 p' .mpss-metadata 2>/dev/null), \ |
| 37 | $(error .mpss-metadata file is missing or incorrect)) |
| 38 | MPSS_BUILDNO ?= 0 |
| 39 | export MPSS_COMMIT := $(MPSS_COMMIT) |
| 40 | export MPSS_VERSION := $(MPSS_VERSION) |
| 41 | export MPSS_BUILDNO := $(MPSS_BUILDNO) |
| 42 | export MPSS_BUILTBY := $(shell echo "`whoami`@`uname -n`") |
| 43 | export MPSS_BUILTON := $(shell date +'%F %T %z') |
| 44 | |
| 45 | KERNEL_VERSION := $(shell uname -r) |
| 46 | KERNEL_SRC = /lib/modules/$(KERNEL_VERSION)/build |
| 47 | |
| 48 | INSTALL = install |
| 49 | INSTALL_d = $(INSTALL) -d |
| 50 | INSTALL_x = $(INSTALL) |
| 51 | INSTALL_f = $(INSTALL) -m644 |
| 52 | |
| 53 | prefix = /usr/local |
| 54 | sysconfdir = $(prefix)/etc |
| 55 | includedir = $(prefix)/include |
| 56 | |
| 57 | kmodinstalldir = /lib/modules/$(KERNEL_VERSION) |
| 58 | kmodincludedir = $(realpath $(KERNEL_SRC))/include/modules |
| 59 | |
| 60 | # If building the host's driver for a MIC co-processor card, which card |
| 61 | # $(ARCH) it should support |
| 62 | export MIC_CARD_ARCH = k1om |
| 63 | |
| 64 | .PHONY: all install modules |
| 65 | .PHONY: modules_install conf_install dev_install kdev_install |
| 66 | |
| 67 | all: modules |
| 68 | |
| 69 | install: modules_install conf_install kdev_install |
| 70 | |
| 71 | modules modules_install: %: |
| 72 | $(MAKE) -C $(KERNEL_SRC) M=$(CURDIR) $* \ |
| 73 | INSTALL_MOD_PATH=$(DESTDIR) |
| 74 | |
| 75 | conf_install: |
| 76 | ifneq ($(MIC_CARD_ARCH),) |
| 77 | $(INSTALL_d) $(DESTDIR)$(sysconfdir)/sysconfig/modules |
| 78 | $(INSTALL_x) mic.modules $(DESTDIR)$(sysconfdir)/sysconfig/modules |
| 79 | $(INSTALL_d) $(DESTDIR)$(sysconfdir)/modprobe.d |
| 80 | $(INSTALL_f) mic.conf $(DESTDIR)$(sysconfdir)/modprobe.d |
| 81 | endif |
| 82 | $(INSTALL_d) $(DESTDIR)$(sysconfdir)/udev/rules.d |
| 83 | $(INSTALL_f) udev-mic.rules $(DESTDIR)$(sysconfdir)/udev/rules.d/50-udev-mic.rules |
| 84 | |
| 85 | dev_install: |
| 86 | $(INSTALL_d) $(DESTDIR)$(includedir)/mic |
| 87 | $(INSTALL_f) include/scif_ioctl.h $(DESTDIR)$(includedir) |
| 88 | $(INSTALL_f) include/mic/io_interface.h $(DESTDIR)$(includedir)/mic |
| 89 | $(INSTALL_f) include/mic/mic_pm.h $(DESTDIR)$(includedir)/mic |
| 90 | $(INSTALL_f) ras/micras_api.h $(DESTDIR)$(includedir)/mic |
| 91 | $(INSTALL_f) ras/micmca_api.h $(DESTDIR)$(includedir)/mic |
| 92 | ifeq ($(MIC_CARD_ARCH),) # Card side |
| 93 | $(INSTALL_f) ras/micpm_api.h $(DESTDIR)$(includedir)/mic |
| 94 | $(INSTALL_f) ras/micras.h $(DESTDIR)$(includedir)/mic |
| 95 | else # Host side |
| 96 | $(INSTALL_f) include/mic/micbaseaddressdefine.h $(DESTDIR)$(includedir)/mic |
| 97 | $(INSTALL_f) include/mic/micsboxdefine.h $(DESTDIR)$(includedir)/mic |
| 98 | $(INSTALL_f) include/mic/micdboxdefine.h $(DESTDIR)$(includedir)/mic |
| 99 | $(INSTALL_f) ras/micpm_api.h $(DESTDIR)$(includedir)/mic |
| 100 | endif |
| 101 | |
| 102 | kdev_install: |
| 103 | $(INSTALL_d) $(DESTDIR)$(kmodinstalldir) |
| 104 | $(INSTALL_f) Module.symvers $(DESTDIR)$(kmodinstalldir)/scif.symvers |
| 105 | $(INSTALL_d) $(DESTDIR)$(kmodincludedir) |
| 106 | $(INSTALL_f) include/scif.h $(DESTDIR)$(kmodincludedir) |
| 107 | |
| 108 | clean: |
| 109 | @rm -f ./*/*.o ./*/.*.o ./*/*/*.o ./*/*/.*.o |
| 110 | @rm -f ./*/*.o.d ./*/.*.o.d ./*/*/.*.o.d |
| 111 | @rm -f ./*/*.o.cmd ./*/.*.o.cmd ./*/*/.*.o.cmd |
| 112 | @rm -f ./.mic*o.cmd |
| 113 | @rm -f ./modules.order ./Module.symvers |
| 114 | @rm -rf ./.tmp_versions |
| 115 | @rm -f ./mic.mod.* ./mic.o ./mic.ko |