1
0
mirror of https://github.com/corundum/corundum.git synced 2025-01-30 08:32:52 +08:00
Joachim Foerster 60c2b6745d modules/mqnic/: Fix and enhance Makefile
- Apply "Shared Makefile" style as found in [1]
- Especially but not only for cross compilation:
  - Accept commonly used variable KDIR to specify kernel build directory
  - Additionally accept KERNEL_SRC (instead of KDIR) as used by PetaLinux/Yocto
- Route all usual external module targets through to Kbuild
- Provide "install" target as shortcut for module installation
- Use $(MAKE) as recommended in [2]

[1] https://www.kernel.org/doc/html/latest/kbuild/modules.html, section 3.1
[2] https://www.gnu.org/software/make/manual/make.html#MAKE-Variable, section 5.7.1.

Signed-off-by: Joachim Foerster <joachim.foerster@missinglinkelectronics.com>
2021-12-15 23:29:02 -08:00

39 lines
758 B
Makefile

ifneq ($(KERNELRELEASE),)
# object files to build
obj-m += mqnic.o
mqnic-y += mqnic_main.o
mqnic-y += mqnic_irq.o
mqnic-y += mqnic_dev.o
mqnic-y += mqnic_if.o
mqnic-y += mqnic_netdev.o
mqnic-y += mqnic_port.o
mqnic-y += mqnic_ptp.o
mqnic-y += mqnic_i2c.o
mqnic-y += mqnic_board.o
mqnic-y += mqnic_tx.o
mqnic-y += mqnic_rx.o
mqnic-y += mqnic_cq.o
mqnic-y += mqnic_eq.o
mqnic-y += mqnic_ethtool.o
else
ifneq ($(KERNEL_SRC),)
# alternatively to variable KDIR accept variable KERNEL_SRC as used in
# PetaLinux/Yocto for example
KDIR ?= $(KERNEL_SRC)
endif
KDIR ?= /lib/modules/$(shell uname -r)/build
all:
$(MAKE) -C $(KDIR) M=$(shell pwd) modules
help modules modules_install clean:
$(MAKE) -C $(KDIR) M=$(shell pwd) $@
install: modules_install
endif