blob: 7acb19391da25916c50f0045ae58df2413326fcd [file] [log] [blame]
# Copyright 2022 Google 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.
# CantripOS Test Applications
# NB: these are platform-specific
RUST_TARGET := unknown
CANTRIP_APP_ARCH := unknown
# TODO(jtgans): should include from platforms/${PLATFORM}/platform.mk
include $(ROOTDIR)/build/platforms/$(PLATFORM)/cantrip_apps.mk
# C apps
CANTRIP_SRC_C_APP := $(CANTRIP_SRC_DIR)/apps/c
CANTRIP_OUT_C_APP_DEBUG := $(CANTRIP_OUT_DEBUG)/apps/c
CANTRIP_OUT_C_APP_RELEASE := $(CANTRIP_OUT_RELEASE)/apps/c
$(CANTRIP_OUT_C_APP_DEBUG)/%.elf: $(CANTRIP_SRC_C_APP)/%.c $(CANTRIP_KERNEL_DEBUG)
$(MAKE) -C $(dir $<) \
LIBSEL4_SRC=$(SEL4_KERNEL_DIR)/libsel4 \
OUT_CANTRIP=$(CANTRIP_OUT_DEBUG) \
BUILD_ARCH=${CANTRIP_APP_ARCH} \
BUILD_ROOT=$(CANTRIP_OUT_C_APP_DEBUG) \
RUST_TARGET=${RUST_TARGET} \
BUILD_TYPE=debug
.PRECIOUS:: $(CANTRIP_OUT_C_APP_DEBUG)/%.elf
$(CANTRIP_OUT_C_APP_RELEASE)/%.elf: $(CANTRIP_SRC_C_APP)/%.c $(CANTRIP_KERNEL_RELEASE)
$(MAKE) -C $(dir $<) \
LIBSEL4_SRC=$(SEL4_KERNEL_DIR)/libsel4 \
OUT_CANTRIP=$(CANTRIP_OUT_RELEASE) \
BUILD_ARCH=${CANTRIP_APP_ARCH} \
RUST_TARGET=${RUST_TARGET} \
BUILD_ROOT=$(CANTRIP_OUT_C_APP_RELEASE) \
BUILD_TYPE=release
.PRECIOUS:: $(CANTRIP_OUT_C_APP_RELEASE)/%.elf
# Rust apps
CANTRIP_SRC_RUST_APP := $(CANTRIP_SRC_DIR)/apps/rust
CANTRIP_OUT_RUST_APP_DEBUG := $(CANTRIP_OUT_DEBUG)/apps/rust
CANTRIP_OUT_RUST_APP_RELEASE := $(CANTRIP_OUT_RELEASE)/apps/rust
# NB: pass SEL4_DIR for sel4-config to find the kernel
$(CANTRIP_OUT_RUST_APP_DEBUG)/%.elf: $(CANTRIP_SRC_RUST_APP)/%.rs $(CANTRIP_KERNEL_DEBUG)
$(MAKE) -C $(dir $<) \
OUT_CANTRIP=$(CANTRIP_OUT_DEBUG) \
SEL4_DIR=$(SEL4_KERNEL_DIR) \
BUILD_ARCH=${CANTRIP_APP_ARCH} \
RUST_TARGET=${RUST_TARGET} \
BUILD_ROOT=$(CANTRIP_OUT_RUST_APP_DEBUG) \
BUILD_TYPE=debug
.PRECIOUS:: $(CANTRIP_OUT_RUST_APP_DEBUG)/%.elf
$(CANTRIP_OUT_RUST_APP_RELEASE)/%.elf: $(CANTRIP_SRC_RUST_APP)/%.rs $(CANTRIP_KERNEL_RELEASE)
$(MAKE) -C $(dir $<) \
OUT_CANTRIP=$(CANTRIP_OUT_RELEASE) \
SEL4_DIR=$(SEL4_KERNEL_DIR) \
BUILD_ARCH=${CANTRIP_APP_ARCH} \
RUST_TARGET=${RUST_TARGET} \
BUILD_ROOT=$(CANTRIP_OUT_RUST_APP_RELEASE) \
BUILD_TYPE=release
.PRECIOUS:: $(CANTRIP_OUT_RUST_APP_RELEASE)/%.elf
## Build the hello-world C application in debug mode.
hello_debug_c: $(CANTRIP_OUT_C_APP_DEBUG)/hello/hello.app
## Build the hello-world C application in release mode.
hello_release_c: $(CANTRIP_OUT_C_APP_RELEASE)/hello/hello.app
## Build the hello-world Rust application in debug mode.
hello_debug_rust: $(CANTRIP_OUT_RUST_APP_DEBUG)/hello/hello.app
## Build the hello-world Rust application in release mode.
hello_release_rust: $(CANTRIP_OUT_RUST_APP_RELEASE)/hello/hello.app
## Build the hello-world C and Rust applications in debug mode.
hello_debug: hello_debug_c hello_debug_rust
## Build the hello-world C and Rust applications in release mode.
hello_release: hello_release_c hello_release_rust
## Build the fibonacci C application in debug mode.
fibonacci_debug_c: $(CANTRIP_OUT_C_APP_DEBUG)/fibonacci/fibonacci.app
## Build the fibonacci C application in release mode.
fibonacci_release_c: $(CANTRIP_OUT_C_APP_RELEASE)/fibonacci/fibonacci.app
## Build the fibonacci Rust application in debug mode.
fibonacci_debug_rust: $(CANTRIP_OUT_RUST_APP_DEBUG)/fibonacci/fibonacci.app
## Build the fibonacci Rust application in release mode.
fibonacci_release_rust: $(CANTRIP_OUT_RUST_APP_RELEASE)/fibonacci/fibonacci.app
## Build the Fibonacci C and Rust applications in debug mode.
fibonacci_debug: fibonacci_debug_c fibonacci_debug_rust
## Build the Fibonacci C and Rust applications in release mode.
fibonacci_release: fibonacci_release_c fibonacci_release_rust
## Build the keyval Rust application in debug mode.
keyval_debug: $(CANTRIP_OUT_RUST_APP_DEBUG)/keyval/keyval.app
## Build the keyval Rust application in release mode.
keyval_release: $(CANTRIP_OUT_RUST_APP_RELEASE)/keyval/keyval.app
## Build the logtest Rust application in debug mode.
logtest_debug: $(CANTRIP_OUT_RUST_APP_DEBUG)/logtest/logtest.app
## Build the logtest Rust application in release mode.
logtest_release: $(CANTRIP_OUT_RUST_APP_RELEASE)/logtest/logtest.app
## Build the mltest Rust application in debug mode.
mltest_debug: $(CANTRIP_OUT_RUST_APP_DEBUG)/mltest/mltest.app
## Build the mltest Rust application in release mode.
mltest_release: $(CANTRIP_OUT_RUST_APP_RELEASE)/mltest/mltest.app
## Build the panic Rust application in debug mode.
panic_debug: $(CANTRIP_OUT_RUST_APP_DEBUG)/panic/panic.app
## Build the panic Rust application in release mode.
panic_release: $(CANTRIP_OUT_RUST_APP_RELEASE)/panic/panic.app
## Build the playback Rust application in debug mode.
playback_debug: $(CANTRIP_OUT_RUST_APP_DEBUG)/playback/playback.app
## Build the playback Rust application in release mode.
playback_release: $(CANTRIP_OUT_RUST_APP_RELEASE)/playback/playback.app
## Build the suicide C application in debug mode.
suicide_debug: $(CANTRIP_OUT_C_APP_DEBUG)/suicide/suicide.app
## Build the suicide C application in release mode.
suicide_release: $(CANTRIP_OUT_C_APP_RELEASE)/suicide/suicide.app
## Build the timer Rust application in debug mode.
timer_debug: $(CANTRIP_OUT_RUST_APP_DEBUG)/timer/timer.app
## Build the timer Rust application in release mode.
timer_release: $(CANTRIP_OUT_RUST_APP_RELEASE)/timer/timer.app
.PHONY:: hello_debug hello_release
.PHONY:: fibonacci_debug fibonacci_release
.PHONY:: keyval_debug keyval_release
.PHONY:: logtest_debug logtest_release
.PHONY:: mltest_debug mltest_release
.PHONY:: panic_debug panic_release
.PHONY:: playback_debug playback_release
.PHONY:: suicide_debug suicide_release
.PHONY:: timer_debug timer_release