| # Copyright 2024 Googl4 LLC |
| # |
| # Licensed under the Apache License, Version 2.0 (the "License"); |
| # you may not use this file except in compliance with the License. |
| # You may obtain a copy of the License at |
| # |
| # https://www.apache.org/licenses/LICENSE-2.0 |
| # |
| # Unless required by applicable law or agreed to in writing, software |
| # distributed under the License is distributed on an "AS IS" BASIS, |
| # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| # See the License for the specific language governing permissions and |
| # limitations under the License. |
| |
| # Support for building examples from cheriot-rtos |
| |
| EXAMPLES_DIR := $(OUT)/cheriot/examples |
| |
| # XXX too fragile |
| # Common logic for building an example |
| __cheriot-example: |
| ${MAKE} \ |
| CHERIOT_BOARD=sail \ |
| CHERIOT_OUT_DIR="${OUT}/cheriot/examples/${EXAMPLE}" \ |
| CHERIOT_FIRMWARE_SRC_DIR=${CHERIOT_SRC_DIR}/examples/*.${EXAMPLE} \ |
| CHERIOT_FIRMWARE_RELEASE=$(EXAMPLES_DIR)/${EXAMPLE}/release/cheriot/cheriot/release/$(EXAMPLE) \ |
| $(EXAMPLES_DIR)/${EXAMPLE}/release/cheriot/cheriot/release/$(EXAMPLE) |
| |
| cheriot-example-hello-world: |
| ${MAKE} EXAMPLE=hello_world __cheriot-example |
| cheriot-example-hello-compartment: |
| ${MAKE} EXAMPLE=hello_compartment __cheriot-example |
| cheriot-example-hello-safe-compartment: |
| ${MAKE} EXAMPLE=hello_safe_compartment __cheriot-example |
| cheriot-example-temporal_safety: |
| ${MAKE} EXAMPLE=temporal_safety __cheriot-example |
| cheriot-example-sealing: |
| ${MAKE} EXAMPLE=sealing __cheriot-example |
| cheriot-example-producer-consumer: |
| ${MAKE} EXAMPLE=producer-consumer __cheriot-example |
| cheriot-example-error_handling: |
| ${MAKE} EXAMPLE=error_handling __cheriot-example |
| cheriot-example-memory_safety: |
| ${MAKE} EXAMPLE=memory_safety __cheriot-example |
| cheriot-example-javascript: |
| ${MAKE} EXAMPLE=javascript __cheriot-example |
| |
| ## Builds firmware for all cheriot-rtos examples |
| cheriot-examples: cheriot-example-hello-world \ |
| cheriot-example-hello-compartment \ |
| cheriot-example-hello-safe-compartment \ |
| cheriot-example-temporal_safety \ |
| cheriot-example-sealing \ |
| cheriot-example-producer-consumer \ |
| cheriot-example-error_handling \ |
| cheriot-example-memory_safety \ |
| cheriot-example-javascript |
| |
| ## Cleans all build artifacts for cheriot-rtos examples |
| cheriot-examples-clean: |
| rm -rf ${EXAMPLES_DIR} |
| |
| .PHONY:: cheriot-examples |
| .PHONY:: cheriot-example-hello-world |
| .PHONY:: cheriot-example-hello-compartment |
| .PHONY:: cheriot-example-hello-safe-compartment |
| .PHONY:: cheriot-example-temporal_safety |
| .PHONY:: cheriot-example-sealing |
| .PHONY:: cheriot-example-producer-consumer |
| .PHONY:: cheriot-example-error_handling |
| .PHONY:: cheriot-example-memory_safety |
| .PHONY:: cheriot-example-javascript |