blob: 4ebdc6b9c89f307e25f4182bd8a278be475db926 [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
Mark Greerfd8f9e12016-01-13 14:07:44 -070032gb-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 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 Agarwald3d2af52015-11-23 15:57:45 +053049obj-m += gb-audio-codec.o
Laurent Pinchart3265eda2015-12-15 03:18:06 +020050obj-m += gb-camera.o
Mark Greer184992e2016-01-13 14:07:46 -070051obj-m += gb-audio-gb.o
Mark Greer4dbf5052016-01-13 14:07:47 -070052obj-m += gb-audio-apbridgea.o
Svetlin Ankov8db00732016-01-13 14:07:48 -070053obj-m += gb-audio-manager.o
Greg Kroah-Hartmanc8a797a2014-08-11 15:30:45 +080054
55KERNELVER ?= $(shell uname -r)
56KERNELDIR ?= /lib/modules/$(KERNELVER)/build
Bryan O'Donoghue68fff962015-05-07 17:00:50 -070057INSTALL_MOD_PATH ?= /..
Greg Kroah-Hartmanc8a797a2014-08-11 15:30:45 +080058PWD := $(shell pwd)
59
Rui Miguel Silva65cac602015-05-13 18:59:00 +010060# kernel config option that shall be enable
Rui Miguel Silva14006ab2016-01-13 14:39:55 +000061CONFIG_OPTIONS_ENABLE := POWER_SUPPLY PWM SYSFS SPI USB SND_SOC MMC LEDS_CLASS INPUT
Rui Miguel Silva65cac602015-05-13 18:59:00 +010062
63# kernel config option that shall be disable
64CONFIG_OPTIONS_DISABLE :=
65
66# this only run in kbuild part of the makefile
67ifneq ($(KERNELRELEASE),)
Rui Miguel Silva13fcfbb62015-08-14 13:58:18 +010068# This function returns the argument version if current kernel version is minor
69# than the passed version, return 1 if equal or the current kernel version if it
70# is greater than argument version.
Rui Miguel Silva1ab2e892015-08-16 00:48:03 +010071kvers_cmp=$(shell [ "$(KERNELVERSION)" = "$(1)" ] && echo 1 || printf "$(1)\n$(KERNELVERSION)" | sort -V | tail -1)
Rui Miguel Silva13fcfbb62015-08-14 13:58:18 +010072
73ifneq ($(call kvers_cmp,"3.19.0"),3.19.0)
74 CONFIG_OPTIONS_ENABLE += LEDS_CLASS_FLASH
75endif
76
77ifneq ($(call kvers_cmp,"4.2.0"),4.2.0)
78 CONFIG_OPTIONS_ENABLE += V4L2_FLASH_LED_CLASS
79endif
80
Rui Miguel Silva65cac602015-05-13 18:59:00 +010081$(foreach opt,$(CONFIG_OPTIONS_ENABLE),$(if $(CONFIG_$(opt)),, \
82 $(error CONFIG_$(opt) is disabled in the kernel configuration and must be enable \
83 to continue compilation)))
84$(foreach opt,$(CONFIG_OPTIONS_DISABLE),$(if $(filter m y, $(CONFIG_$(opt))), \
85 $(error CONFIG_$(opt) is enabled in the kernel configuration and must be disable \
86 to continue compilation),))
87endif
88
Greg Kroah-Hartman7486dfd2014-11-19 19:09:53 -080089# add -Wall to try to catch everything we can.
Perry Hung3a97cdd2015-07-03 00:27:12 -040090ccflags-y := -Wall
Greg Kroah-Hartman7486dfd2014-11-19 19:09:53 -080091
Bryan O'Donoghue5c8ad592015-09-18 16:38:45 +010092# needed for trace events
93ccflags-y += -I$(src)
94
Svetlin Ankov8db00732016-01-13 14:07:48 -070095GB_AUDIO_MANAGER_SYSFS ?= true
96ifeq ($(GB_AUDIO_MANAGER_SYSFS),true)
97gb-audio-manager-y += audio_manager_sysfs.o
98ccflags-y += -DGB_AUDIO_MANAGER_SYSFS
99endif
100
Greg Kroah-Hartman70b3b3e2015-12-17 22:32:03 -0800101all: module
Greg Kroah-Hartman6b0658f2015-12-15 12:46:22 -0800102
103tools::
104 $(MAKE) -C tools KERNELDIR=$(realpath $(KERNELDIR))
Greg Kroah-Hartmanc8a797a2014-08-11 15:30:45 +0800105
106module:
107 $(MAKE) -C $(KERNELDIR) M=$(PWD)
108
Greg Kroah-Hartmanac7171e2014-09-13 12:39:23 -0700109check:
110 $(MAKE) -C $(KERNELDIR) M=$(PWD) C=2 CF="-D__CHECK_ENDIAN__"
111
Greg Kroah-Hartmanc8a797a2014-08-11 15:30:45 +0800112clean:
113 rm -f *.o *~ core .depend .*.cmd *.ko *.mod.c
114 rm -f Module.markers Module.symvers modules.order
115 rm -rf .tmp_versions Modules.symvers
Greg Kroah-Hartman6b0658f2015-12-15 12:46:22 -0800116 $(MAKE) -C tools clean
Greg Kroah-Hartmanc8a797a2014-08-11 15:30:45 +0800117
118coccicheck:
119 $(MAKE) -C $(KERNELDIR) M=$(PWD) coccicheck
120
Greg Kroah-Hartman025677d2015-01-14 14:55:24 -0800121install: module
Bryan O'Donoghue68fff962015-05-07 17:00:50 -0700122 mkdir -p $(INSTALL_MOD_PATH)/lib/modules/$(KERNELVER)/kernel/drivers/greybus/
123 cp -f *.ko $(INSTALL_MOD_PATH)/lib/modules/$(KERNELVER)/kernel/drivers/greybus/
124 depmod -b $(INSTALL_MOD_PATH) -a $(KERNELVER)