blob: bffb1bdb6b6c3ef467b537400056766eb27fefd9 [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 uart.o \
Viresh Kumar15d651b2015-01-23 13:07:45 +053019 spi.o \
Mark Greerddc88ef2015-11-04 09:47:21 -070020 usb.o
Greg Kroah-Hartmanc8a797a2014-08-11 15:30:45 +080021
Viresh Kumar98abb412015-01-21 16:10:41 +053022# Prefix all modules with gb-
23gb-vibrator-y := vibrator.o
Rui Miguel Silva46488842015-11-12 15:35:59 +000024gb-power-supply-y := power_supply.o
Alexandre Bailon355a7052015-03-31 09:51:59 +020025gb-loopback-y := loopback.o
Rui Miguel Silva2870b522015-08-14 13:58:19 +010026gb-light-y := light.o
Greg Kroah-Hartmane806c7f2015-05-08 15:50:17 +020027gb-raw-y := raw.o
Greg Kroah-Hartmanc9e9de22015-11-04 20:46:14 -080028gb-hid-y := hid.o
Viresh Kumar98abb412015-01-21 16:10:41 +053029gb-es2-y := es2.o
Greg Kroah-Hartman1e5dd1f2015-12-30 13:38:33 -080030gb-arche-y := arche-platform.o arche-apb-ctrl.o
Vaibhav Agarwal57932272016-03-29 23:31:42 +053031gb-audio-module-y := audio_module.o audio_topology.o
32gb-audio-codec-y := audio_codec.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 Kumarcca22202016-04-28 10:06:38 +053038gb-firmware-y := fw-core.o fw-download.o
Viresh Kumar3d647302016-05-09 18:15:09 +053039gb-sdio-y := sdio.o
Viresh Kumardca80602016-05-09 18:15:08 +053040gb-pwm-y := pwm.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 Kumar3d647302016-05-09 18:15:09 +053065obj-m += gb-sdio.o
Viresh Kumardca80602016-05-09 18:15:08 +053066obj-m += gb-pwm.o
Viresh Kumar7c0925e2016-05-09 18:15:06 +053067obj-m += gb-gpio.o
Viresh Kumard6046b42016-05-09 18:15:07 +053068obj-m += gb-i2c.o
Greg Kroah-Hartmanc8a797a2014-08-11 15:30:45 +080069
70KERNELVER ?= $(shell uname -r)
71KERNELDIR ?= /lib/modules/$(KERNELVER)/build
Bryan O'Donoghue68fff962015-05-07 17:00:50 -070072INSTALL_MOD_PATH ?= /..
Greg Kroah-Hartmanc8a797a2014-08-11 15:30:45 +080073PWD := $(shell pwd)
74
Rui Miguel Silva65cac602015-05-13 18:59:00 +010075# kernel config option that shall be enable
Rui Miguel Silva14006ab2016-01-13 14:39:55 +000076CONFIG_OPTIONS_ENABLE := POWER_SUPPLY PWM SYSFS SPI USB SND_SOC MMC LEDS_CLASS INPUT
Rui Miguel Silva65cac602015-05-13 18:59:00 +010077
78# kernel config option that shall be disable
79CONFIG_OPTIONS_DISABLE :=
80
81# this only run in kbuild part of the makefile
82ifneq ($(KERNELRELEASE),)
Rui Miguel Silva13fcfbb62015-08-14 13:58:18 +010083# This function returns the argument version if current kernel version is minor
84# than the passed version, return 1 if equal or the current kernel version if it
85# is greater than argument version.
Rui Miguel Silva1ab2e892015-08-16 00:48:03 +010086kvers_cmp=$(shell [ "$(KERNELVERSION)" = "$(1)" ] && echo 1 || printf "$(1)\n$(KERNELVERSION)" | sort -V | tail -1)
Rui Miguel Silva13fcfbb62015-08-14 13:58:18 +010087
88ifneq ($(call kvers_cmp,"3.19.0"),3.19.0)
89 CONFIG_OPTIONS_ENABLE += LEDS_CLASS_FLASH
90endif
91
92ifneq ($(call kvers_cmp,"4.2.0"),4.2.0)
93 CONFIG_OPTIONS_ENABLE += V4L2_FLASH_LED_CLASS
94endif
95
Rui Miguel Silva65cac602015-05-13 18:59:00 +010096$(foreach opt,$(CONFIG_OPTIONS_ENABLE),$(if $(CONFIG_$(opt)),, \
97 $(error CONFIG_$(opt) is disabled in the kernel configuration and must be enable \
98 to continue compilation)))
99$(foreach opt,$(CONFIG_OPTIONS_DISABLE),$(if $(filter m y, $(CONFIG_$(opt))), \
100 $(error CONFIG_$(opt) is enabled in the kernel configuration and must be disable \
101 to continue compilation),))
102endif
103
Greg Kroah-Hartman7486dfd2014-11-19 19:09:53 -0800104# add -Wall to try to catch everything we can.
Perry Hung3a97cdd2015-07-03 00:27:12 -0400105ccflags-y := -Wall
Greg Kroah-Hartman7486dfd2014-11-19 19:09:53 -0800106
Bryan O'Donoghue5c8ad592015-09-18 16:38:45 +0100107# needed for trace events
108ccflags-y += -I$(src)
109
Svetlin Ankov8db00732016-01-13 14:07:48 -0700110GB_AUDIO_MANAGER_SYSFS ?= true
111ifeq ($(GB_AUDIO_MANAGER_SYSFS),true)
112gb-audio-manager-y += audio_manager_sysfs.o
113ccflags-y += -DGB_AUDIO_MANAGER_SYSFS
114endif
115
Greg Kroah-Hartman70b3b3e2015-12-17 22:32:03 -0800116all: module
Greg Kroah-Hartman6b0658f2015-12-15 12:46:22 -0800117
118tools::
119 $(MAKE) -C tools KERNELDIR=$(realpath $(KERNELDIR))
Greg Kroah-Hartmanc8a797a2014-08-11 15:30:45 +0800120
121module:
122 $(MAKE) -C $(KERNELDIR) M=$(PWD)
123
Greg Kroah-Hartmanac7171e2014-09-13 12:39:23 -0700124check:
125 $(MAKE) -C $(KERNELDIR) M=$(PWD) C=2 CF="-D__CHECK_ENDIAN__"
126
Greg Kroah-Hartmanc8a797a2014-08-11 15:30:45 +0800127clean:
128 rm -f *.o *~ core .depend .*.cmd *.ko *.mod.c
129 rm -f Module.markers Module.symvers modules.order
130 rm -rf .tmp_versions Modules.symvers
Greg Kroah-Hartman6b0658f2015-12-15 12:46:22 -0800131 $(MAKE) -C tools clean
Greg Kroah-Hartmanc8a797a2014-08-11 15:30:45 +0800132
133coccicheck:
134 $(MAKE) -C $(KERNELDIR) M=$(PWD) coccicheck
135
Greg Kroah-Hartman025677d2015-01-14 14:55:24 -0800136install: module
Bryan O'Donoghue68fff962015-05-07 17:00:50 -0700137 mkdir -p $(INSTALL_MOD_PATH)/lib/modules/$(KERNELVER)/kernel/drivers/greybus/
138 cp -f *.ko $(INSTALL_MOD_PATH)/lib/modules/$(KERNELVER)/kernel/drivers/greybus/
139 depmod -b $(INSTALL_MOD_PATH) -a $(KERNELVER)