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 \ |
Greg Kroah-Hartman | a93938a | 2014-12-19 14:56:30 -0800 | [diff] [blame] | 5 | interface.o \ |
Greg Kroah-Hartman | 3bdec69 | 2014-12-12 17:10:16 -0500 | [diff] [blame] | 6 | bundle.o \ |
Alex Elder | c68adb2 | 2014-10-01 21:54:14 -0500 | [diff] [blame] | 7 | connection.o \ |
Alex Elder | 4ccb6b7 | 2014-10-28 19:36:00 -0500 | [diff] [blame] | 8 | protocol.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 \ |
Viresh Kumar | 90f1b61 | 2015-08-12 09:19:33 +0530 | [diff] [blame] | 11 | firmware.o \ |
Greg Kroah-Hartman | e1308c1 | 2014-12-24 13:01:43 -0800 | [diff] [blame] | 12 | operation.o |
| 13 | |
Viresh Kumar | f5db53b | 2015-05-20 16:56:46 +0530 | [diff] [blame] | 14 | gb-phy-y := gpbridge.o \ |
Viresh Kumar | 5357cf3 | 2015-01-21 16:10:40 +0530 | [diff] [blame] | 15 | sdio.o \ |
| 16 | uart.o \ |
| 17 | pwm.o \ |
| 18 | gpio.o \ |
| 19 | i2c.o \ |
Viresh Kumar | 15d651b | 2015-01-23 13:07:45 +0530 | [diff] [blame] | 20 | spi.o \ |
Mark Greer | ddc88ef | 2015-11-04 09:47:21 -0700 | [diff] [blame] | 21 | usb.o |
Greg Kroah-Hartman | c8a797a | 2014-08-11 15:30:45 +0800 | [diff] [blame] | 22 | |
Viresh Kumar | 98abb41 | 2015-01-21 16:10:41 +0530 | [diff] [blame] | 23 | # Prefix all modules with gb- |
| 24 | gb-vibrator-y := vibrator.o |
Rui Miguel Silva | 4648884 | 2015-11-12 15:35:59 +0000 | [diff] [blame] | 25 | gb-power-supply-y := power_supply.o |
Alexandre Bailon | 355a705 | 2015-03-31 09:51:59 +0200 | [diff] [blame] | 26 | gb-loopback-y := loopback.o |
Rui Miguel Silva | 2870b52 | 2015-08-14 13:58:19 +0100 | [diff] [blame] | 27 | gb-light-y := light.o |
Greg Kroah-Hartman | e806c7f | 2015-05-08 15:50:17 +0200 | [diff] [blame] | 28 | gb-raw-y := raw.o |
Greg Kroah-Hartman | c9e9de2 | 2015-11-04 20:46:14 -0800 | [diff] [blame] | 29 | gb-hid-y := hid.o |
Viresh Kumar | 98abb41 | 2015-01-21 16:10:41 +0530 | [diff] [blame] | 30 | gb-es2-y := es2.o |
Greg Kroah-Hartman | 1e5dd1f | 2015-12-30 13:38:33 -0800 | [diff] [blame] | 31 | gb-arche-y := arche-platform.o arche-apb-ctrl.o |
Mark Greer | fd8f9e1 | 2016-01-13 14:07:44 -0700 | [diff] [blame] | 32 | gb-audio-codec-y := audio_codec.o |
Mark Greer | 184992e | 2016-01-13 14:07:46 -0700 | [diff] [blame] | 33 | gb-audio-gb-y := audio_gb.o |
Mark Greer | 4dbf505 | 2016-01-13 14:07:47 -0700 | [diff] [blame] | 34 | gb-audio-apbridgea-y := audio_apbridgea.o |
Svetlin Ankov | 8db0073 | 2016-01-13 14:07:48 -0700 | [diff] [blame^] | 35 | gb-audio-manager-y += audio_manager.o |
| 36 | gb-audio-manager-y += audio_manager_module.o |
Laurent Pinchart | 3265eda | 2015-12-15 03:18:06 +0200 | [diff] [blame] | 37 | gb-camera-y := camera.o |
Viresh Kumar | 98abb41 | 2015-01-21 16:10:41 +0530 | [diff] [blame] | 38 | |
Greg Kroah-Hartman | c8a797a | 2014-08-11 15:30:45 +0800 | [diff] [blame] | 39 | obj-m += greybus.o |
Greg Kroah-Hartman | 71479f6 | 2015-01-14 17:07:59 -0800 | [diff] [blame] | 40 | obj-m += gb-phy.o |
Greg Kroah-Hartman | 419a8cf | 2015-01-14 17:08:00 -0800 | [diff] [blame] | 41 | obj-m += gb-vibrator.o |
Rui Miguel Silva | 4648884 | 2015-11-12 15:35:59 +0000 | [diff] [blame] | 42 | obj-m += gb-power-supply.o |
Alexandre Bailon | 355a705 | 2015-03-31 09:51:59 +0200 | [diff] [blame] | 43 | obj-m += gb-loopback.o |
Rui Miguel Silva | 2870b52 | 2015-08-14 13:58:19 +0100 | [diff] [blame] | 44 | obj-m += gb-light.o |
Greg Kroah-Hartman | c9e9de2 | 2015-11-04 20:46:14 -0800 | [diff] [blame] | 45 | obj-m += gb-hid.o |
Greg Kroah-Hartman | e806c7f | 2015-05-08 15:50:17 +0200 | [diff] [blame] | 46 | obj-m += gb-raw.o |
Greg Kroah-Hartman | f587027 | 2015-01-21 10:24:15 +0800 | [diff] [blame] | 47 | obj-m += gb-es2.o |
Vaibhav Hiremath | 7fa6065 | 2015-12-16 16:29:18 +0530 | [diff] [blame] | 48 | obj-m += gb-arche.o |
Vaibhav Agarwal | d3d2af5 | 2015-11-23 15:57:45 +0530 | [diff] [blame] | 49 | obj-m += gb-audio-codec.o |
Laurent Pinchart | 3265eda | 2015-12-15 03:18:06 +0200 | [diff] [blame] | 50 | obj-m += gb-camera.o |
Mark Greer | 184992e | 2016-01-13 14:07:46 -0700 | [diff] [blame] | 51 | obj-m += gb-audio-gb.o |
Mark Greer | 4dbf505 | 2016-01-13 14:07:47 -0700 | [diff] [blame] | 52 | obj-m += gb-audio-apbridgea.o |
Svetlin Ankov | 8db0073 | 2016-01-13 14:07:48 -0700 | [diff] [blame^] | 53 | obj-m += gb-audio-manager.o |
Greg Kroah-Hartman | c8a797a | 2014-08-11 15:30:45 +0800 | [diff] [blame] | 54 | |
| 55 | KERNELVER ?= $(shell uname -r) |
| 56 | KERNELDIR ?= /lib/modules/$(KERNELVER)/build |
Bryan O'Donoghue | 68fff96 | 2015-05-07 17:00:50 -0700 | [diff] [blame] | 57 | INSTALL_MOD_PATH ?= /.. |
Greg Kroah-Hartman | c8a797a | 2014-08-11 15:30:45 +0800 | [diff] [blame] | 58 | PWD := $(shell pwd) |
| 59 | |
Rui Miguel Silva | 65cac60 | 2015-05-13 18:59:00 +0100 | [diff] [blame] | 60 | # kernel config option that shall be enable |
Rui Miguel Silva | 14006ab | 2016-01-13 14:39:55 +0000 | [diff] [blame] | 61 | 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] | 62 | |
| 63 | # kernel config option that shall be disable |
| 64 | CONFIG_OPTIONS_DISABLE := |
| 65 | |
| 66 | # this only run in kbuild part of the makefile |
| 67 | ifneq ($(KERNELRELEASE),) |
Rui Miguel Silva | 13fcfbb6 | 2015-08-14 13:58:18 +0100 | [diff] [blame] | 68 | # 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 Silva | 1ab2e89 | 2015-08-16 00:48:03 +0100 | [diff] [blame] | 71 | 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] | 72 | |
| 73 | ifneq ($(call kvers_cmp,"3.19.0"),3.19.0) |
| 74 | CONFIG_OPTIONS_ENABLE += LEDS_CLASS_FLASH |
| 75 | endif |
| 76 | |
| 77 | ifneq ($(call kvers_cmp,"4.2.0"),4.2.0) |
| 78 | CONFIG_OPTIONS_ENABLE += V4L2_FLASH_LED_CLASS |
| 79 | endif |
| 80 | |
Rui Miguel Silva | 65cac60 | 2015-05-13 18:59:00 +0100 | [diff] [blame] | 81 | $(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),)) |
| 87 | endif |
| 88 | |
Greg Kroah-Hartman | 7486dfd | 2014-11-19 19:09:53 -0800 | [diff] [blame] | 89 | # add -Wall to try to catch everything we can. |
Perry Hung | 3a97cdd | 2015-07-03 00:27:12 -0400 | [diff] [blame] | 90 | ccflags-y := -Wall |
Greg Kroah-Hartman | 7486dfd | 2014-11-19 19:09:53 -0800 | [diff] [blame] | 91 | |
Bryan O'Donoghue | 5c8ad59 | 2015-09-18 16:38:45 +0100 | [diff] [blame] | 92 | # needed for trace events |
| 93 | ccflags-y += -I$(src) |
| 94 | |
Svetlin Ankov | 8db0073 | 2016-01-13 14:07:48 -0700 | [diff] [blame^] | 95 | GB_AUDIO_MANAGER_SYSFS ?= true |
| 96 | ifeq ($(GB_AUDIO_MANAGER_SYSFS),true) |
| 97 | gb-audio-manager-y += audio_manager_sysfs.o |
| 98 | ccflags-y += -DGB_AUDIO_MANAGER_SYSFS |
| 99 | endif |
| 100 | |
Greg Kroah-Hartman | 70b3b3e | 2015-12-17 22:32:03 -0800 | [diff] [blame] | 101 | all: module |
Greg Kroah-Hartman | 6b0658f | 2015-12-15 12:46:22 -0800 | [diff] [blame] | 102 | |
| 103 | tools:: |
| 104 | $(MAKE) -C tools KERNELDIR=$(realpath $(KERNELDIR)) |
Greg Kroah-Hartman | c8a797a | 2014-08-11 15:30:45 +0800 | [diff] [blame] | 105 | |
| 106 | module: |
| 107 | $(MAKE) -C $(KERNELDIR) M=$(PWD) |
| 108 | |
Greg Kroah-Hartman | ac7171e | 2014-09-13 12:39:23 -0700 | [diff] [blame] | 109 | check: |
| 110 | $(MAKE) -C $(KERNELDIR) M=$(PWD) C=2 CF="-D__CHECK_ENDIAN__" |
| 111 | |
Greg Kroah-Hartman | c8a797a | 2014-08-11 15:30:45 +0800 | [diff] [blame] | 112 | clean: |
| 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-Hartman | 6b0658f | 2015-12-15 12:46:22 -0800 | [diff] [blame] | 116 | $(MAKE) -C tools clean |
Greg Kroah-Hartman | c8a797a | 2014-08-11 15:30:45 +0800 | [diff] [blame] | 117 | |
| 118 | coccicheck: |
| 119 | $(MAKE) -C $(KERNELDIR) M=$(PWD) coccicheck |
| 120 | |
Greg Kroah-Hartman | 025677d | 2015-01-14 14:55:24 -0800 | [diff] [blame] | 121 | install: module |
Bryan O'Donoghue | 68fff96 | 2015-05-07 17:00:50 -0700 | [diff] [blame] | 122 | 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) |