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 (1923B)


      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.3 Broadcom SDK $
     18 # $Copyright: (c) 2005 Broadcom Corp.
     19 # All Rights Reserved.$
     20 #
     21 LOCALDIR = systems/linux/kernel/modules/knet-cb
     22 
     23 include ${SDK}/make/Make.config
     24 
     25 LIBS = $(LIBDIR)/libkern.a
     26 
     27 ifeq ($(kernel_version),2_4)
     28 MODULE = $(LIBDIR)/linux-knet-cb.o
     29 else
     30 KERNEL_MODULE_DIR = kernel_module
     31 
     32 THIS_MOD_NAME := linux-knet-cb
     33 MODULE = $(LIBDIR)/$(THIS_MOD_NAME).o
     34 KMODULE = $(LIBDIR)/$(THIS_MOD_NAME).ko
     35 
     36 build: $(MODULE) $(KMODULE)
     37 endif
     38 
     39 KBUILD_EXTRA_SYMBOLS := ${BLDDIR}/../bcm-knet/kernel_module/Module.symvers
     40 
     41 # BCM Network Device
     42 
     43 $(MODULE): $(BLDDIR)/.tree $(BOBJS) $(LIBS)
     44 	$(LD) $(MODULE_LDFLAGS) -r -d $(BOBJS) $(LIBS) -o $@
     45 ifneq ($(kernel_version),2_4)
     46 $(KMODULE): $(MODULE)
     47 	rm -fr $(BLDDIR)/$(KERNEL_MODULE_DIR)
     48 	mkdir $(BLDDIR)/$(KERNEL_MODULE_DIR)
     49 	cp ${SDK}/make/Makefile.linux-kmodule $(BLDDIR)/$(KERNEL_MODULE_DIR)/Makefile
     50 	cat ${KBUILD_EXTRA_SYMBOLS} > $(BLDDIR)/$(KERNEL_MODULE_DIR)/Module.symvers
     51 	MOD_NAME=$(THIS_MOD_NAME) $(MAKE) -C $(BLDDIR)/$(KERNEL_MODULE_DIR) $(THIS_MOD_NAME).ko
     52 endif
     53 
     54 # Make.depend is before clean:: so that Make.depend's clean:: runs first.
     55 
     56 include ${SDK}/make/Make.depend
     57 
     58 clean::
     59 	$(RM) $(BLDDIR)/version.c $(BLDDIR)/version.o
     60 	$(RM) $(BOBJS) $(MODULE)
     61 
     62 ifneq ($(kernel_version),2_4)
     63 .PHONY: build
     64 endif