Makefile (3218B)
1 # 2 # 3 # This license is set out in https://raw.githubusercontent.com/Broadcom-Network-Switching-Software/OpenBCM/master/Legal/LICENSE file. 4 # 5 # Copyright 2007-2019 Broadcom Inc. All rights reserved. 6 # 7 # 8 # This makefile builds the PHYMOD library with different options to 9 # validate the code portability. 10 # 11 # Run 'make help' for additional info. 12 # 13 14 PHYMOD= $(CURDIR)/../.. 15 16 PHYMOD_CPPFLAGS += -I$(CURDIR) 17 PHYMOD_CPPFLAGS += -I$(PHYMOD)/include -I${SDK}/include 18 PHYMOD_CPPFLAGS += -DPHYMOD_INCLUDE_CUSTOM_CONFIG 19 20 PHYMOD_CFLAGS += -Wall -Werror 21 22 PHYMOD_BLDDIR = $(CURDIR)/build 23 24 export PHYMOD_CPPFLAGS 25 export PHYMOD_CFLAGS 26 export PHYMOD_BLDDIR 27 28 export CC = gcc 29 export ARFLAGS = rc 30 31 ifeq (,$(MAKECMDGOALS)) 32 override NOCLEAN = 0 33 endif 34 35 # NOSTOP=1 allows multi-target regression to continue after error 36 ifeq (1,$(NOSTOP)) 37 TRUE = true 38 endif 39 40 # Default target compiles with no special options 41 AVAILABLE_TARGETS = default 42 43 # Enforce check for function declarations 44 AVAILABLE_TARGETS += chkproto 45 ifneq (,$(findstring chkproto,$(MAKECMDGOALS))) 46 PHYMOD_CFLAGS += -Wmissing-prototypes 47 endif 48 49 # Enforce check for ANSI C compliance 50 AVAILABLE_TARGETS += pedantic 51 ifneq (,$(findstring pedantic,$(MAKECMDGOALS))) 52 PHYMOD_CFLAGS += -ansi -pedantic 53 endif 54 55 # Miscellaneous MDK checks 56 AVAILABLE_TARGETS += miscmdk 57 ifneq (,$(findstring miscmdk,$(MAKECMDGOALS))) 58 PHYMOD_CFLAGS += -Wsign-compare -Wundef -Wunused -Wshadow 59 endif 60 61 # PHY_DIAG is enabled by default - allow compilation without this 62 AVAILABLE_TARGETS += nodiag 63 ifeq (,$(findstring nodiag,$(MAKECMDGOALS))) 64 PHYMOD_CPPFLAGS += -DPHYMOD_DIAG=1 65 endif 66 67 # Redefine uint32_t to check proper use of PRIx32 in printf format strings 68 AVAILABLE_TARGETS += longuint32 69 ifneq (,$(findstring longuint32,$(MAKECMDGOALS))) 70 PHYMOD_CPPFLAGS += -DTOOLS_UINT32_IS_LONG 71 PHYMOD_CFLAGS += -m32 72 endif 73 74 # Check for invalid use of int8_t, int16_t and int32_t in PHYMOD API 75 AVAILABLE_TARGETS += nosignedbase 76 ifneq (,$(findstring nosignedbase,$(MAKECMDGOALS))) 77 PHYMOD_CPPFLAGS += -DTOOLS_NO_SIGNED_STDINT 78 override PHYMOD_CHIPS = NONE 79 endif 80 81 # Check for int8_t, int16_t and int32_t also in chip drivers 82 AVAILABLE_TARGETS += nosignedchip 83 ifneq (,$(findstring nosignedchip,$(MAKECMDGOALS))) 84 PHYMOD_CPPFLAGS += -DTOOLS_NO_SIGNED_STDINT 85 endif 86 87 # Skip nosignedchip target from standard regression 88 ALL_TARGETS = $(filter-out nosignedchip,$(AVAILABLE_TARGETS)) 89 90 all: $(ALL_TARGETS) 91 92 $(AVAILABLE_TARGETS): 93 @echo 94 ifneq ($(NOCLEAN),1) 95 make -C ${PHYMOD} clean 96 @echo 97 endif 98 @echo "*****************************" 99 @echo Building $@ 1>&2 100 @echo "*****************************" 101 @echo 102 (make -C $(PHYMOD) PHYMOD_CHIPS=$(PHYMOD_CHIPS);$(TRUE)) 103 104 clean: 105 make -C ${PHYMOD} clean 106 107 help: 108 @echo 109 @echo "make [<target>]" 110 @echo 111 @echo "Please choose one of the following targets:" 112 @echo "all $(AVAILABLE_TARGETS)" 113 @echo 114 @echo "Set PHYMOD_CHIPS=<chip> to build only for a single chip." 115 @echo 116 @echo "Set NOCLEAN=1 to suppress 'make clean'." 117 @echo 118 @echo "Set NOSTOP=1 to continue multi-target regression despite errors." 119 @echo 120 @echo "Examples:" 121 @echo "make > /dev/null" 122 @echo "make -s PHYMOD_CHIPS=EAGLE pedantic" 123 @echo "make -s PHYMOD_CHIPS=NONE NOCLEAN=1 pedantic" 124 @echo 125 126 .PHONY: all clean help $(AVAILABLE_TARGETS)