Greg Kroah-Hartman | de536e3 | 2014-08-31 16:17:04 -0700 | [diff] [blame] | 1 | greybus-y := core.o \ |
Greg Kroah-Hartman | de536e3 | 2014-08-31 16:17:04 -0700 | [diff] [blame] | 2 | debugfs.o \ |
Johan Hovold | 7bc6faa | 2015-11-03 18:03:22 +0100 | [diff] [blame] | 3 | hd.o \ |
Alex Elder | b09c94a | 2014-10-01 21:54:16 -0500 | [diff] [blame] | 4 | manifest.o \ |
Johan Hovold | b15d97d | 2016-04-23 18:47:24 +0200 | [diff] [blame] | 5 | module.o \ |
Greg Kroah-Hartman | a93938a | 2014-12-19 14:56:30 -0800 | [diff] [blame] | 6 | interface.o \ |
Greg Kroah-Hartman | 3bdec69 | 2014-12-12 17:10:16 -0500 | [diff] [blame] | 7 | bundle.o \ |
Alex Elder | c68adb2 | 2014-10-01 21:54:14 -0500 | [diff] [blame] | 8 | connection.o \ |
Alex Elder | 4ccb6b7 | 2014-10-28 19:36:00 -0500 | [diff] [blame] | 9 | protocol.o \ |
Viresh Kumar | cdee4f7 | 2015-06-22 16:42:26 +0530 | [diff] [blame] | 10 | control.o \ |
Viresh Kumar | ab69c4c | 2015-07-03 17:00:29 +0530 | [diff] [blame] | 11 | svc.o \ |
Greg Kroah-Hartman | ed7279a | 2016-01-20 22:51:49 -0800 | [diff] [blame] | 12 | svc_watchdog.o \ |
Viresh Kumar | 5a53e02 | 2016-04-03 12:18:35 +0530 | [diff] [blame] | 13 | bootrom.o \ |
Johan Hovold | 5dda7e5 | 2016-01-19 12:50:59 +0100 | [diff] [blame] | 14 | operation.o \ |
| 15 | legacy.o |
Greg Kroah-Hartman | e1308c1 | 2014-12-24 13:01:43 -0800 | [diff] [blame] | 16 | |
Viresh Kumar | f5db53b | 2015-05-20 16:56:46 +0530 | [diff] [blame] | 17 | gb-phy-y := gpbridge.o \ |
Viresh Kumar | 5357cf3 | 2015-01-21 16:10:40 +0530 | [diff] [blame] | 18 | sdio.o \ |
| 19 | uart.o \ |
| 20 | pwm.o \ |
| 21 | gpio.o \ |
| 22 | i2c.o \ |
Viresh Kumar | 15d651b | 2015-01-23 13:07:45 +0530 | [diff] [blame] | 23 | spi.o \ |
Mark Greer | ddc88ef | 2015-11-04 09:47:21 -0700 | [diff] [blame] | 24 | usb.o |
Greg Kroah-Hartman | c8a797a | 2014-08-11 15:30:45 +0800 | [diff] [blame] | 25 | |
Viresh Kumar | 98abb41 | 2015-01-21 16:10:41 +0530 | [diff] [blame] | 26 | # Prefix all modules with gb- |
| 27 | gb-vibrator-y := vibrator.o |
Rui Miguel Silva | 4648884 | 2015-11-12 15:35:59 +0000 | [diff] [blame] | 28 | gb-power-supply-y := power_supply.o |
Alexandre Bailon | 355a705 | 2015-03-31 09:51:59 +0200 | [diff] [blame] | 29 | gb-loopback-y := loopback.o |
Rui Miguel Silva | 2870b52 | 2015-08-14 13:58:19 +0100 | [diff] [blame] | 30 | gb-light-y := light.o |
Greg Kroah-Hartman | e806c7f | 2015-05-08 15:50:17 +0200 | [diff] [blame] | 31 | gb-raw-y := raw.o |
Greg Kroah-Hartman | c9e9de2 | 2015-11-04 20:46:14 -0800 | [diff] [blame] | 32 | gb-hid-y := hid.o |
Viresh Kumar | 98abb41 | 2015-01-21 16:10:41 +0530 | [diff] [blame] | 33 | gb-es2-y := es2.o |
Greg Kroah-Hartman | 1e5dd1f | 2015-12-30 13:38:33 -0800 | [diff] [blame] | 34 | gb-arche-y := arche-platform.o arche-apb-ctrl.o |
Vaibhav Agarwal | 5793227 | 2016-03-29 23:31:42 +0530 | [diff] [blame] | 35 | gb-audio-module-y := audio_module.o audio_topology.o |
| 36 | gb-audio-codec-y := audio_codec.o |
Mark Greer | 184992e | 2016-01-13 14:07:46 -0700 | [diff] [blame] | 37 | gb-audio-gb-y := audio_gb.o |
Mark Greer | 4dbf505 | 2016-01-13 14:07:47 -0700 | [diff] [blame] | 38 | gb-audio-apbridgea-y := audio_apbridgea.o |
Svetlin Ankov | 8db0073 | 2016-01-13 14:07:48 -0700 | [diff] [blame] | 39 | gb-audio-manager-y += audio_manager.o |
| 40 | gb-audio-manager-y += audio_manager_module.o |
Laurent Pinchart | 3265eda | 2015-12-15 03:18:06 +0200 | [diff] [blame] | 41 | gb-camera-y := camera.o |
Viresh Kumar | 98abb41 | 2015-01-21 16:10:41 +0530 | [diff] [blame] | 42 | |
Greg Kroah-Hartman | c8a797a | 2014-08-11 15:30:45 +0800 | [diff] [blame] | 43 | obj-m += greybus.o |
Greg Kroah-Hartman | 71479f6 | 2015-01-14 17:07:59 -0800 | [diff] [blame] | 44 | obj-m += gb-phy.o |
Greg Kroah-Hartman | 419a8cf | 2015-01-14 17:08:00 -0800 | [diff] [blame] | 45 | obj-m += gb-vibrator.o |
Rui Miguel Silva | 4648884 | 2015-11-12 15:35:59 +0000 | [diff] [blame] | 46 | obj-m += gb-power-supply.o |
Alexandre Bailon | 355a705 | 2015-03-31 09:51:59 +0200 | [diff] [blame] | 47 | obj-m += gb-loopback.o |
Rui Miguel Silva | 2870b52 | 2015-08-14 13:58:19 +0100 | [diff] [blame] | 48 | obj-m += gb-light.o |
Greg Kroah-Hartman | c9e9de2 | 2015-11-04 20:46:14 -0800 | [diff] [blame] | 49 | obj-m += gb-hid.o |
Greg Kroah-Hartman | e806c7f | 2015-05-08 15:50:17 +0200 | [diff] [blame] | 50 | obj-m += gb-raw.o |
Greg Kroah-Hartman | f587027 | 2015-01-21 10:24:15 +0800 | [diff] [blame] | 51 | obj-m += gb-es2.o |
Greg Kroah-Hartman | 7d0493d | 2016-02-15 13:58:21 -0800 | [diff] [blame] | 52 | ifeq ($(CONFIG_USB_HSIC_USB3613),y) |
| 53 | obj-m += gb-arche.o |
| 54 | endif |
Greg Kroah-Hartman | 7030f924 | 2016-01-25 20:13:15 -0800 | [diff] [blame] | 55 | ifeq ($(CONFIG_ARCH_MSM8994),y) |
Vaibhav Agarwal | 2b8c2b5 | 2016-04-21 22:14:02 +0530 | [diff] [blame^] | 56 | obj-m += gb-audio-codec.o |
| 57 | obj-m += gb-audio-module.o |
Greg Kroah-Hartman | 7030f924 | 2016-01-25 20:13:15 -0800 | [diff] [blame] | 58 | obj-m += gb-camera.o |
| 59 | endif |
Mark Greer | 184992e | 2016-01-13 14:07:46 -0700 | [diff] [blame] | 60 | obj-m += gb-audio-gb.o |
Mark Greer | 4dbf505 | 2016-01-13 14:07:47 -0700 | [diff] [blame] | 61 | obj-m += gb-audio-apbridgea.o |
Svetlin Ankov | 8db0073 | 2016-01-13 14:07:48 -0700 | [diff] [blame] | 62 | obj-m += gb-audio-manager.o |
Greg Kroah-Hartman | c8a797a | 2014-08-11 15:30:45 +0800 | [diff] [blame] | 63 | |
| 64 | KERNELVER ?= $(shell uname -r) |
| 65 | KERNELDIR ?= /lib/modules/$(KERNELVER)/build |
Bryan O'Donoghue | 68fff96 | 2015-05-07 17:00:50 -0700 | [diff] [blame] | 66 | INSTALL_MOD_PATH ?= /.. |
Greg Kroah-Hartman | c8a797a | 2014-08-11 15:30:45 +0800 | [diff] [blame] | 67 | PWD := $(shell pwd) |
| 68 | |
Rui Miguel Silva | 65cac60 | 2015-05-13 18:59:00 +0100 | [diff] [blame] | 69 | # kernel config option that shall be enable |
Rui Miguel Silva | 14006ab | 2016-01-13 14:39:55 +0000 | [diff] [blame] | 70 | CONFIG_OPTIONS_ENABLE := POWER_SUPPLY PWM SYSFS SPI USB SND_SOC MMC LEDS_CLASS INPUT |
Rui Miguel Silva | 65cac60 | 2015-05-13 18:59:00 +0100 | [diff] [blame] | 71 | |
| 72 | # kernel config option that shall be disable |
| 73 | CONFIG_OPTIONS_DISABLE := |
| 74 | |
| 75 | # this only run in kbuild part of the makefile |
| 76 | ifneq ($(KERNELRELEASE),) |
Rui Miguel Silva | 13fcfbb6 | 2015-08-14 13:58:18 +0100 | [diff] [blame] | 77 | # This function returns the argument version if current kernel version is minor |
| 78 | # than the passed version, return 1 if equal or the current kernel version if it |
| 79 | # is greater than argument version. |
Rui Miguel Silva | 1ab2e89 | 2015-08-16 00:48:03 +0100 | [diff] [blame] | 80 | kvers_cmp=$(shell [ "$(KERNELVERSION)" = "$(1)" ] && echo 1 || printf "$(1)\n$(KERNELVERSION)" | sort -V | tail -1) |
Rui Miguel Silva | 13fcfbb6 | 2015-08-14 13:58:18 +0100 | [diff] [blame] | 81 | |
| 82 | ifneq ($(call kvers_cmp,"3.19.0"),3.19.0) |
| 83 | CONFIG_OPTIONS_ENABLE += LEDS_CLASS_FLASH |
| 84 | endif |
| 85 | |
| 86 | ifneq ($(call kvers_cmp,"4.2.0"),4.2.0) |
| 87 | CONFIG_OPTIONS_ENABLE += V4L2_FLASH_LED_CLASS |
| 88 | endif |
| 89 | |
Rui Miguel Silva | 65cac60 | 2015-05-13 18:59:00 +0100 | [diff] [blame] | 90 | $(foreach opt,$(CONFIG_OPTIONS_ENABLE),$(if $(CONFIG_$(opt)),, \ |
| 91 | $(error CONFIG_$(opt) is disabled in the kernel configuration and must be enable \ |
| 92 | to continue compilation))) |
| 93 | $(foreach opt,$(CONFIG_OPTIONS_DISABLE),$(if $(filter m y, $(CONFIG_$(opt))), \ |
| 94 | $(error CONFIG_$(opt) is enabled in the kernel configuration and must be disable \ |
| 95 | to continue compilation),)) |
| 96 | endif |
| 97 | |
Greg Kroah-Hartman | 7486dfd | 2014-11-19 19:09:53 -0800 | [diff] [blame] | 98 | # add -Wall to try to catch everything we can. |
Perry Hung | 3a97cdd | 2015-07-03 00:27:12 -0400 | [diff] [blame] | 99 | ccflags-y := -Wall |
Greg Kroah-Hartman | 7486dfd | 2014-11-19 19:09:53 -0800 | [diff] [blame] | 100 | |
Bryan O'Donoghue | 5c8ad59 | 2015-09-18 16:38:45 +0100 | [diff] [blame] | 101 | # needed for trace events |
| 102 | ccflags-y += -I$(src) |
| 103 | |
Svetlin Ankov | 8db0073 | 2016-01-13 14:07:48 -0700 | [diff] [blame] | 104 | GB_AUDIO_MANAGER_SYSFS ?= true |
| 105 | ifeq ($(GB_AUDIO_MANAGER_SYSFS),true) |
| 106 | gb-audio-manager-y += audio_manager_sysfs.o |
| 107 | ccflags-y += -DGB_AUDIO_MANAGER_SYSFS |
| 108 | endif |
| 109 | |
Greg Kroah-Hartman | 70b3b3e | 2015-12-17 22:32:03 -0800 | [diff] [blame] | 110 | all: module |
Greg Kroah-Hartman | 6b0658f | 2015-12-15 12:46:22 -0800 | [diff] [blame] | 111 | |
| 112 | tools:: |
| 113 | $(MAKE) -C tools KERNELDIR=$(realpath $(KERNELDIR)) |
Greg Kroah-Hartman | c8a797a | 2014-08-11 15:30:45 +0800 | [diff] [blame] | 114 | |
| 115 | module: |
| 116 | $(MAKE) -C $(KERNELDIR) M=$(PWD) |
| 117 | |
Greg Kroah-Hartman | ac7171e | 2014-09-13 12:39:23 -0700 | [diff] [blame] | 118 | check: |
| 119 | $(MAKE) -C $(KERNELDIR) M=$(PWD) C=2 CF="-D__CHECK_ENDIAN__" |
| 120 | |
Greg Kroah-Hartman | c8a797a | 2014-08-11 15:30:45 +0800 | [diff] [blame] | 121 | clean: |
| 122 | rm -f *.o *~ core .depend .*.cmd *.ko *.mod.c |
| 123 | rm -f Module.markers Module.symvers modules.order |
| 124 | rm -rf .tmp_versions Modules.symvers |
Greg Kroah-Hartman | 6b0658f | 2015-12-15 12:46:22 -0800 | [diff] [blame] | 125 | $(MAKE) -C tools clean |
Greg Kroah-Hartman | c8a797a | 2014-08-11 15:30:45 +0800 | [diff] [blame] | 126 | |
| 127 | coccicheck: |
| 128 | $(MAKE) -C $(KERNELDIR) M=$(PWD) coccicheck |
| 129 | |
Greg Kroah-Hartman | 025677d | 2015-01-14 14:55:24 -0800 | [diff] [blame] | 130 | install: module |
Bryan O'Donoghue | 68fff96 | 2015-05-07 17:00:50 -0700 | [diff] [blame] | 131 | mkdir -p $(INSTALL_MOD_PATH)/lib/modules/$(KERNELVER)/kernel/drivers/greybus/ |
| 132 | cp -f *.ko $(INSTALL_MOD_PATH)/lib/modules/$(KERNELVER)/kernel/drivers/greybus/ |
| 133 | depmod -b $(INSTALL_MOD_PATH) -a $(KERNELVER) |