blob: b1272cbd55ee4f3f46cdbee04b83de3f7cc241af [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 \
Johan Hovold7bc6faa2015-11-03 18:03:22 +01003 hd.o \
Alex Elderb09c94a2014-10-01 21:54:16 -05004 manifest.o \
Greg Kroah-Hartmana93938a2014-12-19 14:56:30 -08005 interface.o \
Greg Kroah-Hartman3bdec692014-12-12 17:10:16 -05006 bundle.o \
Alex Elderc68adb22014-10-01 21:54:14 -05007 connection.o \
Alex Elder4ccb6b72014-10-28 19:36:00 -05008 protocol.o \
Viresh Kumarcdee4f72015-06-22 16:42:26 +05309 control.o \
Viresh Kumarab69c4c2015-07-03 17:00:29 +053010 svc.o \
Viresh Kumar90f1b612015-08-12 09:19:33 +053011 firmware.o \
Greg Kroah-Hartmane1308c12014-12-24 13:01:43 -080012 operation.o
13
Viresh Kumarf5db53b2015-05-20 16:56:46 +053014gb-phy-y := gpbridge.o \
Viresh Kumar5357cf32015-01-21 16:10:40 +053015 sdio.o \
16 uart.o \
17 pwm.o \
18 gpio.o \
19 i2c.o \
Viresh Kumar15d651b2015-01-23 13:07:45 +053020 spi.o \
Mark Greerddc88ef2015-11-04 09:47:21 -070021 usb.o
Greg Kroah-Hartmanc8a797a2014-08-11 15:30:45 +080022
Viresh Kumar98abb412015-01-21 16:10:41 +053023# Prefix all modules with gb-
24gb-vibrator-y := vibrator.o
Rui Miguel Silva46488842015-11-12 15:35:59 +000025gb-power-supply-y := power_supply.o
Alexandre Bailon355a7052015-03-31 09:51:59 +020026gb-loopback-y := loopback.o
Rui Miguel Silva2870b522015-08-14 13:58:19 +010027gb-light-y := light.o
Greg Kroah-Hartmane806c7f2015-05-08 15:50:17 +020028gb-raw-y := raw.o
Greg Kroah-Hartmanc9e9de22015-11-04 20:46:14 -080029gb-hid-y := hid.o
Viresh Kumar98abb412015-01-21 16:10:41 +053030gb-es2-y := es2.o
Greg Kroah-Hartman1e5dd1f2015-12-30 13:38:33 -080031gb-arche-y := arche-platform.o arche-apb-ctrl.o
Vaibhav Agarwal6339d232016-01-13 14:07:51 -070032gb-audio-codec-y := audio_codec.o audio_topology.o
Mark Greer184992e2016-01-13 14:07:46 -070033gb-audio-gb-y := audio_gb.o
Mark Greer4dbf5052016-01-13 14:07:47 -070034gb-audio-apbridgea-y := audio_apbridgea.o
Svetlin Ankov8db00732016-01-13 14:07:48 -070035gb-audio-manager-y += audio_manager.o
36gb-audio-manager-y += audio_manager_module.o
Laurent Pinchart3265eda2015-12-15 03:18:06 +020037gb-camera-y := camera.o
Viresh Kumar98abb412015-01-21 16:10:41 +053038
Greg Kroah-Hartmanc8a797a2014-08-11 15:30:45 +080039obj-m += greybus.o
Greg Kroah-Hartman71479f62015-01-14 17:07:59 -080040obj-m += gb-phy.o
Greg Kroah-Hartman419a8cf2015-01-14 17:08:00 -080041obj-m += gb-vibrator.o
Rui Miguel Silva46488842015-11-12 15:35:59 +000042obj-m += gb-power-supply.o
Alexandre Bailon355a7052015-03-31 09:51:59 +020043obj-m += gb-loopback.o
Rui Miguel Silva2870b522015-08-14 13:58:19 +010044obj-m += gb-light.o
Greg Kroah-Hartmanc9e9de22015-11-04 20:46:14 -080045obj-m += gb-hid.o
Greg Kroah-Hartmane806c7f2015-05-08 15:50:17 +020046obj-m += gb-raw.o
Greg Kroah-Hartmanf5870272015-01-21 10:24:15 +080047obj-m += gb-es2.o
Vaibhav Hiremath7fa60652015-12-16 16:29:18 +053048obj-m += gb-arche.o
Vaibhav Agarwal78853422016-01-13 14:07:49 -070049ifeq ($(CONFIG_SND_SOC_DYNAMIC_DAILINK),y)
50 obj-m += gb-audio-codec.o
51endif
Laurent Pinchart3265eda2015-12-15 03:18:06 +020052obj-m += gb-camera.o
Mark Greer184992e2016-01-13 14:07:46 -070053obj-m += gb-audio-gb.o
Mark Greer4dbf5052016-01-13 14:07:47 -070054obj-m += gb-audio-apbridgea.o
Svetlin Ankov8db00732016-01-13 14:07:48 -070055obj-m += gb-audio-manager.o
Greg Kroah-Hartmanc8a797a2014-08-11 15:30:45 +080056
57KERNELVER ?= $(shell uname -r)
58KERNELDIR ?= /lib/modules/$(KERNELVER)/build
Bryan O'Donoghue68fff962015-05-07 17:00:50 -070059INSTALL_MOD_PATH ?= /..
Greg Kroah-Hartmanc8a797a2014-08-11 15:30:45 +080060PWD := $(shell pwd)
61
Rui Miguel Silva65cac602015-05-13 18:59:00 +010062# kernel config option that shall be enable
Rui Miguel Silva14006ab2016-01-13 14:39:55 +000063CONFIG_OPTIONS_ENABLE := POWER_SUPPLY PWM SYSFS SPI USB SND_SOC MMC LEDS_CLASS INPUT
Rui Miguel Silva65cac602015-05-13 18:59:00 +010064
65# kernel config option that shall be disable
66CONFIG_OPTIONS_DISABLE :=
67
68# this only run in kbuild part of the makefile
69ifneq ($(KERNELRELEASE),)
Rui Miguel Silva13fcfbb62015-08-14 13:58:18 +010070# This function returns the argument version if current kernel version is minor
71# than the passed version, return 1 if equal or the current kernel version if it
72# is greater than argument version.
Rui Miguel Silva1ab2e892015-08-16 00:48:03 +010073kvers_cmp=$(shell [ "$(KERNELVERSION)" = "$(1)" ] && echo 1 || printf "$(1)\n$(KERNELVERSION)" | sort -V | tail -1)
Rui Miguel Silva13fcfbb62015-08-14 13:58:18 +010074
75ifneq ($(call kvers_cmp,"3.19.0"),3.19.0)
76 CONFIG_OPTIONS_ENABLE += LEDS_CLASS_FLASH
77endif
78
79ifneq ($(call kvers_cmp,"4.2.0"),4.2.0)
80 CONFIG_OPTIONS_ENABLE += V4L2_FLASH_LED_CLASS
81endif
82
Rui Miguel Silva65cac602015-05-13 18:59:00 +010083$(foreach opt,$(CONFIG_OPTIONS_ENABLE),$(if $(CONFIG_$(opt)),, \
84 $(error CONFIG_$(opt) is disabled in the kernel configuration and must be enable \
85 to continue compilation)))
86$(foreach opt,$(CONFIG_OPTIONS_DISABLE),$(if $(filter m y, $(CONFIG_$(opt))), \
87 $(error CONFIG_$(opt) is enabled in the kernel configuration and must be disable \
88 to continue compilation),))
89endif
90
Greg Kroah-Hartman7486dfd2014-11-19 19:09:53 -080091# add -Wall to try to catch everything we can.
Perry Hung3a97cdd2015-07-03 00:27:12 -040092ccflags-y := -Wall
Greg Kroah-Hartman7486dfd2014-11-19 19:09:53 -080093
Bryan O'Donoghue5c8ad592015-09-18 16:38:45 +010094# needed for trace events
95ccflags-y += -I$(src)
96
Svetlin Ankov8db00732016-01-13 14:07:48 -070097GB_AUDIO_MANAGER_SYSFS ?= true
98ifeq ($(GB_AUDIO_MANAGER_SYSFS),true)
99gb-audio-manager-y += audio_manager_sysfs.o
100ccflags-y += -DGB_AUDIO_MANAGER_SYSFS
101endif
102
Greg Kroah-Hartman70b3b3e2015-12-17 22:32:03 -0800103all: module
Greg Kroah-Hartman6b0658f2015-12-15 12:46:22 -0800104
105tools::
106 $(MAKE) -C tools KERNELDIR=$(realpath $(KERNELDIR))
Greg Kroah-Hartmanc8a797a2014-08-11 15:30:45 +0800107
108module:
109 $(MAKE) -C $(KERNELDIR) M=$(PWD)
110
Greg Kroah-Hartmanac7171e2014-09-13 12:39:23 -0700111check:
112 $(MAKE) -C $(KERNELDIR) M=$(PWD) C=2 CF="-D__CHECK_ENDIAN__"
113
Greg Kroah-Hartmanc8a797a2014-08-11 15:30:45 +0800114clean:
115 rm -f *.o *~ core .depend .*.cmd *.ko *.mod.c
116 rm -f Module.markers Module.symvers modules.order
117 rm -rf .tmp_versions Modules.symvers
Greg Kroah-Hartman6b0658f2015-12-15 12:46:22 -0800118 $(MAKE) -C tools clean
Greg Kroah-Hartmanc8a797a2014-08-11 15:30:45 +0800119
120coccicheck:
121 $(MAKE) -C $(KERNELDIR) M=$(PWD) coccicheck
122
Greg Kroah-Hartman025677d2015-01-14 14:55:24 -0800123install: module
Bryan O'Donoghue68fff962015-05-07 17:00:50 -0700124 mkdir -p $(INSTALL_MOD_PATH)/lib/modules/$(KERNELVER)/kernel/drivers/greybus/
125 cp -f *.ko $(INSTALL_MOD_PATH)/lib/modules/$(KERNELVER)/kernel/drivers/greybus/
126 depmod -b $(INSTALL_MOD_PATH) -a $(KERNELVER)