Make.linux (1963B)
1 # 2 # 3 # This license is set out in https://raw.githubusercontent.com/Broadcom-Network-Switching-Software/OpenBCM/master/Legal/LICENSE file. 4 # 5 # Copyright 2007-2019 Broadcom Inc. All rights reserved. 6 # 7 # Common make targets for Linux user and kernel builds included by top 8 # level Linux makefiles 9 # 10 # Variables referenced: 11 # 12 # LINUX_MAKE_FLAGS 13 # Additional flags passed to Make 14 # 15 # LINUX_MAKE_USER 16 # Defined: user build 17 # Undefined: kernel build 18 # 19 # LINUX_MAKE_DIR 20 # Common makefile location, if it is not ../common 21 # 22 # 23 24 export DEST_DIR_SUFFIX :=$(subst $(realpath $(SDK))/systems,,$(realpath $(CURDIR)/$(dir ($(firstword $(MAKEFILE_LIST)))))) 25 26 ifeq (,$(kernel_version)) 27 kernel_version=2_4 28 endif 29 30 ifndef LINUX_MAKE_SHARED_LIB 31 LINUX_MAKE_SHARED_LIB=0 32 endif 33 34 ifeq (,$(SHAREDLIBVER)) 35 SHAREDLIBVER=1 36 endif 37 38 ifndef LINUX_MAKE_DIR 39 ifdef LINUX_MAKE_USER 40 LINUX_MAKE_DIR := $(SDK)/systems/linux/user/common 41 else 42 LINUX_MAKE_DIR := $(SDK)/systems/linux/kernel/common 43 endif 44 endif 45 46 ifdef LINUX_MAKE_USER 47 CMD = $(LINUX_MAKE_FLAGS) -C $(LINUX_MAKE_DIR) \ 48 platform=$(platform) bldroot_suffix=/$(platform) kernel_version=$(kernel_version) \ 49 LINUX_MAKE_SHARED_LIB=$(LINUX_MAKE_SHARED_LIB) SHAREDLIBVER=$(SHAREDLIBVER) 50 else 51 export LINUX_MAKE_KERNEL := 1 52 CMD = $(LINUX_MAKE_FLAGS) -C $(LINUX_MAKE_DIR) \ 53 platform=$(platform) kernel_version=$(kernel_version) 54 endif 55 56 ifneq (,$(MIPS_TOOLS_DIR)) 57 CMD += MIPS_TOOLS_DIR=$(MIPS_TOOLS_DIR) 58 endif 59 60 ifneq (,$(MIPS_CROSS_COMPILE)) 61 CMD += MIPS_CROSS_COMPILE=$(MIPS_CROSS_COMPILE) 62 endif 63 64 ifneq (,$(LINUX_INCLUDE)) 65 CMD += LINUX_INCLUDE=$(LINUX_INCLUDE) 66 endif 67 68 # gmake does not understand $(CMD) to be a submake 69 # options are to +$(CMD) or $(MAKE) $(CMD) 70 # trying the latter 71 build: 72 $(MAKE) $(CMD) 73 74 DELIVER clean C_COMPILER CXX_COMPILER variable mod bcm user: 75 $(MAKE) $(CMD) $@ 76 77 clean_d: clean 78 79 distclean: 80 $(MAKE) $(CMD) $@ 81 82 .PHONY: build clean distclean clean_d DELIVER variable mod bcm user 83