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

depend.mk (1256B)


      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 # Default rule to build dependencies.  This builds an x.d file for each
      7 # x.c file that describes the dependencies.  We then conditionally include
      8 # the generated .d files.
      9 #
     10 
     11 ifneq (n/a,$(PCIEG3_DEPEND))
     12 
     13 #
     14 # If making 'clean', do not include any .d files.  If they are included,
     15 # gmake intrinsically tries to remake them all.
     16 #
     17 
     18 ifeq (,$(findstring clean,$(MAKECMDGOALS)))
     19 
     20 #
     21 # Attempt to build the depend files.  If it fails, the depend file is
     22 # removed so that it is not included in later builds.
     23 #
     24 $(BLDDIR)/%.d : %.c $(BLDDIR)/.tree
     25 	@$(ECHO) Dependencies for $(LOCALDIR)/$<
     26 ifdef MAKEDEP
     27 	@$(MAKEDEP) "$@" "$@" "$(PCIEG3_DEPEND)"
     28 else
     29 	@$(PRINTF) '$$(BLDDIR)/' > $@
     30 	@$(PCIEG3_DEPEND) >> $@
     31 endif
     32 
     33 ifneq ($(strip $(LSRCS)),)
     34 ifneq (,$(findstring .$(OBJSUFFIX),$(MAKECMDGOALS)))
     35 -include $(addprefix $(BLDDIR)/,$(MAKECMDGOALS:.$(OBJSUFFIX)=.d))
     36 else
     37 -include $(addprefix $(BLDDIR)/,$(addsuffix .d,$(basename $(LSRCS))))
     38 endif
     39 endif
     40 
     41 endif	# !CLEANING
     42 
     43 clean::
     44 	@$(ECHO) Cleaning dependencies for $(LOCALDIR)
     45 	@$(RM) $(BOBJS:.$(OBJSUFFIX)=.d)
     46 
     47 endif