Makefile (1942B)
1 # -*- Makefile -*- 2 # 3 # This license is set out in https://raw.githubusercontent.com/Broadcom-Network-Switching-Software/OpenBCM/master/Legal/LICENSE file. 4 # 5 # Copyright 2007-2019 Broadcom Inc. All rights reserved. 6 # 7 # Makefile for Linux kernel BDE 8 # 9 LOCALDIR = systems/bde/linux/kernel 10 11 # Make sure we build for the kernel if this is a user-mode build 12 ifneq ($(platform), ) 13 override-target=linux-$(platform) 14 endif 15 16 include $(SDK)/make/Make.config 17 18 LIBS = $(LIBDIR)/libkern.a 19 20 BDE = linux-kernel-bde.o 21 22 # need to add vpath sources 23 VPATH = ../shared 24 25 # Add the srcs to be found by vpath 26 LSRCS += mpool.c 27 28 # Add shared BDE sources 29 VPATH += ../../shared 30 LSRCS += shbde_pci.c shbde_iproc.c shbde_mdio.c 31 CFLAGS += -I../../shared/include 32 33 LHDRS += mpool.h 34 LOBJS = $(addsuffix .o, $(basename $(LSRCS))) 35 BOBJS = $(addprefix $(BLDDIR)/,$(LOBJS)) 36 37 ifneq ($(kernel_version),2_4) 38 KERNEL_MODULE_DIR = kernel_module 39 40 THIS_MOD_NAME := linux-kernel-bde 41 MODULE = $(LIBDIR)/$(THIS_MOD_NAME).o 42 KMODULE = $(LIBDIR)/$(THIS_MOD_NAME).ko 43 44 build: kernel_libs $(MODULE) $(KMODULE) 45 else 46 MODULE = $(LIBDIR)/linux-kernel-bde.o 47 48 build: kernel_libs $(MODULE) 49 endif 50 51 $(MODULE): $(BLDDIR)/.tree kernel_libs $(BOBJS) 52 mkdir -p $(@D) 53 $(LD) $(MODULE_LDFLAGS) -r -d $(BOBJS) $(LIBS) -o $@ 54 ifneq ($(kernel_version),2_4) 55 $(KMODULE): $(MODULE) 56 rm -fr $(BLDDIR)/$(KERNEL_MODULE_DIR) 57 mkdir $(BLDDIR)/$(KERNEL_MODULE_DIR) 58 cp ${SDK}/make/Makefile.linux-kmodule $(BLDDIR)/$(KERNEL_MODULE_DIR)/Makefile 59 MOD_NAME=$(THIS_MOD_NAME) $(MAKE) -C $(BLDDIR)/$(KERNEL_MODULE_DIR) $(THIS_MOD_NAME).ko 60 endif 61 62 kernel_libs: 63 $(MAKE) -C $(SDK)/systems/linux/kernel/modules/shared 64 65 include $(SDK)/make/Make.depend 66 67 # Make.depend is before clean:: so that Make.depend's clean:: runs first. 68 69 clean:: 70 $(MAKE) -C $(SDK)/systems/linux/kernel/modules/shared $@ 71 $(RM) $(BOBJS) $(MODULE) 72 $(RM) $(BLDDIR)/$(KERNEL_MODULE_DIR) 73 74 distclean:: 75 76 ifneq ($(kernel_version),2_4) 77 .PHONY: build kernel_libs 78 endif