Makefile (2212B)
1 # -*- Makefile -*- 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 # API mode Makefile 8 # 9 10 ifneq (,$(findstring apimode,$(MAKECMDGOALS))) 11 LBUILD=1 12 endif 13 14 ifndef LBUILD 15 16 # Build as part of the SDK 17 18 LOCALDIR = src/appl/diag/api 19 20 include ${SDK}/make/Make.config 21 22 CFGFLAGS += -I$(SDK)/src/appl/cint 23 CFGFLAGS += -I$(SDK)/src/appl/diag/cint 24 25 lib = libdiagapi 26 include ${SDK}/make/Make.lib 27 28 include ${SDK}/make/Make.depend 29 else 30 31 # Build standalone interpreter application 32 33 CFLAGS := -g 34 CFLAGS += -DYYDEBUG 35 CFLAGS += -DAPIMODE_INCLUDE_MAIN=1 36 CFLAGS += -Wall 37 CFLAGS += -Werror 38 CFLAGS += -Wformat 39 CFLAGS += -Wdeclaration-after-statement 40 CFLAGS += -Wuninitialized 41 CFLAGS += -Wunreachable-code 42 CFLAGS += -Winline 43 CFLAGS += -Wpointer-sign 44 CFLAGS += -Wextra 45 CFLAGS += -Wmissing-format-attribute 46 CFLAGS += -Wunused-parameter 47 CFLAGS += -Wstrict-prototypes 48 CFLAGS += -Wshadow 49 CFLAGS += -Wbad-function-cast 50 CFLAGS += -Wlogical-op 51 CFLAGS += -Waggregate-return 52 CFLAGS += -Wold-style-definition 53 CFLAGS += -Wmissing-prototypes 54 CFLAGS += -Wmissing-declarations 55 CFLAGS += -Wmissing-noreturn 56 CFLAGS += -Wnested-externs 57 CFLAGS += -ansi 58 CFLAGS += -I../../../../include 59 CFLAGS += -I../../../appl/cint 60 CFLAGS += -DVA_COPY_PTR 61 CFLAGS += -DCINT_CONFIG_INCLUDE_STDLIB=1 62 CFLAGS += -D_GNU_SOURCE 63 64 LDFLAGS := -g 65 CC := /tools/bin/gcc 66 BISON := /tools/bin/bison 67 YEAR := $(shell date +%Y) 68 TMP := tmp.h 69 70 apimode: main 71 72 gen: api_grammar.tab.c 73 74 main.o: api_mode.h api_grammar.tab.h 75 76 api_mode.o: api_mode.h api_grammar.tab.h 77 78 main: main.o api_grammar.tab.o api_mode.o 79 80 api_grammar.tab.h: api_grammar.tab.c 81 82 api_grammar.tab.c: api_grammar.y api_mode.h 83 $(BISON) -g -d -v $< 84 @echo '/* ' > $(TMP) 85 @echo -n ' $$' >> $(TMP) 86 @echo -n 'Id: ' >> $(TMP) 87 @echo '$$' >> $(TMP) 88 @echo ' $$Copyright: $(YEAR) Broadcom Corp.' >> $(TMP) 89 @echo ' All Rights Reserved.$$' >> $(TMP) 90 @echo '*/' >> $(TMP) 91 @cat api_grammar.tab.h >> $(TMP) 92 @rm api_grammar.tab.h 93 @mv tmp.h api_grammar.tab.h 94 95 grammar: api_grammar.tab.c 96 97 clean: 98 -rm -f api_grammar.output \ 99 api_grammar.tab.* *.o *.dot main 100 101 102 endif