Makefile.unix-common (2870B)
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 # This file contains the platform-independent portion of the Makefiles 7 # for Unix compilation. 8 # 9 10 # 11 # TARGETTYPE Defines: This defines the type of system you are compiling 12 # the driver for. New values can be created by porting the code to your 13 # platform and adding the define in this Makefile. 14 # 15 16 TARGETTYPE = PLISIM 17 18 # Configuration Variable 19 # OSType Defines: This defines the type of RTOS or microkernel which you 20 # are compiling the SAL (and its associated driver) for. New platforms 21 # can be created by porting the code to your platform and changing the 22 # define in this Makefile. 23 24 OSTYPE = UNIX 25 26 # 27 # ORIGIN is used to Optionally select different CFLAGS. It is used to import 28 # source from other vendors. If SOURCE=Broadcom, then the BCM_ flags are added 29 # to those passed to the compiler. If SOURCE != Broadcom, BCM_ flags are NOT 30 # added. 31 # 32 # Default specifies Broadcom 33 # 34 ifndef ORIGIN 35 ORIGIN = Broadcom 36 endif 37 38 # 39 # STD_{C|CPP|CXX}FLAGS - Standard flags used by ALL compilations 40 # BCM_{C|CPP|CXX}FLAGS - Flags used for Broadcom source files 41 # OPT_{C|CPP|CXX}FLAGS - Defined in local make files BEFORE inclusion of 42 # this Makefile, to define local "Extra" flags. 43 # 44 STD_CFLAGS = ${OPTFLAGS} -D_REENTRANT -D${TARGETTYPE} -D${OSTYPE} ${CFGFLAGS} \ 45 ${ENDIAN_DEF} 46 STD_CPPFLAGS = ${STD_CFLAGS} 47 STD_CXXFLAGS = ${STD_CFLAGS} 48 49 BCM_CFLAGS = -Wall -Werror ${BCM_EXTRA_CC_CFLAGS} 50 51 BCM_CPPFLAGS = ${BCM_CFLAGS} 52 BCM_CXXFLAGS = ${BCM_CFLAGS} 53 54 ifeq (${ORIGIN}, Broadcom) 55 CFLAGS += ${STD_CFLAGS} ${BCM_CFLAGS} ${OPT_CFLAGS} 56 CPPFLAGS += ${STD_CPPFLAGS} ${BCM_CPPFLAGS} ${OPT_CPPFLAGS} 57 CXXFLAGS += ${STD_CXXFLAGS} ${BCM_CXXFLAGS} ${OPT_CXXFLAGS} 58 else 59 CFLAGS += ${STD_CFLAGS} ${OPT_CFLAGS} 60 CPPFLAGS += ${STD_CPPFLAGS} ${OPT_CPPFLAGS} 61 CXXFLAGS += ${STD_CXXFLAGS} ${OPT_CXXFLAGS} 62 endif 63 64 # 65 # Add flags required for running on unix. 66 # For GCC version > 4.6, add -Wl,--no-as-needed 67 # This is needed for compilation with shared libraries. 68 # 69 ifeq ($(LINUX_MAKE_SHARED_LIB),1) 70 GCC_VERSION = $(shell GCCVER=$(GCCVER) $(CC) -dumpversion | tr \\. 0) 71 ifeq ($(shell test $(GCC_VERSION) -ge 40600; echo $$?),0) 72 LDFLAGS += -Wl,--no-as-needed 73 endif 74 endif 75 76 # BCM.SIM needs: LDFLAGS += -lgcov for linking GCOV library 77 # if GCOV is enabled by: OPTFLAGS += -fprofile-arcs -ftest-coverage 78 # 79 80 ifneq (,$(findstring -fprofile-arcs,${OPTFLAGS})) 81 LDFLAGS += -lgcov 82 endif 83 84 LDFLAGS += ${LIBS} 85 86 # 87 # DEPEND is used as a command to generate the list of dependencies. 88 # The format of the output must be 89 # "file.o : file.c a/b/c.h d/e/f.h ...", 90 # if it is on multiple lines, each line must end in a backslash. 91 # The output MUST be on standard out. 92 # 93 DEPEND = ${CC} -M -P $(CFLAGS) $< 94