Shad Ansari | 2f7f9be | 2017-06-07 13:34:53 -0700 | [diff] [blame] | 1 | # Central Makefile |
| 2 | # |
| 3 | PLATFORM ?= maple |
| 4 | TOP_DIR=$(shell pwd) |
| 5 | export PLATFORM |
| 6 | export TOP_DIR |
| 7 | |
| 8 | ifeq ("$(PLATFORM)", "maple") |
| 9 | DEVICE=bcm68620 |
| 10 | export DEVICE |
| 11 | else |
| 12 | $(error Set DEVICE for $(PLATFORM)) |
| 13 | endif |
| 14 | |
| 15 | MAKE_DIR=$(TOP_DIR)/make |
| 16 | MAKE_DEVICE_DIR=$(MAKE_DIR)/$(DEVICE) |
| 17 | export MAKE_DIR |
| 18 | export MAKE_DEVICE_DIR |
| 19 | |
| 20 | include $(MAKE_DIR)/Makefile.initial_config |
| 21 | OUT_DIR ?= $(TOP_DIR)/build |
| 22 | OUT_DOCS_DIR ?= $(OUT_DIR)/doc |
| 23 | |
| 24 | # Identify whether it is customer or development build |
| 25 | EMB_MODULE_LIST=$(realpath $(MAKE_DEVICE_DIR)/modules.embedded) |
| 26 | ifeq ("$(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 |
| 33 | else |
| 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 |
| 38 | endif |
| 39 | |
| 40 | ifneq ("$(BOARD)", "") |
| 41 | COPY_HOST_FS_CMD = $(SILENT_BUILD)$(COPY_FS_SH) TOP_DIR=$(TOP_DIR) OUT_HOST_DIR=$(OUT_HOST_DIR) |
| 42 | endif |
| 43 | |
| 44 | export OUT_HOST_DIR |
| 45 | export OUT_DOCS_DIR |
| 46 | |
| 47 | # List of all modules, all library modules and all application modules |
| 48 | export ALL_MODULES |
| 49 | export ALL_LIB_MODULES |
| 50 | export ALL_APP_MODULES |
| 51 | |
| 52 | # Current board |
| 53 | export BOARD |
| 54 | |
| 55 | V ?= 0 |
| 56 | ifeq (x"$(V)", x"0") |
| 57 | SILENT = -s |
| 58 | export SILENT |
| 59 | SILENT_BUILD=@ |
| 60 | endif |
| 61 | |
| 62 | ifeq ("$(RELEASE_BUILD)", "y") |
| 63 | all: build_host |
| 64 | else |
| 65 | all: build_host build_embedded |
| 66 | endif |
| 67 | $(COPY_HOST_FS_CMD) |
| 68 | @echo --- All done --- |
| 69 | |
| 70 | copy_host_fs: |
| 71 | $(COPY_HOST_FS_CMD) |
| 72 | |
| 73 | ifeq ("$(RELEASE_BUILD)", "y") |
| 74 | clean: clean_host |
| 75 | else |
| 76 | clean: clean_host clean_embedded |
| 77 | endif |
| 78 | rm -fr $(OUT_DIR) |
| 79 | |
| 80 | help_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 | |
| 106 | ifeq ("$(RELEASE_BUILD)", "y") |
| 107 | help: help_general help_host |
| 108 | else |
| 109 | help: help_general help_host help_embedded |
| 110 | endif |
| 111 | |
| 112 | docs: docs_host |
| 113 | |
| 114 | docs_host: |
| 115 | $(SILENT_BUILD)$(MAKE) SUBSYSTEM=host -f $(MAKE_DIR)/Makefile.main $@ |
| 116 | |
| 117 | docs_pdf: docs |
| 118 | $(SILENT_BUILD)$(MAKE) -C $(OUT_DOCS_DIR)/latex |
| 119 | |
| 120 | docs_clean: |
| 121 | $(SILENT_BUILD)$(BOLD_PRINT) "Cleaning docs" |
| 122 | $(SILENT_BUILD)rm -fr $(OUT_DOCS_DIR) |
| 123 | |
| 124 | clobber: clean docs_clean |
| 125 | |
| 126 | host: build_host |
| 127 | $(COPY_HOST_FS_CMD) |
| 128 | |
| 129 | clean_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 | |
| 136 | ifneq ("$(RELEASE_BUILD)", "y") |
| 137 | embedded: build_embedded |
| 138 | $(COPY_HOST_FS_CMD) |
| 139 | |
| 140 | clean_embedded: |
| 141 | $(SILENT_BUILD)rm -fr $(OUT_EMBEDDED_DIR) |
| 142 | $(SILENT_BUILD)$(MAKE) $(SILENT) SUBSYSTEM=embedded -f $(MAKE_DIR)/Makefile.main $@ |
| 143 | |
| 144 | docs_embedded: |
| 145 | |
| 146 | %_embedded: |
| 147 | $(SILENT_BUILD)$(MAKE) $(SILENT) SUBSYSTEM=embedded -f $(MAKE_DIR)/Makefile.main $@ |
| 148 | |
| 149 | endif |
| 150 | |
| 151 | |
| 152 | hal_generator: |
| 153 | $(SILENT_BUILD)$(MAKE) $(SLIENT) -C $(TOP_DIR)/embedded/hal_generator/src |
| 154 | |
| 155 | drivers: |
| 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 | |
| 161 | clean_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 | |