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

Make.lib (1859B)


      1 #
      2 #  Copyright 2017 Broadcom
      3 #  
      4 #  This program is free software; you can redistribute it and/or modify
      5 #  it under the terms of the GNU General Public License, version 2, as
      6 #  published by the Free Software Foundation (the "GPL").
      7 #  
      8 #  This program is distributed in the hope that it will be useful, but
      9 #  WITHOUT ANY WARRANTY; without even the implied warranty of
     10 #  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
     11 #  General Public License version 2 (GPLv2) for more details.
     12 #  
     13 #  You should have received a copy of the GNU General Public License
     14 #  version 2 (GPLv2) along with this source code.
     15 #
     16 # $Id: Make.lib,v 1.14 Broadcom SDK $
     17 # $Copyright: (c) 2005 Broadcom Corp.
     18 # All Rights Reserved.$
     19 #
     20 # Make rules/targets for handling libraries
     21 
     22 .SECONDARY:: ${BOBJS}
     23 
     24 BOBJS_FAST = ${BOBJS}
     25 BOBJS_MAKE_CMD =
     26 
     27 ifeq ($(FAST),1)
     28   ifneq ($(strip $(BOBJS)),)
     29     BOBJS_FAST =
     30     BOBJS_ARGS = -j9
     31     BOBJS_MAKE_CMD = pwd && make LSRUN=$(SDK)/tools/lsrun.pl $(BOBJS_ARGS) ${BOBJS}
     32   endif
     33 endif
     34 
     35 ifeq ($(TOOLS),Borland)
     36 
     37 LIBSUFFIX=lib
     38 
     39 ${LIBDIR}/%.lib: ${BORLAND_BOBJS}
     40 	$(RM) $@
     41 	$(FOREACH) -subdir "$(LIBDIR)" \
     42 		"tlib $@ $(foreach obj, $(BORLAND_LOBJS), +-$(obj))"
     43 
     44 else	# !Borland
     45 
     46 ifeq ($(LINUX_MAKE_SHARED_LIB),1)
     47 LIBSUFFIX=so.${SHAREDLIBVER}
     48 else
     49 LIBSUFFIX=a
     50 endif
     51 
     52 targetlib = ${LIBDIR}/${lib}.${LIBSUFFIX}
     53 
     54 all:: ${BLDDIR}/.tree ${targetlib}
     55 
     56 ${LIBDIR}/%.${LIBSUFFIX}: ${BOBJS_FAST}
     57 	$(BOBJS_MAKE_CMD)
     58 ifdef QUIET
     59 	@$(ECHO) Building library $(notdir $@)
     60 endif
     61 	$Q$(RM) $@
     62 ifeq ($(LINUX_MAKE_SHARED_LIB),1)
     63 	$(CC) -shared -Wl,-soname,${lib}.${LIBSUFFIX}${EXTRA_LIB_LDFLAGS} -o ${targetlib} ${BOBJS} -lc
     64 else
     65 	$(AR) ${ARFLAGS} $@ $(sort ${BOBJS})
     66 endif
     67 
     68 endif	# !Borland
     69 
     70 
     71 install:: all
     72 
     73 clean::
     74 ifdef QUIET
     75 	@$(ECHO) Cleaning objects for ${LOCALDIR} and ${lib}
     76 endif
     77 	$Q$(RM) ${BOBJS}
     78 	$Q$(RM) ${targetlib}
     79 
     80 distclean:: clean