14 gb-phy-y := gpbridge.o \
23 # Prefix all modules with gb-
24 gb-vibrator-y := vibrator.o
25 gb-power-supply-y := power_supply.o
26 gb-loopback-y := loopback.o
31 gb-arche-y := arche-platform.o arche-apb-ctrl.o
32 gb-audio-codec-y := audio_codec.o
33 gb-audio-gb-y := audio_gb.o
34 gb-audio-apbridgea-y := audio_apbridgea.o
35 gb-audio-manager-y += audio_manager.o
36 gb-audio-manager-y += audio_manager_module.o
37 gb-camera-y := camera.o
41 obj-m += gb-vibrator.o
42 obj-m += gb-power-supply.o
43 obj-m += gb-loopback.o
49 obj-m += gb-audio-codec.o
51 obj-m += gb-audio-gb.o
52 obj-m += gb-audio-apbridgea.o
53 obj-m += gb-audio-manager.o
55 KERNELVER ?= $(shell uname -r)
56 KERNELDIR ?= /lib/modules/$(KERNELVER)/build
57 INSTALL_MOD_PATH ?= /..
60 # kernel config option that shall be enable
61 CONFIG_OPTIONS_ENABLE := POWER_SUPPLY PWM SYSFS SPI USB SND_SOC MMC LEDS_CLASS INPUT
63 # kernel config option that shall be disable
64 CONFIG_OPTIONS_DISABLE :=
66 # this only run in kbuild part of the makefile
67 ifneq ($(KERNELRELEASE),)
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.
71 kvers_cmp=$(shell [ "$(KERNELVERSION)" = "$(1)" ] && echo 1 || printf "$(1)\n$(KERNELVERSION)" | sort -V | tail -1)
73 ifneq ($(call kvers_cmp,"3.19.0"),3.19.0)
74 CONFIG_OPTIONS_ENABLE += LEDS_CLASS_FLASH
77 ifneq ($(call kvers_cmp,"4.2.0"),4.2.0)
78 CONFIG_OPTIONS_ENABLE += V4L2_FLASH_LED_CLASS
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),))
89 # add -Wall to try to catch everything we can.
92 # needed for trace events
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
104 $(MAKE) -C tools KERNELDIR=$(realpath $(KERNELDIR))
107 $(MAKE) -C $(KERNELDIR) M=$(PWD)
110 $(MAKE) -C $(KERNELDIR) M=$(PWD) C=2 CF="-D__CHECK_ENDIAN__"
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
116 $(MAKE) -C tools clean
119 $(MAKE) -C $(KERNELDIR) M=$(PWD) coccicheck
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)