sonic-buildimage/platform/broadcom/saibcm-modules/make/Make.linux

98 lines
2.4 KiB
Plaintext
Raw Normal View History

#
# Copyright 2017 Broadcom
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License, version 2, as
# published by the Free Software Foundation (the "GPL").
#
# This program is distributed in the hope that it will be useful, but
# WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
# General Public License version 2 (GPLv2) for more details.
#
# You should have received a copy of the GNU General Public License
# version 2 (GPLv2) along with this source code.
#
#
# $Id: Make.linux,v 1.18 Broadcom SDK $
# $Copyright: (c) 2005 Broadcom Corp.
# All Rights Reserved.$
#
# Common make targets for Linux user and kernel builds included by top
# level Linux makefiles
#
# Variables referenced:
#
# LINUX_MAKE_FLAGS
# Additional flags passed to Make
#
# LINUX_MAKE_USER
# Defined: user build
# Undefined: kernel build
#
# LINUX_MAKE_DIR
# Common makefile location, if it is not ../common
#
#
export DEST_DIR_SUFFIX :=$(subst $(realpath $(SDK))/systems,,$(realpath $(CURDIR)/$(dir ($(firstword $(MAKEFILE_LIST))))))
ifeq (,$(kernel_version))
kernel_version=2_4
endif
ifndef LINUX_MAKE_SHARED_LIB
LINUX_MAKE_SHARED_LIB=0
endif
ifeq (,$(SHAREDLIBVER))
SHAREDLIBVER=1
endif
ifndef LINUX_MAKE_DIR
ifdef LINUX_MAKE_USER
LINUX_MAKE_DIR := $(SDK)/systems/linux/user/common
else
LINUX_MAKE_DIR := $(SDK)/systems/linux/kernel/common
endif
endif
ifdef LINUX_MAKE_USER
CMD = $(LINUX_MAKE_FLAGS) -C $(LINUX_MAKE_DIR) \
platform=$(platform) bldroot_suffix=/$(platform) kernel_version=$(kernel_version) \
LINUX_MAKE_SHARED_LIB=$(LINUX_MAKE_SHARED_LIB) SHAREDLIBVER=$(SHAREDLIBVER)
else
export LINUX_MAKE_KERNEL := 1
CMD = $(LINUX_MAKE_FLAGS) -C $(LINUX_MAKE_DIR) \
platform=$(platform) kernel_version=$(kernel_version)
endif
ifneq (,$(MIPS_TOOLS_DIR))
CMD += MIPS_TOOLS_DIR=$(MIPS_TOOLS_DIR)
endif
ifneq (,$(MIPS_CROSS_COMPILE))
CMD += MIPS_CROSS_COMPILE=$(MIPS_CROSS_COMPILE)
endif
ifneq (,$(LINUX_INCLUDE))
CMD += LINUX_INCLUDE=$(LINUX_INCLUDE)
endif
# gmake does not understand $(CMD) to be a submake
# options are to +$(CMD) or $(MAKE) $(CMD)
# trying the latter
build:
$(MAKE) $(CMD)
DELIVER clean C_COMPILER CXX_COMPILER variable mod bcm user issu:
$(MAKE) $(CMD) $@
clean_d: clean
distclean:
$(MAKE) $(CMD) $@
.PHONY: build clean distclean clean_d DELIVER variable mod bcm user issu