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


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