@@ -27,7 +27,7 @@ FAT_IMG := $(BUILD_DIR)/fat.img
27
27
INITRD := $(BUILD_DIR ) /initrd.img
28
28
29
29
LD := ld
30
- RUSTCC := cargo
30
+ RUSTC := cargo
31
31
RM := rm -rf
32
32
VIEWER := qemu-system-x86_64
33
33
@@ -36,13 +36,11 @@ OVMF_VARS := OVMF_VARS.fd
36
36
37
37
# If you change values of `iobase` and `iosize`, don't forget to change the corresponding values in `kernel/src/lib.rs`!
38
38
VIEWERFLAGS := -drive if=pflash,format=raw,file=$(OVMF_CODE ) ,readonly=on -drive if=pflash,format=raw,file=$(OVMF_VARS ) ,readonly=on -drive format=raw,file=$(IMG_FILE ) -no-reboot -m 4G -d int -device isa-debug-exit,iobase=0xf4,iosize=0x04 -device qemu-xhci,id=xhci -device usb-kbd --trace events=trace.event -drive id=disk,file=$(FAT_IMG ) ,if=none,format=raw -device ahci,id=ahci -device ide-drive,drive=disk,bus=ahci.0 -device usb-mouse
39
-
40
- # This is a workaround for `compiler_builtins` crate which is supported only for optimized build.
41
- RELEASE_FLAGS := --release
39
+ RUSTCFLAGS := --release
42
40
43
41
LDFLAGS := -nostdlib -T $(LD_SRC )
44
42
45
- .PHONY :all copy_to_usb run test_general test release_test release clippy clean
43
+ .PHONY :all copy_to_usb run test clippy clean
46
44
47
45
.SUFFIXES :
48
46
@@ -63,21 +61,13 @@ endif
63
61
run :$(IMG_FILE ) $(OVMF_VARS ) $(OVMF_CODE ) $(FAT_IMG ) $(INITRD )
64
62
$(VIEWER ) $(VIEWERFLAGS ) -no-shutdown -monitor stdio
65
63
66
- test_general :$(INITRD ) $(FAT_IMG ) $(OVMF_VARS ) $(OVMF_CODE )
67
- make $(IMG_FILE ) RELEASE_FLAGS=$(RELEASE_FLAGS ) TEST_FLAG=--features=qemu_test -B
64
+ test :
65
+ make clean
66
+ make $(IMG_FILE ) TEST_FLAG=--features=qemu_test
68
67
$(VIEWER ) $(VIEWERFLAGS ) -nographic; if [[ $$ ? -eq 33 ]]; \
69
68
then echo " Booting test succeed! ($( TEST_MODE) mode)" ; exit 0; \
70
69
else echo " Booting test failed ($( TEST_MODE) mode)" ; exit 1; fi
71
70
72
- test :
73
- # For some reasons, without `make clean`, consecutive testing will go into the infinite loop.
74
- make clean
75
- make test_general TEST_MODE=debug
76
-
77
- release_test :
78
- make clean
79
- make test_general TEST_MODE=release RELEASE_FLAGS=--release
80
-
81
71
$(IMG_FILE ) :$(KERNEL_FILE ) $(HEAD_FILE ) $(EFI_FILE ) $(INITRD )
82
72
dd if=/dev/zero of=$@ bs=1k count=28800
83
73
mformat -i $@ -h 200 -t 500 -s 144::
@@ -93,27 +83,21 @@ $(IMG_FILE):$(KERNEL_FILE) $(HEAD_FILE) $(EFI_FILE) $(INITRD)
93
83
$(FAT_IMG ) :$(IMG_FILE )
94
84
cp $^ $@
95
85
96
- release :
97
- make RELEASE_FLAGS=--release -B
98
-
99
- release_run :
100
- make release && make run
101
-
102
86
$(KERNEL_FILE ) :$(LIB_FILE ) $(LD_SRC ) |$(BUILD_DIR )
103
87
$(LD ) $(LDFLAGS ) -o $@ $(LIB_FILE )
104
88
105
89
$(LIB_FILE ) : $(RUST_SRC ) $(COMMON_SRC ) $(COMMON_SRC_DIR ) /$(CARGO_TOML ) $(KERNEL_DIR ) /$(CARGO_TOML ) $(KERNEL_DIR ) /$(CARGO_JSON ) $(CONFIG_TOML ) |$(BUILD_DIR )
106
90
# FIXME: Currently `cargo` tries to read `$(pwd)/.cargo/config.toml`, not
107
91
# `$(dirname argument_of_--manifest-path)/.cargo/config.toml`.
108
92
# See: https://github.com/rust-lang/cargo/issues/2930
109
- cd $(KERNEL_DIR ) && $(RUSTCC ) build --out-dir ../$(BUILD_DIR ) -Z unstable-options $(RELEASE_FLAGS ) $(TEST_FLAG )
93
+ cd $(KERNEL_DIR ) && $(RUSTC ) build --out-dir ../$(BUILD_DIR ) -Z unstable-options $(TEST_FLAG ) $(RUSTCFLAGS )
110
94
111
95
% .fd :
112
96
@echo " $@ not found"
113
97
exit 1
114
98
115
99
$(EFI_FILE ) :$(EFI_SRC ) $(COMMON_SRC ) $(COMMON_SRC_DIR ) /$(CARGO_TOML ) $(EFI_DIR ) /$(CARGO_TOML ) |$(BUILD_DIR )
116
- cd $(EFI_DIR ) && $(RUSTCC ) build --out-dir=../$(BUILD_DIR ) -Z unstable-options $(RELEASE_FLAGS )
100
+ cd $(EFI_DIR ) && $(RUSTC ) build --out-dir=../$(BUILD_DIR ) -Z unstable-options $(RUSTCFLAGS )
117
101
118
102
$(INITRD ) :|$(BUILD_DIR )
119
103
tar cf $@ $(BUILD_DIR )
@@ -126,5 +110,5 @@ clippy:
126
110
127
111
clean :
128
112
$(RM ) build
129
- $(RUSTCC ) clean --manifest-path=$(KERNEL_DIR ) /Cargo.toml
130
- $(RUSTCC ) clean --manifest-path=$(EFI_DIR ) /Cargo.toml
113
+ $(RUSTC ) clean --manifest-path=$(KERNEL_DIR ) /Cargo.toml
114
+ $(RUSTC ) clean --manifest-path=$(EFI_DIR ) /Cargo.toml
0 commit comments