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

config.mk (2590B)


      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 # PHYMOD make rules and definitions
      7 #
      8 
      9 #
     10 # Provide reasonable defaults for configuration variables
     11 #
     12 
     13 # Default build directory
     14 ifndef PHYMOD_BLDDIR
     15 PHYMOD_BLDDIR = $(PHYMOD)/build
     16 endif
     17 
     18 # Location to build objects in
     19 ifndef PHYMOD_OBJDIR
     20 PHYMOD_OBJDIR = $(PHYMOD_BLDDIR)/obj
     21 endif
     22 override BLDDIR := $(PHYMOD_OBJDIR)
     23 
     24 # Location to place libraries
     25 ifndef PHYMOD_LIBDIR
     26 PHYMOD_LIBDIR = $(PHYMOD_BLDDIR)
     27 endif
     28 LIBDIR := $(PHYMOD_LIBDIR)
     29 
     30 # Option to retrieve compiler version
     31 ifndef PHYMOD_CC_VERFLAGS
     32 PHYMOD_CC_VERFLAGS := -v
     33 endif
     34 CC_VERFLAGS = $(PHYMOD_CC_VERFLAGS); 
     35 
     36 # Default suffix for object files
     37 ifndef PHYMOD_OBJSUFFIX
     38 PHYMOD_OBJSUFFIX = o
     39 endif
     40 OBJSUFFIX = $(PHYMOD_OBJSUFFIX)
     41 
     42 # Default suffix for library files
     43 ifndef PHYMOD_LIBSUFFIX
     44 PHYMOD_LIBSUFFIX = a
     45 endif
     46 LIBSUFFIX = $(PHYMOD_LIBSUFFIX)
     47 
     48 #
     49 # Set up compiler options, etc.
     50 #
     51 
     52 # Default include path
     53 PHYMOD_INCLUDE_PATH = -I$(PHYMOD)/include
     54 PHYMOD_INCLUDE_PATH += -I$(PHYMOD)/chip/
     55 
     56 # Import preprocessor flags avoiding include duplicates
     57 TMP_PHYMOD_CPPFLAGS := $(filter-out $(PHYMOD_INCLUDE_PATH),$(PHYMOD_CPPFLAGS))
     58 
     59 # Convenience Makefile flags for building specific chips
     60 ifdef PHYMOD_CHIPS
     61 PHYMOD_DSYM_CPPFLAGS := -DPHYMOD_CONFIG_INCLUDE_CHIP_DEFAULT=0 
     62 PHYMOD_DSYM_CPPFLAGS += $(foreach chip,$(PHYMOD_CHIPS),-DPHYMOD_CONFIG_INCLUDE_${chip}=1) 
     63 endif
     64 ifdef PHYMOD_NCHIPS
     65 PHYMOD_DSYM_CPPFLAGS += $(foreach chip,$(PHYMOD_NCHIPS),-DPHYMOD_CONFIG_INCLUDE_${chip}=0)
     66 endif
     67 
     68 TMP_PHYMOD_CPPFLAGS += $(PHYMOD_DSYM_CPPFLAGS)
     69 export PHYMOD_DSYM_CPPFLAGS
     70 
     71 ifdef DSYMS
     72 TMP_PHYMOD_CPPFLAGS += -DPHYMOD_CONFIG_CHIP_SYMBOLS_USE_DSYMS=1
     73 endif
     74 
     75 override CPPFLAGS = $(TMP_PHYMOD_CPPFLAGS) $(PHYMOD_INCLUDE_PATH)
     76 
     77 
     78 # Import compiler flags
     79 override CFLAGS = $(PHYMOD_CFLAGS)
     80 
     81 
     82 
     83 
     84 #
     85 # Define standard targets, etc.
     86 #
     87 
     88 ifdef LOCALDIR
     89 override BLDDIR := $(BLDDIR)/$(LOCALDIR)
     90 endif
     91 
     92 ifndef LSRCS
     93 LSRCS = $(wildcard *.c)
     94 endif
     95 ifndef LOBJS
     96 LOBJS = $(addsuffix .$(OBJSUFFIX), $(basename $(LSRCS)))
     97 endif
     98 ifndef BOBJS
     99 BOBJS = $(addprefix $(BLDDIR)/,$(LOBJS))
    100 endif
    101 
    102 # Use PHYMOD_QUIET=1 to control printing of compilation lines.
    103 ifdef PHYMOD_QUIET
    104 Q = @
    105 endif
    106 
    107 #
    108 # Define rules for creating object directories
    109 #
    110 
    111 .PRECIOUS: $(BLDDIR)/.tree
    112 
    113 %/.tree:
    114 	@$(ECHO) 'Creating build directory $(dir $@)'
    115 	$(Q)$(MKDIR) $(dir $@)
    116 	@$(ECHO) "Build Directory for $(LOCALDIR) created" > $@
    117 
    118 #
    119 # Configure build tools
    120 #
    121 include $(PHYMOD)/make/maketools.mk