blob: 29a26efa9328be200fce2776c04f36e27317b433 [file] [log] [blame]
Shad Ansari2f7f9be2017-06-07 13:34:53 -07001# Central Makefile
2#
3PLATFORM ?= maple
4TOP_DIR=$(shell pwd)
5export PLATFORM
6export TOP_DIR
7
8ifeq ("$(PLATFORM)", "maple")
9 DEVICE=bcm68620
10 export DEVICE
11else
12 $(error Set DEVICE for $(PLATFORM))
13endif
14
15MAKE_DIR=$(TOP_DIR)/make
16MAKE_DEVICE_DIR=$(MAKE_DIR)/$(DEVICE)
17export MAKE_DIR
18export MAKE_DEVICE_DIR
19
20include $(MAKE_DIR)/Makefile.initial_config
21OUT_DIR ?= $(TOP_DIR)/build
22OUT_DOCS_DIR ?= $(OUT_DIR)/doc
23
24# Identify whether it is customer or development build
25EMB_MODULE_LIST=$(realpath $(MAKE_DEVICE_DIR)/modules.embedded)
26ifeq ("$(EMB_MODULE_LIST)", "")
27 RELEASE_BUILD=y
28 export RELEASE_BUILD
29 USE_LINT=n
30 export USE_LINT
31 OUT_HOST_DIR ?= $(OUT_DIR)
32 COPY_FS_SH = $(TOP_DIR)/make/copy_host_fs.sh
33else
34 OUT_HOST_DIR ?= $(OUT_DIR)/$(PLATFORM)/host
35 OUT_EMBEDDED_DIR ?= $(OUT_DIR)/$(PLATFORM)/embedded
36 COPY_FS_SH = $(TOP_DIR)/scripts/copy_host_fs.sh
37 export OUT_EMBEDDED_DIR
38endif
39
40ifneq ("$(BOARD)", "")
41 COPY_HOST_FS_CMD = $(SILENT_BUILD)$(COPY_FS_SH) TOP_DIR=$(TOP_DIR) OUT_HOST_DIR=$(OUT_HOST_DIR)
42endif
43
44export OUT_HOST_DIR
45export OUT_DOCS_DIR
46
47# List of all modules, all library modules and all application modules
48export ALL_MODULES
49export ALL_LIB_MODULES
50export ALL_APP_MODULES
51
52# Current board
53export BOARD
54
55V ?= 0
56ifeq (x"$(V)", x"0")
57 SILENT = -s
58 export SILENT
59 SILENT_BUILD=@
60endif
61
62ifeq ("$(RELEASE_BUILD)", "y")
63all: build_host
64else
65all: build_host build_embedded
66endif
67 $(COPY_HOST_FS_CMD)
68 @echo --- All done ---
69
70copy_host_fs:
71 $(COPY_HOST_FS_CMD)
72
73ifeq ("$(RELEASE_BUILD)", "y")
74clean: clean_host
75else
76clean: clean_host clean_embedded
77endif
78 rm -fr $(OUT_DIR)
79
80help_general:
81 @echo "make parameters:"
82 @echo " PLATFORM - platform to perform the build for. The default platform is $$PLATFORM"
83 @echo " Supported platforms are: maple"
84 @echo " BOARD - TBD board"
85 @echo " ENABLE_EPON - Include EPON/10GEPON support. Default =y, unless overwritten in platform configuration"
86 @echo " ENABLE_GPON - Include GPON support. Default =y, unless overwritten in platform configuration"
87 @echo " ENABLE_XGPON - Include XGPON support. Default =y, unless overwritten in platform configuration"
88 @echo " V=<output_level> - =1-verbose command output, =2-makefile debug output"
89 @echo " GEN_OBJTAGS - Low-level option. OBGTAGS to be passed to code generator"
90 @echo " EXTRA_TYPES - Low-level option. Space-delimited list of extra types without bcmolt_ prefix"
91 @echo " ENABLE_CLI - =n-exclude CLI support. Included by default"
92 @echo " ENABLE_LOG - =n-exclude dev_log support. Included by default"
93 @echo "make targets:"
94 @echo " all - build everything for the PLATFORM. This is the default target"
95 @echo " host - build PLATFORM's host side"
96 @echo " embedded - build PLATFORM's embedded side"
97 @echo " clean - clean everything for the PLATFORM"
98 @echo " clean_host - clean PLATFORM's host side"
99 @echo " clean_embedded - clean PLATFORM's embedded side"
100 @echo " docs - generate reference document in html format"
101 @echo " docs_pdf - generate reference document in pdf format"
102 @echo " drivers - generate librdb, ru_gen and hal_generator driver layers"
103 @echo " clean_drivers - clean librdb, ru_gen and hal_generator"
104
105
106ifeq ("$(RELEASE_BUILD)", "y")
107help: help_general help_host
108else
109help: help_general help_host help_embedded
110endif
111
112docs: docs_host
113
114docs_host:
115 $(SILENT_BUILD)$(MAKE) SUBSYSTEM=host -f $(MAKE_DIR)/Makefile.main $@
116
117docs_pdf: docs
118 $(SILENT_BUILD)$(MAKE) -C $(OUT_DOCS_DIR)/latex
119
120docs_clean:
121 $(SILENT_BUILD)$(BOLD_PRINT) "Cleaning docs"
122 $(SILENT_BUILD)rm -fr $(OUT_DOCS_DIR)
123
124clobber: clean docs_clean
125
126host: build_host
127 $(COPY_HOST_FS_CMD)
128
129clean_host:
130 $(SILENT_BUILD)rm -fr $(OUT_HOST_DIR)
131 $(SILENT_BUILD)$(MAKE) $(SILENT) SUBSYSTEM=host -f $(MAKE_DIR)/Makefile.main $@
132
133%_host:
134 $(SILENT_BUILD)$(MAKE) $(SILENT) SUBSYSTEM=host -f $(MAKE_DIR)/Makefile.main $@
135
136ifneq ("$(RELEASE_BUILD)", "y")
137embedded: build_embedded
138 $(COPY_HOST_FS_CMD)
139
140clean_embedded:
141 $(SILENT_BUILD)rm -fr $(OUT_EMBEDDED_DIR)
142 $(SILENT_BUILD)$(MAKE) $(SILENT) SUBSYSTEM=embedded -f $(MAKE_DIR)/Makefile.main $@
143
144docs_embedded:
145
146%_embedded:
147 $(SILENT_BUILD)$(MAKE) $(SILENT) SUBSYSTEM=embedded -f $(MAKE_DIR)/Makefile.main $@
148
149endif
150
151
152hal_generator:
153 $(SILENT_BUILD)$(MAKE) $(SLIENT) -C $(TOP_DIR)/embedded/hal_generator/src
154
155drivers:
156 $(SILENT_BUILD)$(MAKE) $(SLIENT) -C $(TOP_DIR)/embedded/hal_generator/librdb
157 $(SILENT_BUILD)$(MAKE) $(SLIENT) -C $(TOP_DIR)/embedded/hal_generator/ru_gen
158 $(SILENT_BUILD)$(MAKE) $(SLIENT) -C $(TOP_DIR)/embedded/pm_drv_generator
159
160
161clean_drivers:
162 $(SILENT_BUILD)$(MAKE) $(SLIENT) -C $(TOP_DIR)/embedded/hal_generator/librdb clean
163 $(SILENT_BUILD)$(MAKE) $(SLIENT) -C $(TOP_DIR)/embedded/hal_generator/ru_gen clean
164 $(SILENT_BUILD)$(MAKE) $(SLIENT) -C $(TOP_DIR)/embedded/hal_generator/src clean
165 $(SILENT_BUILD)$(MAKE) $(SLIENT) -C $(TOP_DIR)/embedded/pm_drv_generator clean
166