Skip to content
This repository has been archived by the owner on Jan 30, 2020. It is now read-only.

Commit

Permalink
Merge pull request #6 from csssuf/cargo
Browse files Browse the repository at this point in the history
Build with cargo instead of xargo
  • Loading branch information
csssuf authored Jun 22, 2017
2 parents f52db01 + d3462b8 commit 615e465
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 40 deletions.
5 changes: 3 additions & 2 deletions .cargo/config
Original file line number Diff line number Diff line change
@@ -1,12 +1,13 @@
#
[target.efi-app-x86_64]
[target.x86_64-unknown-linux-gnu]
rustflags = [
"--emit=obj",
"-C", "relocation-model=pic",
"-C", "linker=ld",
"-Z", "linker-flavor=ld",
"-C", "link-arg=-T/usr/lib64/gnuefi/elf_x86_64_efi.lds",
"-C", "link-arg=-znocombreloc",
"-C", "link-arg=/usr/lib64/gnuefi/crt0-efi-x86_64.o",
"-C", "link-arg=--hash-style=sysv",
"-C", "link-arg=-Bsymbolic",
"-C", "link-arg=-pie",
"-C", "link-arg=-lefi",
Expand Down
24 changes: 12 additions & 12 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,12 @@ LIB_DIR ?= /usr/lib64
EFI_DIR ?= $(LIB_DIR)/gnuefi

all: TYPE := release
all: XARGO_FLAG := --release
all: CARGO_FLAG := --release
all: build/bootx64-release.efi
.PHONY: all

debug: TYPE := debug
debug: XARGO_FLAG :=
debug: CARGO_FLAG :=
debug: build/bootx64-debug.efi build/bootx64-debug-symbols.efi
.PHONY: debug

Expand All @@ -17,20 +17,20 @@ build/bootx64-%.efi: build/picker-%.so
build/bootx64-%-symbols.efi: build/picker-%.so
objcopy --target=efi-app-x86_64 $< $@

# Because xargo/cargo don't remove old build artifacts from deps/ when
# building, if source files or dependencies are removed, they will still be
# linked into the final application unless they are cleaned up with the
# `clean` target or `xargo clean`.
build/picker-%.so: target/efi-app-x86_64/%/deps/picker.o
# Because cargo doesn't remove old build artifacts from deps/ when building, if
# source files or dependencies are removed, they will still be linked into the
# final application unless they are cleaned up with the `clean` target or
# `cargo clean`.
build/picker-%.so: target/%/deps/picker.o
@mkdir -p build
ld target/efi-app-x86_64/$(TYPE)/deps/*.o $(EFI_DIR)/crt0-efi-x86_64.o -nostdlib -znocombreloc -T $(EFI_DIR)/elf_x86_64_efi.lds -shared -Bsymbolic -lefi -L $(LIB_DIR) -pie -e efi_entry -o $@
ld target/$(TYPE)/deps/*.o $(EFI_DIR)/crt0-efi-x86_64.o -nostdlib -znocombreloc -T $(EFI_DIR)/elf_x86_64_efi.lds -shared -Bsymbolic -lefi -L $(LIB_DIR) -pie -e efi_entry -o $@

target/efi-app-x86_64/%/deps/picker.o: src/picker.rs src/uefi_entry/mod.rs src/util/mod.rs src/util/input.rs Cargo.toml
xargo build --target=efi-app-x86_64 $(XARGO_FLAG)
target/%/deps/picker.o: src/picker.rs src/uefi_entry/mod.rs src/util/mod.rs src/util/input.rs Cargo.toml
cargo build $(CARGO_FLAG)

clean:
-rm build/*
-xargo clean
-cargo clean
.PHONY: clean

.PRECIOUS: target/efi-app-x86_64/%/deps/picker.o
.PRECIOUS: target/%/deps/picker.o
26 changes: 0 additions & 26 deletions efi-app-x86_64.json

This file was deleted.

0 comments on commit 615e465

Please sign in to comment.