openbcm

Git mirror of https://github.com/Broadcom-Network-Switching-Software/OpenBCM
git clone git://git.finwo.net/mirror/broadcom/openbcm
Log | Files | Refs | README

Makefile (2472B)


      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): $(BLDDIR)/.tree kernel_libs $(BOBJS)
     66 	mkdir -p $(@D)
     67 	$(LD) $(MODULE_LDFLAGS) -r -d $(BOBJS) $(LIBS) -o $@
     68 ifneq ($(kernel_version),2_4)
     69 $(KMODULE): $(MODULE)
     70 	rm -fr $(BLDDIR)/$(KERNEL_MODULE_DIR)
     71 	mkdir $(BLDDIR)/$(KERNEL_MODULE_DIR)
     72 	cp ${SDK}/make/Makefile.linux-kmodule $(BLDDIR)/$(KERNEL_MODULE_DIR)/Makefile
     73 	MOD_NAME=$(THIS_MOD_NAME) $(MAKE) -C $(BLDDIR)/$(KERNEL_MODULE_DIR) $(THIS_MOD_NAME).ko
     74 endif
     75 
     76 kernel_libs:
     77 	$(MAKE) -C $(SDK)/systems/linux/kernel/modules/shared
     78 
     79 include $(SDK)/make/Make.depend
     80 
     81 # Make.depend is before clean:: so that Make.depend's clean:: runs first.
     82 
     83 clean::
     84 	$(MAKE) -C $(SDK)/systems/linux/kernel/modules/shared $@
     85 	$(RM) $(BOBJS) $(MODULE)
     86 	$(RM) $(BLDDIR)/$(KERNEL_MODULE_DIR)
     87 
     88 distclean::
     89 
     90 ifneq ($(kernel_version),2_4)
     91 .PHONY: build kernel_libs
     92 endif