Makefile (2485B)
1 # 2 # Copyright 2017 Broadcom 3 # 4 # This program is free software; you can redistribute it and/or modify 5 # it under the terms of the GNU General Public License, version 2, as 6 # published by the Free Software Foundation (the "GPL"). 7 # 8 # This program is distributed in the hope that it will be useful, but 9 # WITHOUT ANY WARRANTY; without even the implied warranty of 10 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 11 # General Public License version 2 (GPLv2) for more details. 12 # 13 # You should have received a copy of the GNU General Public License 14 # version 2 (GPLv2) along with this source code. 15 # 16 # -*- Makefile -*- 17 # $Id: Makefile,v 1.18 Broadcom SDK $ 18 # $Copyright: (c) 2005 Broadcom Corp. 19 # All Rights Reserved.$ 20 # 21 # Makefile for Linux kernel BDE 22 # 23 LOCALDIR = systems/bde/linux/kernel 24 25 # Make sure we build for the kernel if this is a user-mode build 26 ifneq ($(platform), ) 27 override-target=linux-$(platform) 28 endif 29 30 include $(SDK)/make/Make.config 31 32 LIBS = $(LIBDIR)/libkern.a 33 34 BDE = linux-kernel-bde.o 35 36 # need to add vpath sources 37 VPATH = ../shared 38 39 # Add the srcs to be found by vpath 40 LSRCS += mpool.c 41 42 # Add shared BDE sources 43 VPATH += ../../shared 44 LSRCS += shbde_pci.c shbde_iproc.c shbde_mdio.c 45 CFLAGS += -I../../shared/include 46 47 LHDRS += mpool.h 48 LOBJS = $(addsuffix .o, $(basename $(LSRCS))) 49 BOBJS = $(addprefix $(BLDDIR)/,$(LOBJS)) 50 51 ifneq ($(kernel_version),2_4) 52 KERNEL_MODULE_DIR = kernel_module 53 54 THIS_MOD_NAME := linux-kernel-bde 55 MODULE = $(LIBDIR)/$(THIS_MOD_NAME).o 56 KMODULE = $(LIBDIR)/$(THIS_MOD_NAME).ko 57 58 build: kernel_libs module $(KMODULE) 59 else 60 MODULE = $(LIBDIR)/linux-kernel-bde.o 61 62 build: kernel_libs module 63 endif 64 65 module: kernel_libs $(MODULE) 66 67 $(MODULE): $(BLDDIR)/.tree $(BOBJS) 68 mkdir -p $(@D) 69 $(LD) $(MODULE_LDFLAGS) -r -d $(BOBJS) $(LIBS) -o $@ 70 ifneq ($(kernel_version),2_4) 71 $(KMODULE): $(MODULE) 72 rm -fr $(BLDDIR)/$(KERNEL_MODULE_DIR) 73 mkdir $(BLDDIR)/$(KERNEL_MODULE_DIR) 74 cp ${SDK}/make/Makefile.linux-kmodule $(BLDDIR)/$(KERNEL_MODULE_DIR)/Makefile 75 MOD_NAME=$(THIS_MOD_NAME) $(MAKE) -C $(BLDDIR)/$(KERNEL_MODULE_DIR) $(THIS_MOD_NAME).ko 76 endif 77 78 kernel_libs: 79 $(MAKE) -C $(SDK)/systems/linux/kernel/modules/shared 80 81 include $(SDK)/make/Make.depend 82 83 # Make.depend is before clean:: so that Make.depend's clean:: runs first. 84 85 clean:: 86 $(MAKE) -C $(SDK)/systems/linux/kernel/modules/shared $@ 87 $(RM) $(BOBJS) $(MODULE) 88 $(RM) $(BLDDIR)/$(KERNEL_MODULE_DIR) 89 90 distclean:: 91 92 ifneq ($(kernel_version),2_4) 93 .PHONY: build kernel_libs 94 endif