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

Make.linux (2495B)


      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 #
     17 # $Id: Make.linux,v 1.18 Broadcom SDK $
     18 # $Copyright: (c) 2005 Broadcom Corp.
     19 # All Rights Reserved.$
     20 # 
     21 # Common make targets for Linux user and kernel builds included by top
     22 # level Linux makefiles
     23 #
     24 # Variables referenced:
     25 #
     26 # LINUX_MAKE_FLAGS
     27 #   Additional flags passed to Make
     28 #
     29 # LINUX_MAKE_USER
     30 #   Defined: user build
     31 #   Undefined: kernel build
     32 #
     33 # LINUX_MAKE_DIR
     34 #   Common makefile location, if it is not ../common
     35 #
     36 #
     37 
     38 export DEST_DIR_SUFFIX :=$(subst $(realpath $(SDK))/systems,,$(realpath $(CURDIR)/$(dir ($(firstword $(MAKEFILE_LIST))))))
     39 
     40 ifeq (,$(kernel_version))
     41 kernel_version=2_4
     42 endif
     43 
     44 ifndef LINUX_MAKE_SHARED_LIB
     45 LINUX_MAKE_SHARED_LIB=0
     46 endif
     47 
     48 ifeq (,$(SHAREDLIBVER))
     49 SHAREDLIBVER=1
     50 endif
     51 
     52 ifndef LINUX_MAKE_DIR
     53 ifdef LINUX_MAKE_USER
     54 LINUX_MAKE_DIR := $(SDK)/systems/linux/user/common
     55 else
     56 LINUX_MAKE_DIR := $(SDK)/systems/linux/kernel/common
     57 endif
     58 endif
     59 
     60 ifdef LINUX_MAKE_USER
     61   CMD = $(LINUX_MAKE_FLAGS) -C $(LINUX_MAKE_DIR) \
     62         platform=$(platform) bldroot_suffix=/$(platform) kernel_version=$(kernel_version) \
     63         LINUX_MAKE_SHARED_LIB=$(LINUX_MAKE_SHARED_LIB) SHAREDLIBVER=$(SHAREDLIBVER)
     64 else
     65   export LINUX_MAKE_KERNEL := 1
     66   CMD = $(LINUX_MAKE_FLAGS) -C $(LINUX_MAKE_DIR) \
     67         platform=$(platform) kernel_version=$(kernel_version)
     68 endif
     69 
     70 ifneq (,$(MIPS_TOOLS_DIR))
     71   CMD += MIPS_TOOLS_DIR=$(MIPS_TOOLS_DIR)
     72 endif
     73 
     74 ifneq (,$(MIPS_CROSS_COMPILE))
     75   CMD += MIPS_CROSS_COMPILE=$(MIPS_CROSS_COMPILE)
     76 endif
     77 
     78 ifneq (,$(LINUX_INCLUDE))
     79   CMD += LINUX_INCLUDE=$(LINUX_INCLUDE)
     80 endif
     81 
     82 # gmake does not understand $(CMD) to be a submake
     83 # options are to +$(CMD) or $(MAKE) $(CMD)
     84 # trying the latter
     85 build:
     86 	$(MAKE) $(CMD)
     87 
     88 DELIVER clean C_COMPILER CXX_COMPILER variable mod bcm user:
     89 	$(MAKE) $(CMD) $@
     90 
     91 clean_d: clean
     92 
     93 distclean:
     94 	$(MAKE) $(CMD) $@
     95         
     96 .PHONY: build clean distclean clean_d DELIVER variable mod bcm user
     97