blob: 5c29b63c6c2842cd81750bfb9e0bed1af18bd1b3 [file] [log] [blame]
Greg Kroah-Hartmande536e32014-08-31 16:17:04 -07001greybus-y := core.o \
Greg Kroah-Hartmande536e32014-08-31 16:17:04 -07002 debugfs.o \
Alex Elderb09c94a2014-10-01 21:54:16 -05003 manifest.o \
Greg Kroah-Hartman0f035ac2015-04-07 20:26:53 +02004 endo.o \
Greg Kroah-Hartmandf671552014-12-21 14:10:26 -08005 module.o \
Greg Kroah-Hartmana93938a2014-12-19 14:56:30 -08006 interface.o \
Greg Kroah-Hartman3bdec692014-12-12 17:10:16 -05007 bundle.o \
Alex Elderc68adb22014-10-01 21:54:14 -05008 connection.o \
Alex Elder4ccb6b72014-10-28 19:36:00 -05009 protocol.o \
Viresh Kumarcdee4f72015-06-22 16:42:26 +053010 control.o \
Viresh Kumarab69c4c2015-07-03 17:00:29 +053011 svc.o \
Viresh Kumar90f1b612015-08-12 09:19:33 +053012 firmware.o \
Greg Kroah-Hartmane1308c12014-12-24 13:01:43 -080013 operation.o
14
Viresh Kumarf5db53b2015-05-20 16:56:46 +053015gb-phy-y := gpbridge.o \
Viresh Kumar5357cf32015-01-21 16:10:40 +053016 sdio.o \
17 uart.o \
18 pwm.o \
19 gpio.o \
Viresh Kumar96eab772015-03-16 16:49:37 +053020 hid.o \
Viresh Kumar5357cf32015-01-21 16:10:40 +053021 i2c.o \
Viresh Kumar15d651b2015-01-23 13:07:45 +053022 spi.o \
John Stultza4749bb2015-05-08 12:57:36 -070023 usb.o \
24 audio.o \
25 audio-pcm.o \
26 audio-dai.o \
27 audio-gb-cmds.o
Greg Kroah-Hartmanc8a797a2014-08-11 15:30:45 +080028
Viresh Kumar98abb412015-01-21 16:10:41 +053029# Prefix all modules with gb-
30gb-vibrator-y := vibrator.o
31gb-battery-y := battery.o
Alexandre Bailon355a7052015-03-31 09:51:59 +020032gb-loopback-y := loopback.o
Rui Miguel Silva2870b522015-08-14 13:58:19 +010033gb-light-y := light.o
Greg Kroah-Hartmane806c7f2015-05-08 15:50:17 +020034gb-raw-y := raw.o
Viresh Kumar98abb412015-01-21 16:10:41 +053035gb-es1-y := es1.o
36gb-es2-y := es2.o
37
Greg Kroah-Hartmanc8a797a2014-08-11 15:30:45 +080038obj-m += greybus.o
Greg Kroah-Hartman71479f62015-01-14 17:07:59 -080039obj-m += gb-phy.o
Greg Kroah-Hartman419a8cf2015-01-14 17:08:00 -080040obj-m += gb-vibrator.o
Greg Kroah-Hartman347fedb2015-01-14 17:08:01 -080041obj-m += gb-battery.o
Alexandre Bailon355a7052015-03-31 09:51:59 +020042obj-m += gb-loopback.o
Rui Miguel Silva2870b522015-08-14 13:58:19 +010043obj-m += gb-light.o
Greg Kroah-Hartmane806c7f2015-05-08 15:50:17 +020044obj-m += gb-raw.o
Greg Kroah-Hartman60a7ad72015-01-14 17:08:02 -080045obj-m += gb-es1.o
Greg Kroah-Hartmanf5870272015-01-21 10:24:15 +080046obj-m += gb-es2.o
Greg Kroah-Hartmanc8a797a2014-08-11 15:30:45 +080047
48KERNELVER ?= $(shell uname -r)
49KERNELDIR ?= /lib/modules/$(KERNELVER)/build
Bryan O'Donoghue68fff962015-05-07 17:00:50 -070050INSTALL_MOD_PATH ?= /..
Greg Kroah-Hartmanc8a797a2014-08-11 15:30:45 +080051PWD := $(shell pwd)
52
Rui Miguel Silva65cac602015-05-13 18:59:00 +010053# kernel config option that shall be enable
Rui Miguel Silva13fcfbb62015-08-14 13:58:18 +010054CONFIG_OPTIONS_ENABLE := SYSFS SPI USB SND_SOC MMC LEDS_CLASS
Rui Miguel Silva65cac602015-05-13 18:59:00 +010055
56# kernel config option that shall be disable
57CONFIG_OPTIONS_DISABLE :=
58
59# this only run in kbuild part of the makefile
60ifneq ($(KERNELRELEASE),)
Rui Miguel Silva13fcfbb62015-08-14 13:58:18 +010061# This function returns the argument version if current kernel version is minor
62# than the passed version, return 1 if equal or the current kernel version if it
63# is greater than argument version.
64kvers_cmp=$(shell [[ "$(KERNELVERSION)" == "$(1)" ]] && echo 1 || echo -e "$(1)\n$(KERNELVERSION)" | sort -V | tail -1)
65
66ifneq ($(call kvers_cmp,"3.19.0"),3.19.0)
67 CONFIG_OPTIONS_ENABLE += LEDS_CLASS_FLASH
68endif
69
70ifneq ($(call kvers_cmp,"4.2.0"),4.2.0)
71 CONFIG_OPTIONS_ENABLE += V4L2_FLASH_LED_CLASS
72endif
73
Rui Miguel Silva65cac602015-05-13 18:59:00 +010074$(foreach opt,$(CONFIG_OPTIONS_ENABLE),$(if $(CONFIG_$(opt)),, \
75 $(error CONFIG_$(opt) is disabled in the kernel configuration and must be enable \
76 to continue compilation)))
77$(foreach opt,$(CONFIG_OPTIONS_DISABLE),$(if $(filter m y, $(CONFIG_$(opt))), \
78 $(error CONFIG_$(opt) is enabled in the kernel configuration and must be disable \
79 to continue compilation),))
80endif
81
Greg Kroah-Hartman7486dfd2014-11-19 19:09:53 -080082# add -Wall to try to catch everything we can.
Perry Hung3a97cdd2015-07-03 00:27:12 -040083ccflags-y := -Wall
Greg Kroah-Hartman7486dfd2014-11-19 19:09:53 -080084
Greg Kroah-Hartmanc8a797a2014-08-11 15:30:45 +080085all: module
86
87module:
88 $(MAKE) -C $(KERNELDIR) M=$(PWD)
89
Greg Kroah-Hartmanac7171e2014-09-13 12:39:23 -070090check:
91 $(MAKE) -C $(KERNELDIR) M=$(PWD) C=2 CF="-D__CHECK_ENDIAN__"
92
Greg Kroah-Hartmanc8a797a2014-08-11 15:30:45 +080093clean:
94 rm -f *.o *~ core .depend .*.cmd *.ko *.mod.c
95 rm -f Module.markers Module.symvers modules.order
96 rm -rf .tmp_versions Modules.symvers
97
98coccicheck:
99 $(MAKE) -C $(KERNELDIR) M=$(PWD) coccicheck
100
Greg Kroah-Hartman025677d2015-01-14 14:55:24 -0800101install: module
Bryan O'Donoghue68fff962015-05-07 17:00:50 -0700102 mkdir -p $(INSTALL_MOD_PATH)/lib/modules/$(KERNELVER)/kernel/drivers/greybus/
103 cp -f *.ko $(INSTALL_MOD_PATH)/lib/modules/$(KERNELVER)/kernel/drivers/greybus/
104 depmod -b $(INSTALL_MOD_PATH) -a $(KERNELVER)