openbcm

Git mirror of https://github.com/Broadcom-Network-Switching-Software/OpenBCM
git clone git://git.finwo.net/mirror/broadcom/openbcm
Log | Files | Refs | README

Makefile (4823B)


      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/pcid
      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 include ${SDK}/make/Make.config
     30 
     31 ifeq ($(INSTALL_DIR),)
     32 INSTALL_DIR=.
     33 endif
     34 
     35 ifndef SIM_STANDALONE_ONLY
     36 #for SIM_STANDALONE_ONLY only libpcid.a should be compiled
     37 ifdef DPP_CHIPS
     38 LOCALDIR=systems/sim/pcid
     39 subdirs := ../dpp/ChipSim
     40 include ${SDK}/make/Make.subdirs
     41 endif
     42 
     43 ifdef DFE_CHIPS
     44 LOCALDIR=systems/sim/pcid
     45 subdirs := ../dpp/ChipSim
     46 include ${SDK}/make/Make.subdirs
     47 endif
     48 endif
     49 #
     50 # To use Purify, add a line here similar to the following:
     51 #
     52 #CC=/net/igor/export/home/pure/purify-4.2-solaris2/purify gcc
     53 
     54 #
     55 # Define all targets to build
     56 #
     57 
     58 PCID = ${INSTALL_DIR}/pcid.${targetplat}${all_suffix}
     59 PCID_LIB = ${LIBDIR}/libpcid.a
     60 
     61 all_targets = ${PCID} ${PCID_LIB}
     62 
     63 #
     64 # Define targets to be built by default.
     65 #
     66 build_targets = ${all_targets}
     67 
     68 #
     69 # Libraries
     70 #
     71 #DIAG_LIBS = \
     72 #	${COND_LIB_EDITLINE} \
     73 #	libsal_appl.a libsal_appl_plat.a libplibde.a
     74 
     75 
     76 
     77 
     78 
     79 PCID_LIBS = ${EXTRA_TEST_LIBS} ${DRV_LIBS} ${DIAG_LIBS} ${APPL_LIBS}
     80 PCID_LIBS_BLD = $(addprefix ${BLDROOT}/,${PCID_LIBS})
     81 
     82 ifdef DPP_CHIPS
     83 PCID_LIB_CHIPSIM =  ${LIBDIR}/libchipsim_sim.a
     84 PCID_LIBS_BLD += ${PCID_LIB_CHIPSIM} 
     85 endif
     86 
     87 ifdef DPP_DFE
     88 PCID_LIB_CHIPSIM =  ${LIBDIR}/libchipsim_sim.a
     89 PCID_LIBS_BLD += ${PCID_LIB_CHIPSIM} 
     90 endif
     91 
     92 #ifdef BUILD_MACSEC
     93 PCID_LIBS_BLD += ${EXTERNAL_LIBS}
     94 #endif
     95 
     96 export IPROC_NO_ATL = 1
     97 CFGFLAGS += -DIPROC_NO_ATL
     98 
     99 all:: ${BLDDIR}/.tree ${build_targets}
    100 
    101 
    102 
    103 # Libraries
    104 
    105 .PHONY: _bcm_libraries
    106 
    107 _bcm_libraries:
    108 ifndef NO_BCM
    109 	$(MAKE) -C ${SDK}
    110 ifdef BUILD_PHYMOD
    111 	$(MAKE) -C $(SDK)/libs/phymod
    112 endif
    113 endif
    114 
    115 # Broadcom Command Monitor
    116 
    117 # Build platform_defines.c to compile in config.bcm
    118 #
    119 ifndef NO_SAL_APPL
    120 PLATFORM_DEFINES_OBJ=${BLDDIR}/platform_defines.o
    121 ${BLDDIR}/platform_defines.c: $(BLDDIR)/.tree ${SDK}/rc/config.bcm
    122 	$(PERL) ${SDK}/tools/bcm2c_linux.pl ${SDK}/rc/config.bcm >$@
    123 ${BLDDIR}/platform_defines.o: ${BLDDIR}/platform_defines.c
    124 	${CC} ${CFLAGS} -c $< -o $@
    125 ifndef NO_VERSION
    126 	touch ${SDK}/rc/config.bcm
    127 endif
    128 else
    129 PLATFORM_DEFINES_OBJ=
    130 endif
    131 
    132 # PCI Daemon (chip simulator)
    133 ifdef SIM_STANDALONE_ONLY
    134 #for SIM_STANDALONE_ONLY only libpcid.a should be compiled
    135 ${PCID}:
    136 
    137 else
    138 
    139 LINKER := $(CC)
    140 ifeq ($(C_CPP_CODE_MIX), TRUE)
    141 LINKER := $(CXX)
    142 endif
    143 
    144 ${PCID}: _bde _bcm_libraries ${BOBJS} ${BLDDIR}/version.o \
    145          ${PLATFORM_DEFINES_OBJ}
    146 	@rm -f ${PCID}	# Prevent core dump if currently running
    147 	${LINKER} -o ${PCID} ${BOBJS} ${BLDDIR}/version.o \
    148 	${PLATFORM_DEFINES_OBJ} ${LDFLAGS} \
    149         -Wl,--start-group ${PCID_LIBS_BLD} -Wl,--end-group
    150 endif
    151 # This list has the .c files except for chipsim.c and pcidappl.c
    152 # Update it when new files are added so the AV simulator works.
    153 PCID_SRCS = \
    154 	cmicx_sim.c cmicx_sim_schan.c cmicx_sim_sbus_dma.c cmicx_sim_util.c \
    155 	cmicx_sim_packet_dma.c datum.c cmicsim.c pli.c util.c dma.c  physim.c\
    156 	ism.c \
    157 	l2x.c l3x.c socintf.c proc_req.c packet.c vlan.c \
    158     mpls.c fpem.c tunnel.c
    159 PCID_OBJS = $(addsuffix .o, $(basename ${PCID_SRCS}))
    160 PCID_BOBJS = $(addprefix ${BLDDIR}/,${PCID_OBJS})
    161 
    162 ${PCID_LIB}: ${PCID_BOBJS}
    163 	${RM} $@
    164 	$(AR) ${ARFLAGS} $@ $(sort ${PCID_BOBJS})
    165 
    166 $(BLDDIR)/%.P: $(BLDDIR)/.tree
    167 	$(info $@)
    168 
    169 #
    170 # Build version generator.  If NO_VERSION=1 is specified in Make.local
    171 # or on command line, then use the existing version.c.  If that doesn't
    172 # exist, copy the default one from config.
    173 #
    174 # Otherwise, force the generation of a new version.c using the perl script.
    175 #
    176 ifdef NO_VERSION
    177 ${BLDDIR}/version.c: ${BLDDIR}/.tree
    178 	$(CP) ${SDK}/make/version.c $@
    179 else
    180 .PHONY: _force
    181 ${BLDDIR}/version.c: ${MAIN_LIB} _bde _bcm_libraries
    182 	$(MKVERS) > $@
    183 endif
    184 
    185 ${BLDDIR}/version.o: ${BLDDIR}/version.c
    186 	${CC} ${CFLAGS} -c $< -o $@
    187 
    188 # Make.depend is before clean:: so that Make.depend's clean:: runs first.
    189 
    190 include ${SDK}/make/Make.depend
    191 
    192 # Clean
    193 
    194 clean:: ${BLDDIR}/.tree 
    195 	rm -f ${all_targets}
    196 	rm -f ${BOBJS}
    197 	rm -f ${LIBDIR}/libpcid.a
    198 	rm -f ${BLDDIR}/version.c ${BLDDIR}/version.o
    199 	rm -f ${BLDDIR}/platform_defines.c ${BLDDIR}/platform_defines.o
    200 ifndef NO_BCM
    201 	$(MAKE) -C ${SDK} clean
    202 ifdef BUILD_PHYMOD
    203 	$(MAKE) -C $(SDK)/libs/phymod clean
    204 endif
    205 endif
    206 	$(MAKE) -C ${SDK}/systems/bde/pli clean
    207 
    208 distclean::
    209 	$(RM) $(BLDROOT)
    210 	$(RM) $(DEST_DIR)
    211 
    212 .PHONY: _bde
    213 _bde:
    214 ifndef NO_BDE
    215 	$(MAKE) -C ${SDK}/systems/bde/pli
    216 endif