Makefile (2669B)
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 7 LOCALDIR = systems/sim/l2switch 8 9 SDK :=$(shell if [ -n "$$SDK" ] ; then\ 10 echo $$SDK;\ 11 else\ 12 cd $(dir $(lastword $(MAKEFILE_LIST))); while /usr/bin/test ! -e RELEASE ; do \ 13 dir=`cd ../;pwd`; \ 14 if [ "$$dir" = "/" ] ; then \ 15 echo Cannot find SDK in $(lastword $(MAKEFILE_LIST)) 1>&2; \ 16 exit 1; \ 17 fi ; \ 18 cd $$dir; \ 19 done ; \ 20 pwd; \ 21 fi) 22 23 ifeq ($(SDK),) 24 $(error Please run this in a tree) 25 endif 26 27 export SDK 28 29 ifeq ($(INSTALL_DIR),) 30 INSTALL_DIR=. 31 endif 32 33 include ${SDK}/make/Make.config 34 35 # 36 # To use Purify, add a line here similar to the following: 37 # 38 #CC=/net/igor/export/home/pure/purify-4.2-solaris2/purify gcc 39 40 # 41 # Define all targets to build 42 # 43 44 L2SWITCH = ${INSTALL_DIR}/l2switch.${targetplat}${all_suffix} 45 L2SWITCH_LIB = ${LIBDIR}/libl2switch.a 46 47 all_targets = ${L2SWITCH} ${L2SWITCH_LIB} 48 49 # 50 # Define targets to be built by default. 51 # 52 build_targets = ${all_targets} 53 54 # 55 # Libraries 56 # 57 58 #DIAG_LIBS = \ 59 # ${COND_LIB_EDITLINE} \ 60 # libdiag.a libtest.a \ 61 # ${COND_LIB_TCL} \ 62 # libsal_appl.a libsal_appl_plat.a libplibde.a 63 64 L2SWITCH_LIBS = ${APPL_LIBS} ${DRV_LIBS} ${DIAG_LIBS} 65 L2SWITCH_LIBS_BLD = $(addprefix ${BLDROOT}/,${L2SWITCH_LIBS}) 66 67 68 all:: ${BLDDIR}/.tree ${build_targets} 69 70 # Libraries 71 72 .PHONY: _bcm_libraries 73 74 _bcm_libraries: 75 ifndef NO_BCM 76 $(MAKE) -C ${SDK} 77 endif 78 79 # Example L2 Switch Application 80 81 ${L2SWITCH}: _bde _bcm_libraries ${BOBJS} ${BLDDIR}/version.o 82 @rm -f ${L2SWITCH} # Prevent core dump if currently running 83 ${CC} -o ${L2SWITCH} ${BOBJS} ${BLDDIR}/version.o \ 84 ${L2SWITCH_LIBS_BLD} \ 85 ${L2SWITCH_LIBS_BLD} \ 86 ${L2SWITCH_LIBS_BLD} \ 87 ${LDFLAGS} 88 89 L2SWITCH_SRCS = \ 90 l2switch.c 91 L2SWITCH_OBJS = $(addsuffix .o, $(basename ${L2SWITCH_SRCS})) 92 L2SWITCH_BOBJS = $(addprefix ${BLDDIR}/,${L2SWITCH_OBJS}) 93 94 ${L2SWITCH_LIB}: ${L2SWITCH_BOBJS} 95 ${RM} $@ 96 $Q$(AR) ${ARFLAGS} $@ $(sort ${L2SWITCH_BOBJS}) 97 98 # Build Version 99 100 ${BLDDIR}/version.c: ${BLDDIR}/.tree 101 $(MKVERS) > $@ 102 ${BLDDIR}/version.o: ${BLDDIR}/version.c 103 ${CC} ${CFLAGS} -c $< -o $@ 104 105 # Make.depend is before clean:: so that Make.depend's clean:: runs first. 106 107 include ${SDK}/make/Make.depend 108 109 # Clean 110 111 clean:: ${BLDDIR}/.tree 112 rm -f ${all_targets} 113 rm -f ${BOBJS} 114 rm -f ${LIBDIR}/libl2switch.a 115 rm -f ${BLDDIR}/version.c ${BLDDIR}/version.o 116 ifndef NO_BCM 117 $(MAKE) -C ${SDK} clean 118 endif 119 $(MAKE) -C ${SDK}/systems/bde/pli clean 120 121 distclean:: 122 $(RM) $(BLDROOT) 123 $(RM) $(DEST_DIR) 124 125 .PHONY: _bde 126 _bde: 127 ifndef NO_BDE 128 $(MAKE) -C ${SDK}/systems/bde/pli 129 endif