Skip to content
Snippets Groups Projects
Commit 851fb5a1 authored by John Hodge's avatar John Hodge
Browse files

Kernel - Add ACPICA to Makefile-xargo

parent 6299e73f
No related merge requests found
...@@ -6,6 +6,9 @@ version = "0.0.0" ...@@ -6,6 +6,9 @@ version = "0.0.0"
path = "main/main.rs" path = "main/main.rs"
crate-type = ["staticlib"] crate-type = ["staticlib"]
[features]
acpica = [ "kernel/acpica" ]
[dependencies] [dependencies]
kernel = { path = "Core" } kernel = { path = "Core" }
syscalls = { path = "Modules/syscalls" } syscalls = { path = "Modules/syscalls" }
......
...@@ -5,6 +5,10 @@ version = "0.0.0" ...@@ -5,6 +5,10 @@ version = "0.0.0"
[lib] [lib]
path = "main.rs" path = "main.rs"
[features]
acpica = [ "va_list" ]
[dependencies] [dependencies]
stack_dst = { path = "../../externals/crates.io/stack_dst", default-features = false } stack_dst = { path = "../../externals/crates.io/stack_dst", default-features = false }
tag_safe = "0.2" tag_safe = "0.2"
va_list = { version = "0.1", default-features = false, features = ["no_std"], optional = true }
...@@ -10,10 +10,9 @@ use prelude::*; ...@@ -10,10 +10,9 @@ use prelude::*;
module_define!{ACPI, [], init} module_define!{ACPI, [], init}
#[cfg(use_acpica)] #[cfg_attr(any(use_acpica,feature="acpica"), path="acpica/mod.rs")]
#[path="acpica/mod.rs"] mod internal; #[cfg_attr(not(any(use_acpica,feature="acpica")), path="mine/mod.rs")]
#[cfg(not(use_acpica))] mod internal;
#[path="mine/mod.rs"] mod internal;
#[repr(u8)] #[repr(u8)]
#[derive(Copy,Clone,PartialEq)] #[derive(Copy,Clone,PartialEq)]
......
...@@ -117,7 +117,7 @@ OBJS := $(filter-out $(EXT_CRATES:%=%.o), $(OBJS)) ...@@ -117,7 +117,7 @@ OBJS := $(filter-out $(EXT_CRATES:%=%.o), $(OBJS))
OBJS := $(OBJS:%=$(OBJDIR)%) OBJS := $(OBJS:%=$(OBJDIR)%)
LIBS := $(OBJDIR)libcore.rlib $(OBJDIR)libcompiler_builtins.rlib $(EXT_CRATES:%=$(OBJDIR)lib%.rlib) LIBS := $(OBJDIR)libcore.rlib $(OBJDIR)libcompiler_builtins.rlib $(EXT_CRATES:%=$(OBJDIR)lib%.rlib)
ifeq ($(USE_ACPICA),1) ifeq ($(USE_ACPICA),1)
LIBS += $(OBJDIR)acpica.a LIBS += $(OBJDIR)libacpica.a
endif endif
.SUFFIXES: .SUFFIXES:
...@@ -249,7 +249,7 @@ $(OBJDIR)libcompiler_builtins.rlib: $(RUSTUP_SRC_DIR)libcompiler_builtins/src/li ...@@ -249,7 +249,7 @@ $(OBJDIR)libcompiler_builtins.rlib: $(RUSTUP_SRC_DIR)libcompiler_builtins/src/li
$V$(ENV) $(RUSTC) $(RUSTFLAGS) --emit=link,dep-info --out-dir $(dir $@) --cfg feature=\"compiler-builtins\" $< --cfg stage0 $V$(ENV) $(RUSTC) $(RUSTFLAGS) --emit=link,dep-info --out-dir $(dir $@) --cfg feature=\"compiler-builtins\" $< --cfg stage0
@cp $(OBJDIR)core.d $(OBJDIR)libcore.d @cp $(OBJDIR)core.d $(OBJDIR)libcore.d
$(OBJDIR)acpica.a: ../acpica/Makefile $(wildcard ../acpica/patches/source/include/platform/*) $(OBJDIR)libacpica.a: ../acpica/Makefile $(wildcard ../acpica/patches/source/include/platform/*)
make -C ../acpica TRIPLE=$(TRIPLE) ARCH=$(ARCH) srcdir make -C ../acpica TRIPLE=$(TRIPLE) ARCH=$(ARCH) srcdir
make -C ../acpica TRIPLE=$(TRIPLE) ARCH=$(ARCH) make -C ../acpica TRIPLE=$(TRIPLE) ARCH=$(ARCH)
cp ../acpica/acpica-$(TRIPLE).a $@ cp ../acpica/acpica-$(TRIPLE).a $@
......
...@@ -4,12 +4,20 @@ ...@@ -4,12 +4,20 @@
V ?= @ V ?= @
-include ../common.mk -include ../common.mk
# - ACPICA can only be used on x86_64/amd64
ifeq ($(ARCH),amd64)
USE_ACPICA ?= 1
else
USE_ACPICA = 0
endif
-include BuildNum.$(ARCH).mk -include BuildNum.$(ARCH).mk
BUILDNUM ?= 1 BUILDNUM ?= 1
OBJDIR := .obj/$(ARCH)/ OBJDIR := .obj/$(ARCH)/
OBJS := $(addprefix $(OBJDIR),start.ao log_cfg.ao libmain.a) OBJS := $(addprefix $(OBJDIR),start.ao log_cfg.ao libmain.a)
CARGO_FEATURES :=
ENV := RUST_VERSION="$(shell $(RUSTC) --version)" ENV := RUST_VERSION="$(shell $(RUSTC) --version)"
ENV += TK_GITSPEC="$(shell git log -n 1 | head -n 1 | awk '{print $$2}')" ENV += TK_GITSPEC="$(shell git log -n 1 | head -n 1 | awk '{print $$2}')"
ENV += TK_VERSION="0.1" ENV += TK_VERSION="0.1"
...@@ -21,8 +29,10 @@ LINKFLAGS += --gc-sections # Prevents complaining about floating point methods ...@@ -21,8 +29,10 @@ LINKFLAGS += --gc-sections # Prevents complaining about floating point methods
#LINKFLAGS += --print-gc-sections #LINKFLAGS += --print-gc-sections
EXCLUDE_FEATURES := EXCLUDE_FEATURES :=
ifeq ($(ARCH),amd64)
EXCLUDE_FEATURES := 3dnow avx avx2 sse sse2 sse3 sse4.1 sse4.2 mmx ifeq ($(USE_ACPICA),1)
OBJS += $(OBJDIR)libacpica.a
CARGO_FEATURES += acpica
endif endif
XARGO := RUST_TARGET_PATH=$(abspath targets) $(XARGO) XARGO := RUST_TARGET_PATH=$(abspath targets) $(XARGO)
...@@ -61,7 +71,7 @@ endif ...@@ -61,7 +71,7 @@ endif
# #
$(OBJDIR)libmain.a: PHONY targets/target-$(ARCH).json $(OBJDIR)libmain.a: PHONY targets/target-$(ARCH).json
@echo "[XARGO] . > $@" @echo "[XARGO] . > $@"
$V$(ENV) $(XARGO) rustc --target=target-$(ARCH) --release -- -C target-feature=$(subst $(space),$(comma),$(EXCLUDE_FEATURES:%=-%)) $V$(ENV) $(XARGO) rustc --target=target-$(ARCH) --release --features "$(CARGO_FEATURES)" -- -C target-feature=$(subst $(space),$(comma),$(EXCLUDE_FEATURES:%=-%))
@mkdir -p $(dir $@) @mkdir -p $(dir $@)
@cp target/target-$(ARCH)/release/libmain.a $@ @cp target/target-$(ARCH)/release/libmain.a $@
...@@ -69,6 +79,12 @@ targets/target-$(ARCH).json: Core/arch/$(ARCH)/target.json ...@@ -69,6 +79,12 @@ targets/target-$(ARCH).json: Core/arch/$(ARCH)/target.json
@mkdir -p $(dir $@) @mkdir -p $(dir $@)
$Vcp $< $@ $Vcp $< $@
# ACPICA
$(OBJDIR)libacpica.a: ../acpica/Makefile $(wildcard ../acpica/patches/source/include/platform/*)
make -C ../acpica TRIPLE=$(TRIPLE) ARCH=$(ARCH) srcdir
make -C ../acpica TRIPLE=$(TRIPLE) ARCH=$(ARCH)
cp ../acpica/acpica-$(TRIPLE).a $@
$(OBJDIR)%.ao: Core/arch/$(ARCH)/%.asm $(OBJDIR)%.ao: Core/arch/$(ARCH)/%.asm
@echo [AS] -o $@ @echo [AS] -o $@
@mkdir -p $(dir $@) @mkdir -p $(dir $@)
...@@ -82,3 +98,4 @@ $(OBJDIR)log_cfg.ao: Core/log_cfg.S ...@@ -82,3 +98,4 @@ $(OBJDIR)log_cfg.ao: Core/log_cfg.S
@echo [AS] -o $@ @echo [AS] -o $@
@mkdir -p $(dir $@) @mkdir -p $(dir $@)
$V$(CC) -o $@ -c $< $V$(CC) -o $@ -c $<
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment