blob: b9e4e9663e3318609192b0a2729512f575c9c6fe [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 \
Johan Hovoldb15d97d2016-04-23 18:47:24 +02005 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 \
Greg Kroah-Hartmaned7279a2016-01-20 22:51:49 -080012 svc_watchdog.o \
Viresh Kumar5a53e022016-04-03 12:18:35 +053013 bootrom.o \
Johan Hovold5dda7e52016-01-19 12:50:59 +010014 operation.o \
15 legacy.o
Greg Kroah-Hartmane1308c12014-12-24 13:01:43 -080016
Viresh Kumarf5db53b2015-05-20 16:56:46 +053017gb-phy-y := gpbridge.o \
Viresh Kumar5357cf32015-01-21 16:10:40 +053018 sdio.o \
19 uart.o \
20 pwm.o \
Viresh Kumar15d651b2015-01-23 13:07:45 +053021 spi.o \
Mark Greerddc88ef2015-11-04 09:47:21 -070022 usb.o
Greg Kroah-Hartmanc8a797a2014-08-11 15:30:45 +080023
Viresh Kumar98abb412015-01-21 16:10:41 +053024# Prefix all modules with gb-
25gb-vibrator-y := vibrator.o
Rui Miguel Silva46488842015-11-12 15:35:59 +000026gb-power-supply-y := power_supply.o
Alexandre Bailon355a7052015-03-31 09:51:59 +020027gb-loopback-y := loopback.o
Rui Miguel Silva2870b522015-08-14 13:58:19 +010028gb-light-y := light.o
Greg Kroah-Hartmane806c7f2015-05-08 15:50:17 +020029gb-raw-y := raw.o
Greg Kroah-Hartmanc9e9de22015-11-04 20:46:14 -080030gb-hid-y := hid.o
Viresh Kumar98abb412015-01-21 16:10:41 +053031gb-es2-y := es2.o
Greg Kroah-Hartman1e5dd1f2015-12-30 13:38:33 -080032gb-arche-y := arche-platform.o arche-apb-ctrl.o
Vaibhav Agarwal57932272016-03-29 23:31:42 +053033gb-audio-module-y := audio_module.o audio_topology.o
34gb-audio-codec-y := audio_codec.o
Mark Greer184992e2016-01-13 14:07:46 -070035gb-audio-gb-y := audio_gb.o
Mark Greer4dbf5052016-01-13 14:07:47 -070036gb-audio-apbridgea-y := audio_apbridgea.o
Svetlin Ankov8db00732016-01-13 14:07:48 -070037gb-audio-manager-y += audio_manager.o
38gb-audio-manager-y += audio_manager_module.o
Laurent Pinchart3265eda2015-12-15 03:18:06 +020039gb-camera-y := camera.o
Viresh Kumarcca22202016-04-28 10:06:38 +053040gb-firmware-y := fw-core.o fw-download.o
Viresh Kumar7c0925e2016-05-09 18:15:06 +053041gb-gpio-y := gpio.o
Viresh Kumard6046b42016-05-09 18:15:07 +053042gb-i2c-y := i2c.o
Viresh Kumar98abb412015-01-21 16:10:41 +053043
Greg Kroah-Hartmanc8a797a2014-08-11 15:30:45 +080044obj-m += greybus.o
Greg Kroah-Hartman71479f62015-01-14 17:07:59 -080045obj-m += gb-phy.o
Greg Kroah-Hartman419a8cf2015-01-14 17:08:00 -080046obj-m += gb-vibrator.o
Rui Miguel Silva46488842015-11-12 15:35:59 +000047obj-m += gb-power-supply.o
Alexandre Bailon355a7052015-03-31 09:51:59 +020048obj-m += gb-loopback.o
Rui Miguel Silva2870b522015-08-14 13:58:19 +010049obj-m += gb-light.o
Greg Kroah-Hartmanc9e9de22015-11-04 20:46:14 -080050obj-m += gb-hid.o
Greg Kroah-Hartmane806c7f2015-05-08 15:50:17 +020051obj-m += gb-raw.o
Greg Kroah-Hartmanf5870272015-01-21 10:24:15 +080052obj-m += gb-es2.o
Greg Kroah-Hartman7d0493d2016-02-15 13:58:21 -080053ifeq ($(CONFIG_USB_HSIC_USB3613),y)
54 obj-m += gb-arche.o
55endif
Greg Kroah-Hartman7030f9242016-01-25 20:13:15 -080056ifeq ($(CONFIG_ARCH_MSM8994),y)
Vaibhav Agarwal2b8c2b52016-04-21 22:14:02 +053057 obj-m += gb-audio-codec.o
58 obj-m += gb-audio-module.o
Greg Kroah-Hartman7030f9242016-01-25 20:13:15 -080059 obj-m += gb-camera.o
60endif
Mark Greer184992e2016-01-13 14:07:46 -070061obj-m += gb-audio-gb.o
Mark Greer4dbf5052016-01-13 14:07:47 -070062obj-m += gb-audio-apbridgea.o
Svetlin Ankov8db00732016-01-13 14:07:48 -070063obj-m += gb-audio-manager.o
Viresh Kumar9e04fb72016-04-26 10:20:49 +053064obj-m += gb-firmware.o
Viresh Kumar7c0925e2016-05-09 18:15:06 +053065obj-m += gb-gpio.o
Viresh Kumard6046b42016-05-09 18:15:07 +053066obj-m += gb-i2c.o
Greg Kroah-Hartmanc8a797a2014-08-11 15:30:45 +080067
68KERNELVER ?= $(shell uname -r)
69KERNELDIR ?= /lib/modules/$(KERNELVER)/build
Bryan O'Donoghue68fff962015-05-07 17:00:50 -070070INSTALL_MOD_PATH ?= /..
Greg Kroah-Hartmanc8a797a2014-08-11 15:30:45 +080071PWD := $(shell pwd)
72
Rui Miguel Silva65cac602015-05-13 18:59:00 +010073# kernel config option that shall be enable
Rui Miguel Silva14006ab2016-01-13 14:39:55 +000074CONFIG_OPTIONS_ENABLE := POWER_SUPPLY PWM SYSFS SPI USB SND_SOC MMC LEDS_CLASS INPUT
Rui Miguel Silva65cac602015-05-13 18:59:00 +010075
76# kernel config option that shall be disable
77CONFIG_OPTIONS_DISABLE :=
78
79# this only run in kbuild part of the makefile
80ifneq ($(KERNELRELEASE),)
Rui Miguel Silva13fcfbb62015-08-14 13:58:18 +010081# This function returns the argument version if current kernel version is minor
82# than the passed version, return 1 if equal or the current kernel version if it
83# is greater than argument version.
Rui Miguel Silva1ab2e892015-08-16 00:48:03 +010084kvers_cmp=$(shell [ "$(KERNELVERSION)" = "$(1)" ] && echo 1 || printf "$(1)\n$(KERNELVERSION)" | sort -V | tail -1)
Rui Miguel Silva13fcfbb62015-08-14 13:58:18 +010085
86ifneq ($(call kvers_cmp,"3.19.0"),3.19.0)
87 CONFIG_OPTIONS_ENABLE += LEDS_CLASS_FLASH
88endif
89
90ifneq ($(call kvers_cmp,"4.2.0"),4.2.0)
91 CONFIG_OPTIONS_ENABLE += V4L2_FLASH_LED_CLASS
92endif
93
Rui Miguel Silva65cac602015-05-13 18:59:00 +010094$(foreach opt,$(CONFIG_OPTIONS_ENABLE),$(if $(CONFIG_$(opt)),, \
95 $(error CONFIG_$(opt) is disabled in the kernel configuration and must be enable \
96 to continue compilation)))
97$(foreach opt,$(CONFIG_OPTIONS_DISABLE),$(if $(filter m y, $(CONFIG_$(opt))), \
98 $(error CONFIG_$(opt) is enabled in the kernel configuration and must be disable \
99 to continue compilation),))
100endif
101
Greg Kroah-Hartman7486dfd2014-11-19 19:09:53 -0800102# add -Wall to try to catch everything we can.
Perry Hung3a97cdd2015-07-03 00:27:12 -0400103ccflags-y := -Wall
Greg Kroah-Hartman7486dfd2014-11-19 19:09:53 -0800104
Bryan O'Donoghue5c8ad592015-09-18 16:38:45 +0100105# needed for trace events
106ccflags-y += -I$(src)
107
Svetlin Ankov8db00732016-01-13 14:07:48 -0700108GB_AUDIO_MANAGER_SYSFS ?= true
109ifeq ($(GB_AUDIO_MANAGER_SYSFS),true)
110gb-audio-manager-y += audio_manager_sysfs.o
111ccflags-y += -DGB_AUDIO_MANAGER_SYSFS
112endif
113
Greg Kroah-Hartman70b3b3e2015-12-17 22:32:03 -0800114all: module
Greg Kroah-Hartman6b0658f2015-12-15 12:46:22 -0800115
116tools::
117 $(MAKE) -C tools KERNELDIR=$(realpath $(KERNELDIR))
Greg Kroah-Hartmanc8a797a2014-08-11 15:30:45 +0800118
119module:
120 $(MAKE) -C $(KERNELDIR) M=$(PWD)
121
Greg Kroah-Hartmanac7171e2014-09-13 12:39:23 -0700122check:
123 $(MAKE) -C $(KERNELDIR) M=$(PWD) C=2 CF="-D__CHECK_ENDIAN__"
124
Greg Kroah-Hartmanc8a797a2014-08-11 15:30:45 +0800125clean:
126 rm -f *.o *~ core .depend .*.cmd *.ko *.mod.c
127 rm -f Module.markers Module.symvers modules.order
128 rm -rf .tmp_versions Modules.symvers
Greg Kroah-Hartman6b0658f2015-12-15 12:46:22 -0800129 $(MAKE) -C tools clean
Greg Kroah-Hartmanc8a797a2014-08-11 15:30:45 +0800130
131coccicheck:
132 $(MAKE) -C $(KERNELDIR) M=$(PWD) coccicheck
133
Greg Kroah-Hartman025677d2015-01-14 14:55:24 -0800134install: module
Bryan O'Donoghue68fff962015-05-07 17:00:50 -0700135 mkdir -p $(INSTALL_MOD_PATH)/lib/modules/$(KERNELVER)/kernel/drivers/greybus/
136 cp -f *.ko $(INSTALL_MOD_PATH)/lib/modules/$(KERNELVER)/kernel/drivers/greybus/
137 depmod -b $(INSTALL_MOD_PATH) -a $(KERNELVER)