|
| 1 | +################################################################################ |
| 2 | +# Makefile - Build Linux kernel modules with Makefile.kbuild receipe |
| 3 | +# for building out-of-tree kernel modules |
| 4 | +# |
| 5 | +# Copyright (C) 2015 Advantech Corp., Irvine, CA, USA |
| 6 | +# Author: Richard Vidal-Dorsch <[email protected]> |
| 7 | +################################################################################ |
| 8 | + |
| 9 | +all: clean modules |
| 10 | + |
| 11 | +EXTRA_CFLAGS += -Wall -O2 -g |
| 12 | +# Uncomment below for Red Hat/CentOS/Scientific Linux <= 7.1 |
| 13 | +# EXTRA_CFLAGS += -D__RHEL7__ |
| 14 | + |
| 15 | +NAME := imanager |
| 16 | + |
| 17 | +DEPMOD := $(shell which depmod) |
| 18 | +STRIP := $(shell which strip) |
| 19 | +DRVPATH := /lib/modules/$(shell uname -r)/extra/$(NAME) |
| 20 | + |
| 21 | +# MFD driver is always anabled. |
| 22 | +CONFIG_MFD := m |
| 23 | +CONFIG_GPIO := m |
| 24 | +CONFIG_I2C := m |
| 25 | +CONFIG_SENSORS := m |
| 26 | +CONFIG_BACKLIGHT := m |
| 27 | +CONFIG_WDT := m |
| 28 | + |
| 29 | +# If KERNELRELEASE is defined, we've been invoked from the |
| 30 | +# kernel build system and can use its language. |
| 31 | +ifneq ($(KERNELRELEASE), ) |
| 32 | + |
| 33 | + ccflags-y += $(EXTRA_CFLAGS) -I$(src)/include |
| 34 | + include $(src)/Makefile.kbuild |
| 35 | +else |
| 36 | + |
| 37 | +# Otherwise we were called directly from the command |
| 38 | +# line; invoke the kernel build system. |
| 39 | +KDIR := /lib/modules/$(shell uname -r)/build |
| 40 | +PWD := $(shell pwd) |
| 41 | + |
| 42 | +endif |
| 43 | + |
| 44 | +modules: |
| 45 | + $(MAKE) -C $(KDIR) M=$(PWD) modules |
| 46 | + |
| 47 | +clean: |
| 48 | + $(MAKE) -C $(KDIR) M=$(PWD) clean |
| 49 | + $(RM) -rf *.bak include/linux/mfd/imanager/*.bak |
| 50 | + |
| 51 | +install: modules |
| 52 | + $(MAKE) -C $(KDIR) M=$(PWD) INSTALL_MOD_DIR=extra/$(NAME) modules_install |
| 53 | + $(DEPMOD) -a |
| 54 | + |
| 55 | +uninstall: |
| 56 | + $(RM) -r $(DRVPATH) |
| 57 | + $(DEPMOD) -a |
| 58 | + |
0 commit comments