Makefile.unix-linux (1794B)
1 # 2 # This license is set out in https://raw.githubusercontent.com/Broadcom-Network-Switching-Software/OpenBCM/master/Legal/LICENSE file. 3 # 4 # Copyright 2007-2019 Broadcom Inc. All rights reserved. 5 # 6 # Build rules for Linux/x86 (Little Endian) with PLI support 7 8 include ${SDK}/make/Makefile.unix-common 9 10 # When using GDB on Linux, you may want to use "setenv GDB 1" to disable 11 # editline. For best results put "set environment GDB 1" in your .gdbinit. 12 13 # Linux-specific Configuration Flags 14 15 ENDIAN_DEF = -DLE_HOST=1 16 17 # Notes on AMD Athlon 64-bit 18 # 19 # Compiles on x86_64 default to 32-bit emulation unless 64-bit mode 20 # is specifically requested in Make.local by uncommenting the two defines 21 # for PTRS_ARE_64BITS and LONGS_ARE_64BITS. 22 # 23 # Note that the code base will compile in 64-bit mode, but will not run 24 # correctly because malloc() can return values >32 bits and the PLISIM 25 # protocol only supports 32-bit addresses. 26 27 ifeq ($(shell uname -m),x86_64) 28 ifeq (,$(findstring -DPTRS_ARE_64BITS,$(CFGFLAGS))) 29 CC = ${HCC} -m32 30 CXX = g++ -m32 31 else 32 CC = ${HCC} 33 CXX = g++ 34 endif 35 endif 36 37 LD = ld 38 AR = ar 39 ARFLAGS = -rc 40 STRIP = strip 41 RANLIB = ranlib 42 43 # Filter out features that cannot or should not be supported in Linux 44 ifdef ESW_CHIPS 45 _FEATURE_EXCLUDE_LIST += OOB_RCPU 46 endif 47 FEATURE_EXCLUDE_LIST = $(sort $(_FEATURE_EXCLUDE_LIST)) 48 49 50 # Linux 51 LIBS =-lnsl -pthread -lm -lrt 52 CFGFLAGS += -DBCM_PLATFORM_STRING=\"unix-linux\" 53 54 # For GCC 4.2.x, add -Wno-address 55 GCC_MAJOR_VER = $(shell echo |$(CC) -dM -E -| grep __GNUC__ | cut -d' ' -f3) 56 GCC_MINOR_VER = $(shell echo |$(CC) -dM -E -| grep __GNUC_MINOR__ | cut -d' ' -f3) 57 ifeq (${GCC_MAJOR_VER}, 4) 58 ifeq (${GCC_MINOR_VER}, 2) 59 BCM_EXTRA_CC_CFLAGS = -Wno-address 60 endif 61 endif 62 63 ifeq ($(LINUX_MAKE_SHARED_LIB),1) 64 BCM_EXTRA_CC_CFLAGS += -fPIC 65 endif 66