-
Notifications
You must be signed in to change notification settings - Fork 13
Expand file tree
/
Copy pathMakefile
More file actions
64 lines (54 loc) · 1.73 KB
/
Makefile
File metadata and controls
64 lines (54 loc) · 1.73 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
ARCH ?= x64
TIMEOUT ?= 30
KERNEL ?= HelloWorld
ifeq ($(ARCH),arm64)
RID := linux-arm64
DEFINE := ARCH_ARM64
COSMOS_ARCH := arm64
QEMU := qemu-system-aarch64 -M virt -cpu cortex-a72 -m 512M \
-bios /usr/share/qemu-efi-aarch64/QEMU_EFI.fd
else
RID := linux-x64
DEFINE := ARCH_X64
COSMOS_ARCH := x64
QEMU := qemu-system-x86_64 -enable-kvm -machine accel=kvm -cpu host
endif
OUTPUT := ./output-$(ARCH)
DEVKERNEL := ./examples/DevKernel/DevKernel.csproj
TEST_ENGINE := ./tests/Cosmos.TestRunner.Engine/Cosmos.TestRunner.Engine.csproj
.PHONY: setup build clean distclean run test test-cache
setup:
./.devcontainer/postCreateCommand.sh
build:
dotnet publish -c Debug -r $(RID) \
-p:DefineConstants="$(DEFINE)" -p:CosmosArch=$(COSMOS_ARCH) \
$(DEVKERNEL) -o $(OUTPUT)
clean:
rm -rf ./output-x64 ./output-arm64 uart.log
distclean: clean
rm -rf ./artifacts
dotnet nuget remove source local-packages 2>/dev/null || true
rm -rf ~/.nuget/packages/cosmos.* 2>/dev/null || true
run: build
@echo "Starting QEMU ($(ARCH))... Press Ctrl+A X to exit."
@QEMU_PID=""; \
trap 'test -n "$$QEMU_PID" && kill $$QEMU_PID 2>/dev/null || true' EXIT; \
$(QEMU) \
-cdrom $(OUTPUT)/DevKernel.iso \
-boot d \
-m 512M \
-serial file:uart.log \
-nographic \
-no-reboot \
-no-shutdown & \
QEMU_PID=$$!; \
sleep $(TIMEOUT); \
echo "Stopping QEMU..."; \
kill $$QEMU_PID 2>/dev/null || true
test:
dotnet build $(TEST_ENGINE) -c Debug
dotnet run --project $(TEST_ENGINE) --no-build \
-- tests/Kernels/Cosmos.Kernel.Tests.$(KERNEL) $(ARCH) $(TIMEOUT) \
test-results-$(KERNEL)-$(ARCH).xml ci
test-cache:
dotnet test tests/Cosmos.Tests.BuildCache/ -c Debug