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