Skip to content

Commit e41aadd

Browse files
author
root
committed
Add Makefile
1 parent 1605430 commit e41aadd

File tree

2 files changed

+82
-0
lines changed

2 files changed

+82
-0
lines changed

Makefile

Lines changed: 58 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,58 @@
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+

Makefile.kbuild

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
################################################################################
2+
# Makefile.kbuild - Build receipe for Linux kernel modules
3+
#
4+
# Copyright (C) 2015 Advantech Corp., Irvine, CA, USA
5+
# Author: Richard Vidal-Dorsch <[email protected]>
6+
################################################################################
7+
8+
$(NAME)-objs := $(NAME)-core.o $(NAME)-ec.o
9+
obj-$(CONFIG_MFD) += $(NAME).o
10+
11+
gpio-$(NAME)-objs := $(NAME)-gpio.o $(NAME)-ec-gpio.o
12+
obj-$(CONFIG_GPIO) += gpio-$(NAME).o
13+
14+
i2c-$(NAME)-objs := $(NAME)-i2c.o $(NAME)-ec-i2c.o
15+
obj-$(CONFIG_I2C) += i2c-$(NAME).o
16+
17+
$(NAME)_hwmon-objs := $(NAME)-hwmon.o $(NAME)-ec-hwmon.o
18+
obj-$(CONFIG_SENSORS) += $(NAME)_hwmon.o
19+
20+
$(NAME)_bl-objs := $(NAME)-bl.o $(NAME)-ec-bl.o
21+
obj-$(CONFIG_BACKLIGHT) += $(NAME)_bl.o
22+
23+
$(NAME)_wdt-objs := $(NAME)-wdt.o $(NAME)-ec-wdt.o
24+
obj-$(CONFIG_WDT) += $(NAME)_wdt.o

0 commit comments

Comments
 (0)