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


      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/bcm-knet
     22 
     23 include ${SDK}/make/Make.config
     24 
     25 LIBS = $(LIBDIR)/libkern.a
     26 
     27 ifeq ($(kernel_version),2_4)
     28 MODULE = $(LIBDIR)/linux-bcm-knet.o
     29 else
     30 KERNEL_MODULE_DIR = kernel_module
     31 
     32 THIS_MOD_NAME := linux-bcm-knet
     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}/../../../../bde/linux/kernel/kernel_module/Module.symvers
     40 ifeq (,$(findstring -DPROXY_SUPPORT=0,$(CFLAGS)))
     41 KBUILD_EXTRA_SYMBOLS += ${BLDDIR}/../uk-proxy/kernel_module/Module.symvers
     42 endif
     43 
     44 # BCM Network Device
     45 
     46 $(MODULE): $(BLDDIR)/.tree $(BOBJS) $(LIBS)
     47 	$(LD) $(MODULE_LDFLAGS) -r -d $(BOBJS) $(LIBS) -o $@
     48 ifneq ($(kernel_version),2_4)
     49 $(KMODULE): $(MODULE)
     50 	rm -fr $(BLDDIR)/$(KERNEL_MODULE_DIR)
     51 	mkdir $(BLDDIR)/$(KERNEL_MODULE_DIR)
     52 	cp ${SDK}/make/Makefile.linux-kmodule $(BLDDIR)/$(KERNEL_MODULE_DIR)/Makefile
     53 	cat ${KBUILD_EXTRA_SYMBOLS} > $(BLDDIR)/$(KERNEL_MODULE_DIR)/Module.symvers
     54 	MOD_NAME=$(THIS_MOD_NAME) $(MAKE) -C $(BLDDIR)/$(KERNEL_MODULE_DIR) $(THIS_MOD_NAME).ko
     55 endif
     56 
     57 # Make.depend is before clean:: so that Make.depend's clean:: runs first.
     58 
     59 include ${SDK}/make/Make.depend
     60 
     61 clean::
     62 	$(RM) $(BLDDIR)/version.c $(BLDDIR)/version.o
     63 	$(RM) $(BOBJS) $(MODULE)
     64 
     65 ifneq ($(kernel_version),2_4)
     66 .PHONY: build
     67 endif